Several libraries define identical symbols which prevent static linking.
I need to statically link my programs so that they can be easily used on machines where Stratego/XT isn’t installed.

In order to generated statically linked programs, I ran ./configure –disable-shared and then make LDFLAGS=‘-all-static’ (which is a libtool flag that tells libtool to not use shared libs at all).

/bin/sh ../../libtool –tag=CC –mode=link gcc -Wall -Wno-unused-label -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter -DDEFAULT_XTC_REPOSITORY=““/usr/local/share/xrm/XTC”” -g -O2 -all-static –allow-multiple-definition -o pp-prism pp-prism.o -L/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib -L/nix/store/1m81p5qp9khb0bjscfmwgk8k0w6kq1h8-aterm-2.4.2/lib -lstratego-gpp -lstratego-sglr -lstratego-lib -lstratego-lib-native -lstratego-runtime -lm -lATerm
gcc -Wall -Wno-unused-label -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter -DDEFAULT_XTC_REPOSITORY=“/usr/local/share/xrm/XTC” -g -O2 -static –allow-multiple-definition -o pp-prism pp-prism.o -L/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib -L/nix/store/1m81p5qp9khb0bjscfmwgk8k0w6kq1h8-aterm-2.4.2/lib /nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-gpp.a -L/nix/store/99xjvlhngd4a4ljj7pdnk1fhi3x4z5qw-aterm-2.4.2/lib /nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-sglr.a /nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-xtc.a /nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libjustsglr.a /nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-lib.a /nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-lib-native.a /nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-runtime.a /nix/store/99xjvlhngd4a4ljj7pdnk1fhi3x4z5qw-aterm-2.4.2/lib/libATerm.a -lm /nix/store/1m81p5qp9khb0bjscfmwgk8k0w6kq1h8-aterm-2.4.2/lib/libATerm.a
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-xtc.a(libstratego_xtc_la-libstratego-xtc-posix-xsi.o): In function XTC_0_0': (.text+0x20): multiple definition ofXTC_0_0’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-gpp.a(libstratego_gpp_la-libstratego-gpp.o):(.text+0x20): first defined here
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-xtc.a(libstratego_xtc_la-libstratego-xtc-posix-xsi.o): In function Import_0_0': (.text+0x50): multiple definition ofImport_0_0’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-gpp.a(libstratego_gpp_la-libstratego-gpp.o):(.text+0x50): first defined here
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-xtc.a(libstratego_xtc_la-libstratego-xtc-posix-xsi.o): In function Repository_0_0': (.text+0x80): multiple definition ofRepository_0_0’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-gpp.a(libstratego_gpp_la-libstratego-gpp.o):(.text+0x80): first defined here
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-xtc.a(libstratego_xtc_la-libstratego-xtc-posix-xsi.o): In function TempDirs_0_0': (.text+0xb0): multiple definition ofTempDirs_0_0’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-gpp.a(libstratego_gpp_la-libstratego-gpp.o):(.text+0xb0): first defined here
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-xtc.a(libstratego_xtc_la-libstratego-xtc-posix-xsi.o): In function TempFiles_0_0': (.text+0xe0): multiple definition ofTempFiles_0_0’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-gpp.a(libstratego_gpp_la-libstratego-gpp.o):(.text+0xe0): first defined here
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-xtc.a(libstratego_xtc_la-libstratego-xtc-posix-xsi.o): In function TEMP_0_0': (.text+0x110): multiple definition ofTEMP_0_0’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-gpp.a(libstratego_gpp_la-libstratego-gpp.o):(.text+0x110): first defined here
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-xtc.a(libstratego_xtc_la-libstratego-xtc-posix-xsi.o): In function FILE_1_0': (.text+0x910): multiple definition ofFILE_1_0’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-gpp.a(libstratego_gpp_la-libstratego-gpp.o):(.text+0x4470): first defined here
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-xtc.a(libstratego_xtc_la-libstratego-xtc-posix-xsi.o): In function DIR_1_0': (.text+0x9a0): multiple definition ofDIR_1_0’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-gpp.a(libstratego_gpp_la-libstratego-gpp.o):(.text+0x4500): first defined here
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-xtc.a(libstratego_xtc_la-libstratego-xtc-posix-xsi.o): In function Tool_1_0': (.text+0xa30): multiple definition ofTool_1_0’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-gpp.a(libstratego_gpp_la-libstratego-gpp.o):(.text+0x4590): first defined here
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-xtc.a(libstratego_xtc_la-libstratego-xtc-posix-xsi.o): In function Imported_1_0': (.text+0xac0): multiple definition ofImported_1_0’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-gpp.a(libstratego_gpp_la-libstratego-gpp.o):(.text+0x4620): first defined here
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-lib.a(libstratego_lib_la-libstratego-lib-posix-xsi.o): In function DYNAMIC__CALLS_0_0': (.text+0x5f6d0): multiple definition ofDYNAMIC__CALLS_0_0’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-sglr.a(libstratego_sglr_la-libstratego-sglr.o):(.text+0x40): first defined here
/usr/bin/ld: Warning: size of symbol DYNAMIC__CALLS_0_0' changed from 7 in /nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-sglr.a(libstratego_sglr_la-libstratego-sglr.o) to 99 in /nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-lib.a(libstratego_lib_la-libstratego-lib-posix-xsi.o) /nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-lib-native.a(libstratego_lib_native_la-system-posix-file.o): In functionSSL_tmpnam’:
(.text+0x58e): warning: the use of tmpnam' is dangerous, better usemkstemp’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-lib-native.a(libstratego_lib_native_la-system-posix-file.o): In function SSL_mkdtemp': (.text+0x54d): warning: the use ofmktemp’ is dangerous, better use `mkstemp’
collect2: ld returned 1 exit status
make[2]: *** [pp-prism] Error 1

Submitted on 19 December 2006 at 18:09

On 20 December 2006 at 05:14 Jira commented:

STR-673, martin:
I have investigated this issue a bit and found the problem. It is related to STR-672 (multiple external definitions warnings in strc)

1) Library foo defines a signature.

Consequence: libfoo contains the signature and external definitions for (some?) for congruences over this signature.

2) Library bar imports libfoo

Consequence: libbar contains the signature (again) and no external definitions for the congruences

3) Library fred imports libbar

Consequence: libfred will implement the congruences and define the external definitions again.

So what’s wrong? I think that ‘external’ signatures (defined in libfoo) should not be exported again in the newly generated libbar, similar to the recent change that external definitions of imported libraries are not exported.

As a temporary workaround, libraries can import all the indirect dependencies, to make the congruences that were already defined visible. I will commit this for the stratego-libraries.


On 28 January 2013 at 14:46 Eelco Visser removed tag 0.18M2

On 28 January 2013 at 14:46 Eelco Visser tagged interesting

Log in to post comments