-
Notifications
You must be signed in to change notification settings - Fork 24
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
Build issue, ubuntu 20.04 math linking #148
Comments
Thanks for reporting. It should be added so it works out of the box. I will do that in the next few days. Floating point is not needed for t_cose to work. It's just that qcbor has some features that need floating-point. t_cose doesn't use those. So another solution here is to recompile QCBOR with floating point turned off. |
Looked into this a bit more and I'm now confused. There should be no references in t_cose_test main.o, test/run_tests.o and such to QCBOR functions that need the math library so they linker shouldn't go looking for these math functions. I don't have an ubuntu system, but I do run t_cose CI against ubuntu with OpenSSL in GitHub and it is OK without -lm. I tried a few things on MacOS to see what symbols showed up. It wasn't conclusive and I didn't get to the bottom of it, but it may relate to use of shared libraries and dynamic linking. Basically, it seems like the linker should be taking care of this and that -lm should not be necessary. I don't want to add -lm to the makefiles unless I know it really is necessary. It doesn't seem necessary to me yet. Maybe you can check a few things on your end? Thx. |
Sure, lets leave this open for now. Right now Im just trying to get some things going to support the new CAT spec using t_cose (hopefully end up as an open sourced library for CAT). Once I get further along with that and start integrating it back into the main project it's for (apache traffic server) I can see if there are more build oddities with it there since we run ATS through a ton of various CI builds |
This issue is a bit complicated, but these solutions may help you.
CI output shows that cmake automatically finds libm.
In my environment the cmake command generates
|
Ken has it figured out here. Will fix this in the next few days by adding -lm in the Makefile. |
Was getting this building for another project and right now just working within ubuntu 20.04, when I went to build the openssl version I was getting:
cc -o t_cose_test main.o test/t_cose_test.o test/run_tests.o test/t_cose_sign_verify_test.o test/t_cose_make_test_messages.o test/t_cose_make_openssl_test_key.o libt_cose.a -lqcbor -l crypto
/usr/bin/ld: /usr/local/lib/libqcbor.a(qcbor_decode.o): in function
DoubleConvertAll': qcbor_decode.c:(.text+0x293): undefined reference to
exp2'/usr/bin/ld: qcbor_decode.c:(.text+0x325): undefined reference to
pow' /usr/bin/ld: qcbor_decode.c:(.text+0x35f): undefined reference to
pow'/usr/bin/ld: qcbor_decode.c:(.text+0x3be): undefined reference to
exp2' /usr/bin/ld: /usr/local/lib/libqcbor.a(qcbor_decode.o): in function
ConvertInt64':qcbor_decode.c:(.text+0x4c5): undefined reference to
feclearexcept' /usr/bin/ld: qcbor_decode.c:(.text+0x4d4): undefined reference to
llround'/usr/bin/ld: qcbor_decode.c:(.text+0x4e0): undefined reference to
lroundf' /usr/bin/ld: qcbor_decode.c:(.text+0x4ee): undefined reference to
fetestexcept'/usr/bin/ld: /usr/local/lib/libqcbor.a(qcbor_decode.o): in function
ConvertUInt64': qcbor_decode.c:(.text+0x582): undefined reference to
feclearexcept'/usr/bin/ld: qcbor_decode.c:(.text+0x5af): undefined reference to
round' /usr/bin/ld: qcbor_decode.c:(.text+0x5f9): undefined reference to
roundf'/usr/bin/ld: qcbor_decode.c:(.text+0x639): undefined reference to `fetestexcept'
collect2: error: ld returned 1 exit status
Editing the makefile to add a
-lm
to the linking steps resolved it though. So wasnt sure if it was missing for a reason?The text was updated successfully, but these errors were encountered: