MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.28k stars 19.24k forks source link

[BUG] MarlinSimulator Crashes in Windows #26661

Closed classicrocker883 closed 9 months ago

classicrocker883 commented 10 months ago

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

I get an error strlcpy undefined.
in ini/native.ini -DHAS_LIBBSD makes it so strlcpy is not defined because of the #ifndef HAS_LIBBSD directive. I dont know if this was a mistake and should be #ifdef instead, but removing -DHAS_LIBBSD solves that issue.

however, the "SDL2" library is in 'Program Files' and not 'C:\', at least thats how it defaulted in my installation. but I did notice to install now it goes to C: for new installs for MSYS2 mingw64

I was able to circumvent this by copying the SDL2 directory into libdeps/simulator_windows/, or change it to "Program\ FIles" in the .ini

anyway I dont know but I used to be able to get the MarlinSimulator.exe running just fine, I have an older version of this that doesn't crash. but anytime I make a new one, it will load, and subsequently crash after like 3 seconds of being open. it actually closes instead of crashing.

Bug Timeline

Use strlcpy with buffer size (https://github.com/MarlinFirmware/Marlin/pull/26513)

Expected behavior

MarlinSimulator_Working.zip

Actual behavior

MarlinSimulator_Crashes-pt1.zip MarlinSimulator_Crashes-pt2.zip

(extract -pt2 first)

Steps to Reproduce

  1. Take a Config example, like CrealityUI for Ender3-V2
  2. I used DWIN_LCD_PROUI
  3. To create your own MarlinSimulator, start by changing in Configuration.h MOTHERBOARD to BOARD_SIMULATED, also disable ENDSTOP_INTERRUPTS_FEATURE
  4. In platformio.ini default_envs = change to simulator_windows.

Version of Marlin Firmware

bugfix-2.1.x

Printer model

Voxelab Aquila

Electronics

No response

LCD/Controller

No response

Other add-ons

No response

Bed Leveling

MBL Manual Bed Leveling

Your Slicer

None

Host Software

None

Don't forget to include

Additional information & file uploads

No response

ellensp commented 10 months ago

There is no simulation for a DWIN_LCD_PROUI (or any other dwin displays in the simulator) Best you would get is a raw serial data

thisiskeithb commented 10 months ago

Here's the simulator config: https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.1.x/config/examples/Simulator

//
// Simulator currently supports these displays. Choose one!
//
#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
//#define REPRAP_DISCOUNT_SMART_CONTROLLER
//#define TFT_CLASSIC_UI
//#define TFT_COLOR_UI

// Enable parent LCD based on your selection above
#if ANY(TFT_CLASSIC_UI, TFT_COLOR_UI)
  #define TFT_GENERIC
  #define TOUCH_SCREEN
#elif ENABLED(LIGHTWEIGHT_UI)
  #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
#endif
ellensp commented 10 months ago

-DHAS_LIBBSD is set on environments where strlcpy is already part of the OS so the code doesn't need the work around in the #ifndef HAS_LIBBSD block

EvilGremlin commented 10 months ago

bridging sim to real serial port is possible with socat, port 3 is TCP socket on port 8099

mriscoc commented 9 months ago

-DHAS_LIBBSD is set on environments where strlcpy is already part of the OS so the code doesn't need the work around in the #ifndef HAS_LIBBSD block

@ellensp by default in my MSYS2 installation of Windows 10 x64 libbsd seems to be missing, I added it to MSYS2 by executing:

$ pacman -S libbsd

The package was installed but VSCODE still cannot find strlcpy (I also tried with -lbsd).

By removing -DHAS_LIBBSD from the simulator_windows environment in native.ini your implementation is used and the simulator can be compiled and all is working correctly.

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.