MattiaMontanari / openGJK

Fast and reliable implementation of the Gilbert-Johnson-Keerthi (GJK) algorithm for C, C#, Go, Matlab and Python
https://www.mattiamontanari.com/opengjk/
GNU General Public License v3.0
135 stars 37 forks source link

Possible linker issue on Ubuntu 18.04 - Undefined Reference #11

Closed magicbycalvin closed 4 years ago

magicbycalvin commented 4 years ago

I followed the installation instructions (create a new folder, call cmake followed by make) but ran into the following error:

../lib/libopenGJKlib.a(openGJK.c.o): In function `S2D':
openGJK.c:(.text+0x116): undefined reference to `pow'
openGJK.c:(.text+0x17c3): undefined reference to `sqrt'
../lib/libopenGJKlib.a(openGJK.c.o): In function `gjk':
openGJK.c:(.text+0x3d1b): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status
example1_c/CMakeFiles/demo.dir/build.make:95: recipe for target 'example1_c/demo' failed
make[2]: *** [example1_c/demo] Error 1
CMakeFiles/Makefile2:140: recipe for target 'example1_c/CMakeFiles/demo.dir/all' failed
make[1]: *** [example1_c/CMakeFiles/demo.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I am not very experienced with cmake and make so there is a chance that I have done something wrong. I looked in the CMakeLists.txt file and noticed that you do include the -lm flag which should properly link the math library which suggests that it should work. Perhaps there is a load order issue?

In the meantime, I managed to temporarily fix it by copying openGJK.c to openGJK/example1_c and openGJK.h to openGJK/example1_c/openGJK and then running gcc main.c openGJK.c -o openGJK.bin -lm.

Please let me know if I am missing anything. Thanks!

MattiaMontanari commented 4 years ago

I think you're doing all OK and the problem is in my setting. However, try to work on the development branch. That should work OK and you can refer to the docs here https://mmontanari.gitlab.io/opengjk_3d/

I apologise for leaving the master branch in this state.. I should merge soon..


From: magicbycalvin notifications@github.com Sent: Tuesday, June 30, 2020 6:17:24 PM To: MattiaMontanari/openGJK openGJK@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [MattiaMontanari/openGJK] Possible linker issue on Ubuntu 18.04 - Undefined Reference (#11)

I followed the installation instructions (create a new folder, call cmake followed by make) but ran into the following error:

../lib/libopenGJKlib.a(openGJK.c.o): In function S2D': openGJK.c:(.text+0x116): undefined reference topow' openGJK.c:(.text+0x17c3): undefined reference to sqrt' ../lib/libopenGJKlib.a(openGJK.c.o): In functiongjk': openGJK.c:(.text+0x3d1b): undefined reference to `sqrt' collect2: error: ld returned 1 exit status example1_c/CMakeFiles/demo.dir/build.make:95: recipe for target 'example1_c/demo' failed make[2]: [example1_c/demo] Error 1 CMakeFiles/Makefile2:140: recipe for target 'example1_c/CMakeFiles/demo.dir/all' failed make[1]: [example1_c/CMakeFiles/demo.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

I am not very experienced with cmake and make so there is a chance that I have done something wrong. I looked in the CMakeLists.txt file and noticed that you do include the -lm flag which should properly link the math library which suggests that it should work. Perhaps there is a load order issue?

In the meantime, I managed to temporarily fix it by copying openGJK.c to openGJK/example1_c and openGJK.h to openGJK/example1_c/openGJK and then running gcc main.c openGJK.c -o openGJK -lm.

Please let me know if I am missing anything. Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/MattiaMontanari/openGJK/issues/11, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADJFWWAQTGBGIPJATBUBZBDRZIFZJANCNFSM4OMNDAUA.

magicbycalvin commented 4 years ago

No worries, thanks for the quick response!

MattiaMontanari commented 4 years ago

Just checking, did that work?

From: magicbycalvin notifications@github.com Reply to: MattiaMontanari/openGJK reply@reply.github.com Date: Tuesday, 30 June 2020 at 23:23 To: MattiaMontanari/openGJK openGJK@noreply.github.com Cc: Mattia Montanari mattia.montanari7@gmail.com, Comment comment@noreply.github.com Subject: Re: [MattiaMontanari/openGJK] Possible linker issue on Ubuntu 18.04 - Undefined Reference (#11)

No worries, thanks for the quick response!

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/MattiaMontanari/openGJK/issues/11#issuecomment-652077479, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADJFWWF7ZIMVRGCZDKDNRO3RZJQURANCNFSM4OMNDAUA.

magicbycalvin commented 4 years ago

Just tested the dev branch and it worked out great! On a side note, I'm running Ubuntu 18.04 which has cmake version 3.10 through apt. I had to install the latest version through the cmake website which wasn't a big deal. However, for the sake of ease, you might want to stick with 3.10 just so that the most up to date version on apt is supported. Thank you for your time and effort!