STR-673: multiple definitions of symbols throughout the stratego-libraries
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
Submitted on 19 December 2006 at 18:09
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 functionXTC_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 functionImport_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 functionRepository_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 functionTempDirs_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 functionTempFiles_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 functionTEMP_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 functionFILE_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 functionDIR_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 functionTool_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 functionImported_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 functionDYNAMIC__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 symbolDYNAMIC__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 oftmpnam' is dangerous, better usemkstemp’
/nix/store/09058krddyr8vwqk97yqz47jd111x1xl-strategoxt/lib/libstratego-lib-native.a(libstratego_lib_native_la-system-posix-file.o): In functionSSL_mkdtemp': (.text+0x54d): warning: the use ofmktemp’ is dangerous, better use `mkstemp’
collect2: ld returned 1 exit status
make[2]: *** [pp-prism] Error 1
Issue Log
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.
Log in to post comments