PropWare icon indicating copy to clipboard operation
PropWare copied to clipboard

multiple definition of `_drive_speed'

Open BloodWorkXGaming opened this issue 6 years ago • 8 comments

When building PropWare with the include #include <abdrive.h> or #include <abdrive360.h> you get the following error from CMake:

C:\PropWare\share\PropWare\lib\cmm\libSimple.a(speed.c.obj): In function `_drive_speed':
(.text.drive_speed+0x0): multiple definition of `_drive_speed'
C:\PropWare\share\PropWare\lib\cmm\libSimple.a(drive_speed.c.obj):(.text.drive_speed+0x0): first defined here
collect2: ld returned 1 exit status
make.exe[3]: *** [SoPro] Fehler 1
make.exe[2]: *** [CMakeFiles/SoPro.dir/all] Fehler 2
make.exe[1]: *** [CMakeFiles/SoPro.dir/rule] Fehler 2
make.exe: *** [SoPro] Fehler 2

I suspect this is due to abdrive and abdrive both having the same functions (drive_goto, drive_speed, etc)

Any idea on how to fix that?

BloodWorkXGaming avatar Dec 19 '18 09:12 BloodWorkXGaming

What version of the simple libraries are you using?

I'll see if I can reproduce the issue with the version being pulled in by PropWare. Also, what branch of PropWare?

DavidZemon avatar Dec 19 '18 13:12 DavidZemon

Ye, using the files being pulled in my PropWare.

I'm on Windows, Propware version 3.0.0.182, installed with the installer.

As a workaround I copy pasted the c files from the abdrive folder, and it is working just fine that way.

BloodWorkXGaming avatar Dec 19 '18 13:12 BloodWorkXGaming

I'm able to build the attached project with the following size:

Code size  = 19412
Total size = 25200

If you run into the same error with the attached project, can you build with VERBOSE=1, such as make VERBOSE=1 and then share the build output?

abdrive_test.zip

You are not able to reproduce the problem with the attached project, then please attach your project and I'll see if I can reproduce it with that.

DavidZemon avatar Dec 19 '18 15:12 DavidZemon

Thanks for the test file, that strangely builds for me. I attached a minimal file where I am able to reproduce the error.

sopro_c.zip

>make VERBOSE=1
C:/PropWare/bin/cmake.exe -HC:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c -BC:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c/bin --check-build-system CMakeFiles/Makefile.cmake
 0
C:/PropWare/bin/cmake.exe -E cmake_progress_start C:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c/bin/CMakeFiles C:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c/bin/CMakeFiles/
progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `C:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c/bin'
make -f CMakeFiles/SoPro.dir/build.make CMakeFiles/SoPro.dir/depend
make[2]: Entering directory `C:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c/bin'
C:/PropWare/bin/cmake.exe -E cmake_depends "Unix Makefiles" C:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c C:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c C:/Users/jonas/Docum
ents/GitHub/SoftwareProjekt/team1316/sopro_c/bin C:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c/bin C:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c/bin/CMakeFiles/SoPro.dir/De
pendInfo.cmake --color=
make[2]: Leaving directory `C:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c/bin'
make -f CMakeFiles/SoPro.dir/build.make CMakeFiles/SoPro.dir/build
make[2]: Entering directory `C:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c/bin'
[ 50%] Linking C executable SoPro
"C:/Program Files (x86)/SimpleIDE/propeller-gcc/bin/propeller-elf-gcc.exe"   -Wl,--gc-sections -mlmm -oSoPro "CMakeFiles/SoPro.dir/main.cpp.obj"  C:/PropWare/share/PropWare/lib/lmm/libPropWare.a C:/PropWare/sha
re/PropWare/lib/lmm/libLibpropeller.a C:/PropWare/share/PropWare/lib/lmm/libLibPropelleruino.a C:/PropWare/share/PropWare/lib/lmm/libSimple.a
C:/PropWare/share/PropWare/lib/lmm/libSimple.a(speed.c.obj): In function `_drive_speed':
(.text.drive_speed+0x0): multiple definition of `_drive_speed'
C:/PropWare/share/PropWare/lib/lmm/libSimple.a(drive_speed.c.obj):(.text.drive_speed+0x0): first defined here
collect2: ld returned 1 exit status
make[2]: *** [SoPro] Fehler 1
make[2]: Leaving directory `C:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c/bin'
make[1]: *** [CMakeFiles/SoPro.dir/all] Fehler 2
make[1]: Leaving directory `C:/Users/jonas/Documents/GitHub/SoftwareProjekt/team1316/sopro_c/bin'
make: *** [all] Fehler 2

BloodWorkXGaming avatar Dec 19 '18 15:12 BloodWorkXGaming

Well that sure is interesting isn't it? That one function was used all over the place in the demo program and didn't have any issues. I have it reproducing with your attached program... I'll dig deeper now.

DavidZemon avatar Dec 19 '18 15:12 DavidZemon

Ye that surely is wierd... Thanks for looking into it!

BloodWorkXGaming avatar Dec 19 '18 15:12 BloodWorkXGaming

Long story short: there are obviously multiple definitions of the function in the Simple library. I'm seeing drive_speed.c in libarlo and libabdrive360 as well as libabdrive's speed.c. The correct fix is to get Parallax to rename all three functions to be unique (they do each have different implementations) but that could take anywhere from a day to a few years, depending on whether or not they care to support this use case.

So... I'm trying to find a work around. But now I have to go to work and make the real money :P

DavidZemon avatar Dec 19 '18 16:12 DavidZemon

Thanks, that would make sense.

My current workaround is to copy the whole abdrive folder (with headers and c files) or abdrive360 respectively, whatever is needed. This works perfectly in my usecase.

BloodWorkXGaming avatar Dec 19 '18 16:12 BloodWorkXGaming