All of lore.kernel.org
 help / color / mirror / Atom feed
* [tpm2] How to generate the statically linked executable
@ 2019-09-24  8:50 ZhengYu Tsai
  0 siblings, 0 replies; 6+ messages in thread
From: ZhengYu Tsai @ 2019-09-24  8:50 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 1211 bytes --]

Hi everyone,

May i ask does anyone know or fixed similar issue as below ?

Thanks for your reply

Context

   - Hardware:
   i686
   - Operating system :
   Ubuntu 16.04.6 LTS

Bug Report

   - Expected Behavior
   Builds the statically linked executables in tpm2-tools/tools

derek(a)ubuntu:~/workdir/tpm2-tools$ file tools/tpm2_*
tools/tpm2_activatecredential: ELF 32-bit LSB executable, Intel 80386,
version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32,
BuildID[sha1]=91a0834f96856f15537fb75b1d6f822e31b07995, not stripped

   - Actual Behavior
   Can't compile completely

/usr/bin/ld: attempted static link of dynamic object
`/usr/lib/i386-linux-gnu/libcurl-gnutls.so'
collect2: error: ld returned 1 exit status
Makefile:2170: recipe for target 'tools/tpm2_getekcertificate' failed
make: *** [tools/tpm2_getekcertificate] Error 1

   -

   Steps to Reproduce
   // install tpm2-tss
   ./configure "CFLAGS=--static" --enable-shared=no
   make
   sudo make install
   // Install tpm2-tools
   ./configure "CFLAGS=--static" --enable-shared=no --disable-hardening
   make
   -

   Possible Solution
   ./configure --parameter
   or
   modify Makefile

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 4584 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tpm2] How to generate the statically linked executable
@ 2019-09-27  1:16 ZhengYu Tsai
  0 siblings, 0 replies; 6+ messages in thread
From: ZhengYu Tsai @ 2019-09-27  1:16 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]

Hi ,
Has anyone done this static compilation?
Thanks for your reply, sorry to bother.

regards

ZhengYu Tsai <kalohomulder(a)gmail.com> 於 2019年9月24日 週二 下午4:50寫道:

> Hi everyone,
>
> May i ask does anyone know or fixed similar issue as below ?
>
> Thanks for your reply
>
> Context
>
>    - Hardware:
>    i686
>    - Operating system :
>    Ubuntu 16.04.6 LTS
>
> Bug Report
>
>    - Expected Behavior
>    Builds the statically linked executables in tpm2-tools/tools
>
> derek(a)ubuntu:~/workdir/tpm2-tools$ file tools/tpm2_*
> tools/tpm2_activatecredential: ELF 32-bit LSB executable, Intel 80386,
> version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32,
> BuildID[sha1]=91a0834f96856f15537fb75b1d6f822e31b07995, not stripped
>
>    - Actual Behavior
>    Can't compile completely
>
> /usr/bin/ld: attempted static link of dynamic object
> `/usr/lib/i386-linux-gnu/libcurl-gnutls.so'
> collect2: error: ld returned 1 exit status
> Makefile:2170: recipe for target 'tools/tpm2_getekcertificate' failed
> make: *** [tools/tpm2_getekcertificate] Error 1
>
>    -
>
>    Steps to Reproduce
>    // install tpm2-tss
>    ./configure "CFLAGS=--static" --enable-shared=no
>    make
>    sudo make install
>    // Install tpm2-tools
>    ./configure "CFLAGS=--static" --enable-shared=no --disable-hardening
>    make
>    -
>
>    Possible Solution
>    ./configure --parameter
>    or
>    modify Makefile
>
>

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 5089 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tpm2] How to generate the statically linked executable
@ 2019-09-27  1:10 ZhengYu Tsai
  0 siblings, 0 replies; 6+ messages in thread
From: ZhengYu Tsai @ 2019-09-27  1:10 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 5706 bytes --]

Hi Tadeusz :
when i build tpm2-tss used
*./configure --enable-shared=no --enable-nodl && make && sudo make install*

I get responding in build tpm2-tools as below :
*./configure "CFLAGS=--static -lidn -lrt" --enable-shared=no
--disable-hardening*
or
*./configure "CFLAGS=--static" --enable-shared=no --disable-hardening*

derek(a)ubuntu:~/workdir/tpm2-tools$ make
  CC       lib/lib_libcommon_a-files.o
  CC       lib/lib_libcommon_a-log.o
  CC       lib/lib_libcommon_a-object.o
  CC       lib/lib_libcommon_a-pcr.o
  CC       lib/lib_libcommon_a-tool_rc.o
  CC       lib/lib_libcommon_a-tpm2.o
  CC       lib/lib_libcommon_a-tpm2_alg_util.o
  CC       lib/lib_libcommon_a-tpm2_attr_util.o
  CC       lib/lib_libcommon_a-tpm2_auth_util.o
  CC       lib/lib_libcommon_a-tpm2_capability.o
  CC       lib/lib_libcommon_a-tpm2_cc_util.o
  CC       lib/lib_libcommon_a-tpm2_convert.o
  CC       lib/lib_libcommon_a-tpm2_ctx_mgmt.o
  CC       lib/lib_libcommon_a-tpm2_errata.o
  CC       lib/lib_libcommon_a-tpm2_hash.o
  CC       lib/lib_libcommon_a-tpm2_hierarchy.o
  CC       lib/lib_libcommon_a-tpm2_identity_util.o
  CC       lib/lib_libcommon_a-tpm2_kdfa.o
  CC       lib/lib_libcommon_a-tpm2_kdfe.o
  CC       lib/lib_libcommon_a-tpm2_openssl.o
  CC       lib/lib_libcommon_a-tpm2_options.o
  CC       lib/lib_libcommon_a-tpm2_policy.o
  CC       lib/lib_libcommon_a-tpm2_session.o
  CC       lib/lib_libcommon_a-tpm2_util.o
  AR       lib/libcommon.a
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       tools/misc/tpm2_checkquote.o
  CC       tools/tpm2_tool.o
  CCLD     tools/misc/tpm2_checkquote
/usr/local/lib/libtss2-tcti-mssim.a(tcti-mssim.o):(.data.rel.ro+0x0):
multiple definition of `tss2_tcti_info'
/usr/local/lib/libtss2-tcti-device.a(tcti-device.o):(.data.rel.ro+0x0):
first defined here
/usr/local/lib/libtss2-tcti-mssim.a(tcti-mssim.o): In function
`Tss2_Tcti_Info':
/home/derek/workdir/tpm2-tss/src/tss2-tcti/tcti-mssim.c:601: multiple
definition of `Tss2_Tcti_Info'
/usr/local/lib/libtss2-tcti-device.a(tcti-device.o):/home/derek/workdir/tpm2-tss/src/tss2-tcti/tcti-device.c:458:
first defined here
/usr/local/lib/libtss2-tcti-device.a(io.o): In function `socket_connect':
/home/derek/workdir/tpm2-tss/src/util/io.c:216: warning: Using
'getaddrinfo' in statically linked applications requires at runtime the
shared libraries from the glibc version used for linking
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_globallookup':
(.text+0xa): undefined reference to `dlopen'
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_globallookup':
(.text+0x20): undefined reference to `dlsym'
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_globallookup':
(.text+0x2a): undefined reference to `dlclose'
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_bind_func':
(.text+0x32d): undefined reference to `dlsym'
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_bind_func':
(.text+0x3ad): undefined reference to `dlerror'
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_bind_var':
(.text+0x42d): undefined reference to `dlsym'
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_bind_var':
(.text+0x4ad): undefined reference to `dlerror'
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_load':
(.text+0x518): undefined reference to `dlopen'
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_load':
(.text+0x575): undefined reference to `dlclose'
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_load':
(.text+0x5ae): undefined reference to `dlerror'
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_pathbyaddr':
(.text+0x641): undefined reference to `dladdr'
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_pathbyaddr':
(.text+0x6a1): undefined reference to `dlerror'
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/libcrypto.a(dso_dlfcn.o):
In function `dlfcn_unload':
(.text+0x70b): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
Makefile:2054: recipe for target 'tools/misc/tpm2_checkquote' failed
make: *** [tools/misc/tpm2_checkquote] Error 1


Tadeusz Struk <tadeusz.struk(a)intel.com> 於 2019年9月27日 週五 上午12:44寫道:

> On 9/25/19 6:40 PM, ZhengYu Tsai wrote:
> >
> /usr/local/lib/libtss2-esys.a(src_tss2_esys_libtss2_esys_la-tctildr-dl.o):
> In function `handle_from_name':
> > /home/derek/workdir/tpm2-tss/src/tss2-tcti/tctildr-dl.c:84: warning:
> Using 'dlopen' in statically linked applications requires at runtime the
> shared libraries from the glibc version used for linking
> > /usr/bin/ld: attempted static link of dynamic object
> `/usr/lib/i386-linux-gnu/libcurl-gnutls.so'
> > collect2: error: ld returned 1 exit status
> > Makefile:2170: recipe for target 'tools/tpm2_getekcertificate' failed
> > make: *** [tools/tpm2_getekcertificate] Error 1
> >
> > I also found the tpm2-tss configure *--enable-shared=no,*
> > This option is necessary, it will affect the compilation tpm2-tools.
>
> Right, you also need to use --enable_nodl configure option when you build
> tss.
>
> --
> Tadeusz
>

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 6926 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tpm2] How to generate the statically linked executable
@ 2019-09-26 16:44 Tadeusz Struk
  0 siblings, 0 replies; 6+ messages in thread
From: Tadeusz Struk @ 2019-09-26 16:44 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 859 bytes --]

On 9/25/19 6:40 PM, ZhengYu Tsai wrote:
> /usr/local/lib/libtss2-esys.a(src_tss2_esys_libtss2_esys_la-tctildr-dl.o): In function `handle_from_name':
> /home/derek/workdir/tpm2-tss/src/tss2-tcti/tctildr-dl.c:84: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
> /usr/bin/ld: attempted static link of dynamic object `/usr/lib/i386-linux-gnu/libcurl-gnutls.so'
> collect2: error: ld returned 1 exit status
> Makefile:2170: recipe for target 'tools/tpm2_getekcertificate' failed
> make: *** [tools/tpm2_getekcertificate] Error 1
> 
> I also found the tpm2-tss configure *--enable-shared=no,*
> This option is necessary, it will affect the compilation tpm2-tools.

Right, you also need to use --enable_nodl configure option when you build tss.

-- 
Tadeusz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tpm2] How to generate the statically linked executable
@ 2019-09-26  1:40 ZhengYu Tsai
  0 siblings, 0 replies; 6+ messages in thread
From: ZhengYu Tsai @ 2019-09-26  1:40 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 2414 bytes --]

Hi Tadeusz :
Thanks for your reply.

*./configure "LDFLAGS=--static" --disable-shared *
it will hang at :
checking whether the linker accepts -shared... yes
checking whether C compiler accepts -fPIE... yes
checking whether the linker accepts -pie... no
configure: error: Cannot enable -pie, consider configuring with
--disable-hardening

so I adjusted it :
* ./configure "LDFLAGS=--static" --disable-shared --disable-hardening ;
make*
The problem is the same as before :
/home/derek/workdir/tpm2-tss/src/tss2-tcti/tctildr-dl.c:84: warning: Using
'dlopen' in statically linked applications requires at runtime the shared
libraries from the glibc version used for linking
  CC       tools/tools_tpm2_getekcertificate-tpm2_getekcertificate.o
  CC       tools/tools_tpm2_getekcertificate-tpm2_tool.o
  CCLD     tools/tpm2_getekcertificate
/usr/local/lib/libtss2-esys.a(src_tss2_esys_libtss2_esys_la-tctildr-dl.o):
In function `handle_from_name':
/home/derek/workdir/tpm2-tss/src/tss2-tcti/tctildr-dl.c:84: warning: Using
'dlopen' in statically linked applications requires at runtime the shared
libraries from the glibc version used for linking
/usr/bin/ld: attempted static link of dynamic object
`/usr/lib/i386-linux-gnu/libcurl-gnutls.so'
collect2: error: ld returned 1 exit status
Makefile:2170: recipe for target 'tools/tpm2_getekcertificate' failed
make: *** [tools/tpm2_getekcertificate] Error 1

I also found the tpm2-tss configure *--enable-shared=no,*
This option is necessary, it will affect the compilation tpm2-tools.



Tadeusz Struk <tadeusz.struk(a)intel.com> 於 2019年9月26日 週四 上午4:55寫道:

> On 9/24/19 1:50 AM, ZhengYu Tsai wrote:
>
> > /usr/bin/ld: attempted static link of dynamic object
> `/usr/lib/i386-linux-gnu/libcurl-gnutls.so'
> > collect2: error: ld returned 1 exit status
> > Makefile:2170: recipe for target 'tools/tpm2_getekcertificate' failed
> > make: *** [tools/tpm2_getekcertificate] Error 1
> >
> >   *
> >
> >     Steps to Reproduce
> >     // install tpm2-tss
> >     ./configure "CFLAGS=--static" --enable-shared=no
> >     make
> >     sudo make install
> >     // Install tpm2-tools
> >     ./configure "CFLAGS=--static" --enable-shared=no --disable-hardening
>
> Don't you need to set LDFLAGS instead of CFLAGS:
>
> ./configure "LDFLAGS=--static" --disable-shared
>
> Thanks,
> --
> Tadeusz
>

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 3324 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tpm2] How to generate the statically linked executable
@ 2019-09-25 20:55 Tadeusz Struk
  0 siblings, 0 replies; 6+ messages in thread
From: Tadeusz Struk @ 2019-09-25 20:55 UTC (permalink / raw)
  To: tpm2

[-- Attachment #1: Type: text/plain, Size: 707 bytes --]

On 9/24/19 1:50 AM, ZhengYu Tsai wrote:

> /usr/bin/ld: attempted static link of dynamic object `/usr/lib/i386-linux-gnu/libcurl-gnutls.so'
> collect2: error: ld returned 1 exit status
> Makefile:2170: recipe for target 'tools/tpm2_getekcertificate' failed
> make: *** [tools/tpm2_getekcertificate] Error 1
> 
>   *
> 
>     Steps to Reproduce
>     // install tpm2-tss
>     ./configure "CFLAGS=--static" --enable-shared=no
>     make
>     sudo make install
>     // Install tpm2-tools
>     ./configure "CFLAGS=--static" --enable-shared=no --disable-hardening

Don't you need to set LDFLAGS instead of CFLAGS:

./configure "LDFLAGS=--static" --disable-shared

Thanks,
-- 
Tadeusz

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-27  1:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24  8:50 [tpm2] How to generate the statically linked executable ZhengYu Tsai
2019-09-25 20:55 Tadeusz Struk
2019-09-26  1:40 ZhengYu Tsai
2019-09-26 16:44 Tadeusz Struk
2019-09-27  1:10 ZhengYu Tsai
2019-09-27  1:16 ZhengYu Tsai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.