Fraunhofer-SIT / charra

Proof-of-concept implementation of the "Challenge/Response Remote Attestation" interaction model of the IETF RATS Reference Interaction Models for Remote Attestation Procedures using TPM 2.0.
BSD 3-Clause "New" or "Revised" License
27 stars 20 forks source link

Undefined reference problem during CHARRA compilation #13

Closed Asiderr closed 3 years ago

Asiderr commented 3 years ago

Compiling the CHARRA inside the container results with following error:

cc src/attester.c obj/common/charra_log.o obj/core/charra_dto.o obj/core/charra_helper.o obj/core/charra_key_mgr.o obj/core/charra_marshaling.o obj/util/cbor_util.o obj/util/charra_util.o obj/util/coap_util.o obj/util/tpm2_util.o -std=c99 -g -pedantic -Wall -Wextra -fdata-sections -ffunction-sections -DCHARRA_LOG_USE_COLOR -lm -Iinclude -I/usr/include -I/usr/local/include -L/usr/local/lib/ -L/usr/lib/x86_64-linux-gnu -lcoap-2 -lqcbor -lcrypto -lssl -lutil -ltss2-esys -ltss2-sys -ltss2-mu -ltss2-tcti-mssim -g -o bin/attester -Wl,--gc-sections
cc src/verifier.c obj/common/charra_log.o obj/core/charra_dto.o obj/core/charra_helper.o obj/core/charra_key_mgr.o obj/core/charra_marshaling.o obj/util/cbor_util.o obj/util/charra_util.o obj/util/coap_util.o obj/util/tpm2_util.o -std=c99 -g -pedantic -Wall -Wextra -fdata-sections -ffunction-sections -DCHARRA_LOG_USE_COLOR -lm -Iinclude -I/usr/include -I/usr/local/include -L/usr/local/lib/ -L/usr/lib/x86_64-linux-gnu -lcoap-2 -lqcbor -lcrypto -lssl -lutil -ltss2-esys -ltss2-sys -ltss2-mu -ltss2-tcti-mssim -g -o bin/verifier -Wl,--gc-sections
/usr/local/lib//libqcbor.so: undefined reference to `exp2'
/usr/local/lib//libqcbor.so: undefined reference to `lroundf'
/usr/local/lib//libqcbor.so: undefined reference to `feclearexcept'
/usr/local/lib//libqcbor.so: undefined reference to `round'
/usr/local/lib//libqcbor.so: undefined reference to `pow'
/usr/local/lib//libqcbor.so: undefined reference to `llround'
/usr/local/lib//libqcbor.so: undefined reference to `roundf'
/usr/local/lib//libqcbor.so: undefined reference to `fetestexcept'
collect2: error: ld returned 1 exit status
Makefile:57: recipe for target 'bin/attester' failed
make: *** [bin/attester] Error 1
make: *** Waiting for unfinished jobs....
/usr/local/lib//libqcbor.so: undefined reference to `exp2'
/usr/local/lib//libqcbor.so: undefined reference to `lroundf'
/usr/local/lib//libqcbor.so: undefined reference to `feclearexcept'
/usr/local/lib//libqcbor.so: undefined reference to `round'
/usr/local/lib//libqcbor.so: undefined reference to `pow'
/usr/local/lib//libqcbor.so: undefined reference to `llround'
/usr/local/lib//libqcbor.so: undefined reference to `roundf'
/usr/local/lib//libqcbor.so: undefined reference to `fetestexcept'
collect2: error: ld returned 1 exit status
Makefile:61: recipe for target 'bin/verifier' failed
make: *** [bin/verifier] Error 1

The problem could be solved when linking the math library -lm.

eckelmeckel commented 3 years ago

Hi @Asiderr,

thanks for opening this issue. I fixed it in #17 already.

Cheers, Michael