Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple definition of `_drive_speed' #146

Open
BloodWorkXGaming opened this issue Dec 19, 2018 · 8 comments
Open

multiple definition of `_drive_speed' #146

BloodWorkXGaming opened this issue Dec 19, 2018 · 8 comments

Comments

@BloodWorkXGaming
Copy link

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?

@DavidZemon
Copy link
Collaborator

DavidZemon commented Dec 19, 2018

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?

@BloodWorkXGaming
Copy link
Author

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.

@DavidZemon
Copy link
Collaborator

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.

@BloodWorkXGaming
Copy link
Author

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

@DavidZemon
Copy link
Collaborator

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.

@BloodWorkXGaming
Copy link
Author

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

@DavidZemon
Copy link
Collaborator

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

@BloodWorkXGaming
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants