tpm2-software / tpm2-abrmd

TPM2 Access Broker & Resource Management Daemon implementing the TCG spec.
https://github.com/tpm2-software/tpm2-abrmd
BSD 2-Clause "Simplified" License
115 stars 97 forks source link

Building tabrmd against sapi in custom location doesn't work #141

Closed williamcroberts closed 7 years ago

williamcroberts commented 7 years ago

Configuring with:

./configure --prefix=`realpath ~/tmp` PKG_CONFIG_PATH=`realpath ~/tmp/lib/pkgconfig`

Results in:

/home/wcrobert/workspace/tpm2-abrmd/src/tcti-device.c:155: undefined reference to `InitDeviceTcti'
/home/wcrobert/workspace/tpm2-abrmd/src/tcti-device.c:166: undefined reference to `InitDeviceTcti'
src/.libs/libutil.a(tcti-socket.o): In function `tcti_socket_initialize':
/home/wcrobert/workspace/tpm2-abrmd/src/tcti-socket.c:177: undefined reference to `InitSocketTcti'
/home/wcrobert/workspace/tpm2-abrmd/src/tcti-socket.c:188: undefined reference to `InitSocketTcti'
test/integration/.libs/libtest.a(context-util.o): In function `tcti_device_init':
/home/wcrobert/workspace/tpm2-abrmd/test/integration/context-util.c:55: undefined reference to `InitDeviceTcti'
/home/wcrobert/workspace/tpm2-abrmd/test/integration/context-util.c:69: undefined reference to `InitDeviceTcti'
test/integration/.libs/libtest.a(context-util.o): In function `tcti_socket_init':
/home/wcrobert/workspace/tpm2-abrmd/test/integration/context-util.c:103: undefined reference to `InitSocketTcti'
/home/wcrobert/workspace/tpm2-abrmd/test/integration/context-util.c:115: undefined reference to `InitSocketTcti'
/home/wcrobert/tmp/lib/libsapi.a(Tss2_Sys_ContextLoad.o): In function `Tss2_Sys_ContextLoad_Prepare':
/home/wcrobert/workspace/tpm2-tss/sysapi/sysapi/Tss2_Sys_ContextLoad.c:50: undefined reference to `TPMS_CONTEXT_Marshal'
/home/wcrobert/tmp/lib/libsapi.a(Tss2_Sys_ContextLoad.o): In function `Tss2_Sys_ContextLoad_Complete':
/home/wcrobert/workspace/tpm2-tss/sysapi/sysapi/Tss2_Sys_ContextLoad.c:71: undefined reference to `UINT32_Unmarshal'
<snip>

If you add --disable-shared to the configure options, it's just the initSocketTcti and the InitDeviceTcti routines.

flihp commented 7 years ago

Weird. Looking into it.

flihp commented 7 years ago

oh, I think you need to add realpath ~/tmp/lib to LD_LIBRARY_PATH. See https://github.com/01org/tpm2-abrmd/blob/master/.travis.yml#L39

williamcroberts commented 7 years ago

LD_LIBRARY_PATH would be for runtime linking issues, this is at build time.

flihp commented 7 years ago

Right, my mistake. Then you need a -L in your LDLIBS like https://github.com/01org/tpm2-abrmd/blob/master/.travis.yml#L42 maybe?

flihp commented 7 years ago

this has gone a bit stale. I've been battling libtool etc here: https://github.com/flihp/tpm2-abrmd/tree/master-tracks-master if you've got ideas. I'm close: clang works fine, gcc has a linking problem (can't find symbols for a function in the new marshaling library).

liuqun commented 7 years ago

clang works fine, gcc has a linking problem (can't find symbols for a function in the new marshaling library)

Which gcc version is buggy to build with? Can we downgrade gcc to a safe version?