Menu

#680 Build failure with slibtool: multiple definition of 'set_ui_driver'

None
closed-accepted
nobody
None
5
2021-05-14
2021-05-08
orbea
No

When building pioneers with slibtool ( https://dev.midipix.org/cross/slibtool ) it fails:

rdlibtool --tag=CC --mode=link gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -pie -fPIE -Wl,--as-needed -g -O2 -Wl,-z,relro -Wl,-z,now -o pioneersai client/ai/pioneersai-ai.o client/ai/pioneersai-genetic.o client/ai/pioneersai-genetic_core.o client/ai/pioneersai-greedy.o client/ai/pioneersai-lobbybot.o libpioneersclient.a libpioneers.a ./common/libpioneers_a-driver.o -lglib-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lgobject-2.0 -lglib-2.0 -lm

rdlibtool: lconf: {.name="libtool"}.
rdlibtool: fdcwd: {.fdcwd=AT_FDCWD, .realpath="/tmp/pio-code-r2326-trunk/pioneers"}.
rdlibtool: lconf: fstatat(AT_FDCWD,".",...) = 0 {.st_dev = 45, .st_ino = 61}.
rdlibtool: lconf: openat(AT_FDCWD,"libtool",O_RDONLY,0) = 3.
rdlibtool: lconf: found "/tmp/pio-code-r2326-trunk/pioneers/libtool".
rdlibtool: link: gcc client/ai/pioneersai-ai.o client/ai/pioneersai-genetic.o client/ai/pioneersai-genetic_core.o client/ai/pioneersai-greedy.o client/ai/pioneersai-lobbybot.o libpioneersclient.a libpioneers.a ./common/libpioneers_a-driver.o -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -pie -fPIE -Wl,--as-needed -g -O2 -Wl,-z,relro -Wl,-z,now -lglib-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lm -o .libs/pioneersai
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ./common/libpioneers_a-driver.o: in function `set_ui_driver':
/tmp/pio-code-r2326-trunk/pioneers/common/driver.c:33: multiple definition of `set_ui_driver'; libpioneers.a(libpioneers_a-driver.o):/tmp/pio-code-r2326-trunk/pioneers/common/driver.c:33: first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ./common/libpioneers_a-driver.o:/tmp/pio-code-r2326-trunk/pioneers/common/driver.c:29: multiple definition of `driver'; libpioneers.a(libpioneers_a-driver.o):/tmp/pio-code-r2326-trunk/pioneers/common/driver.c:29: first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libcryptsetup.so.12: warning: EVP_EncryptFinal is often misused, please use EVP_EncryptFinal_ex and EVP_CIPHER_CTX_cleanup
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libcryptsetup.so.12: warning: EVP_DecryptFinal is often misused, please use EVP_DecryptFinal_ex and EVP_CIPHER_CTX_cleanup
collect2: error: ld returned 1 exit status
rdlibtool: exec error upon slbt_exec_link_create_executable(), line 1747: (see child process error messages).
rdlibtool: < returned to > slbt_exec_link(), line 2153.
make[2]: *** [Makefile:2321: pioneersai] Error 2
make[2]: Leaving directory '/tmp/pio-code-r2326-trunk/pioneers'
make[1]: *** [Makefile:4240: install-recursive] Error 1
make[1]: Leaving directory '/tmp/pio-code-r2326-trunk/pioneers'
make: *** [Makefile:4549: install] Error 2

This is because console_libs in Makefile.am contains both libpioneers.a and libpioneers_a-driver.o even though the former already contains the latter resulting in multiple definitions.

Looking at the log it can be seen that GNU libtool happens to work because libpioneers_a-driver.o precedes libpioneers.a while with slibtool it orders them as listed in the Makefile.am. If the order is reversed in the Makefile.am then slibtool will also compile.

However projects that use autotools should not manually link the .o object files instead of the .la libtool archives or in this case the .a static archive and a better fix is to remove the .o file from the Makefile.am since it is apparently not required. I am not sure what this was originally intended to fix, but the fix was clearly incorrect.

I attached a patch that fixes this.

Also see this downstream issue: https://bugs.gentoo.org/778248

1 Attachments

Discussion

  • orbea

    orbea - 2021-05-08

    Full log with slibtool.

     
  • orbea

    orbea - 2021-05-08

    Full log with GNU libtool.

     
  • Roland Clobus

    Roland Clobus - 2021-05-14
    • status: open --> closed-accepted
    • Group: -->
     
  • Roland Clobus

    Roland Clobus - 2021-05-14

    Thank for reporting this issue.

    I've locally built slibtool (it isn't present in Debian (yet?)) and have been able to confirm the linker error. As you can see from the comment that you've deleted, the object file was explicitly added to make the Fink port work, which was needed in 2005-12-21 (r934) and 2006-01-03 (r954). I don't have access to an Apple computer with Fink, so I'm currently unable to verify whether your proposed patch would not re-introduce the issue we had back then. While investigating, I also noted that the current Fink release is really old, so I'll apply your patch, because it was a hack back then.
    The patch has been applied in r2327, and will be part of the next release, which will be 15.7

    PS: Gentoo only has 15.5 (from 2018-03-14), the latest release was 15.6 in 2020-08-02

     
  • orbea

    orbea - 2021-05-14

    Thanks for updating the gentoo issue with the details and the quick review. The pioneers ebuild has now been updated to 15.6 in gentoo with the patch applied.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.