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.03k stars 19.12k forks source link

[BUG] Marlin Simulator on Windows compilation fail due to multiple defs #25833

Closed lukasradek closed 11 months ago

lukasradek commented 1 year ago

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

Yes, and the problem still exists.

Bug Description

I am trying to compile Marlin with default simulator config on Windows 11 and I am getting this linker errors (there are multiple withing the same file with different missing tokens, this is just one example).

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 

.pio/build/simulator_windows/debug/lib9ed/libMarlinSimUI.a(application.o): in function `get_pin_mode(short)':

<path-to-marlin>\Marlin/Marlin/src/pins/../HAL/NATIVE_SIM/pinsDebug.h:41: multiple definition of `get_pin_mode(short)'; 

.pio/build/simulator_windows/debug/src/src/gcode/config/M43.o:
<path-to-marlin>\Marlin/Marlin/src/gcode/config/../../pins/../HAL/NATIVE_SIM/pinsDebug.h:41: first defined here

It comes from the precompiled MarlinSimulator files, so that might be in @p3p realm.

Surprisingly (to me), commenting out the include of pinDebug.h inside M43.cpp caused "not declared in this scope" errors instead but not for the same tokens, so... possibly old sourcecode is compiled into libMarlinSimUI.a?

Temporary workaround: Disable PINS_DEBUGGING in Configuration_adv.h

Bug Timeline

I discovered it just now, but it must have started very recently. I guess it is a consequence of the 3rd party dependencies rework.

Expected behavior

No response

Actual behavior

No response

Steps to Reproduce

No response

Version of Marlin Firmware

bugfix-2.1.x

Printer model

Simulator Windows

Electronics

No response

Add-ons

No response

Bed Leveling

None

Your Slicer

None

Host Software

None

Don't forget to include

Additional information & file uploads

No response

ellensp commented 1 year ago

disable #define PINS_DEBUGGING

lukasradek commented 1 year ago

disable #define PINS_DEBUGGING

Well... read through the post 😉.

p3p commented 1 year ago

This has always been the case as I hook into Marlins pin debug feature to get the pin naming data for the sims UI, not sure of a workaround other than disabling the SimUI feature to use the Marlin feature.

Marlin was never designed for the way the simulator uses it, but by design the sim needs to work without modifying Marlin.

lukasradek commented 1 year ago

I am not sure either 🙂.

But isn't this just the "not matching source versions being linked together" problem? I have never had this happen before and I actually discovered this on my long-running config that I haven't changed for quite a while (apart from version upgrades).

I am not sure what you mean by disabling the SimUI feature to use the Marlin feature, but that probably doesn't matter since that is not in my competence to change 🙂. Wouldn't it be a viable solution though to let Marlin "publish" some "interface" file that would define that naming data but wouldn't clash with other includes inside Marlin?

ellensp commented 1 year ago

You miss understand.

The simulator uses its own function called get_pin_mode to tap into marlin to get the pin naming data.

You cannot enable PINS_DEBUGGING in Marlin. It is simply incompatible with the way the emulator is implemented.

lukasradek commented 1 year ago

Alright 🙂. So should this be a PR to disable PINS_DEBUGGING in simulator config that is published?

thinkyhead commented 1 year ago

I patched this duplicate function problem recently. Please give it another go with the latest code and see if I got them all.

github-actions[bot] commented 9 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.