Package: libtool;
To reply to this bug, email your comments to 29298 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-libtool <at> gnu.org
:bug#29298
; Package libtool
.
(Tue, 14 Nov 2017 16:58:02 GMT) Full text and rfc822 format available.noloader <at> gmail.com
:bug-libtool <at> gnu.org
.
(Tue, 14 Nov 2017 16:58:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Jeffrey Walton <noloader <at> gmail.com> To: bug-libtool <at> gnu.org Subject: C++ compiler, Newlib and "implicit declaration of function '_spawnv'" Date: Tue, 14 Nov 2017 11:57:09 -0500
Hi Everyone, We are testing an Autotools front-end on MSYS2. The download is available from https://mingw-w64.org/. We are a C++ project so we AC_PROG_CXX and AC_LANG([C++]) in configure.ac. MSYS2 uses Newlib, and quite a few symbols are missing because Newlib adheres to Posix more strictly than glibc and libstdc++. The Autotools machinery produces files like lt-cryptest.c and lt-cryptestcwd.c. When libtool compiles its C source files with the C++ compiler on a system with Newlib, I believe it needs to set _XOPEN_SOURCE=600. Otherwise, errors like below are encountered. Also see http://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_02.html. In fact, the Newlib folks recommend setting _XOPEN_SOURCE for both the GNU and Newlib runtimes. Also see https://sourceware.org/ml/newlib/2017/msg01100.html. Jeff ********** /bin/sh ./libtool --tag=CXX --mode=link g++ -pthread -fdata-sections -ffunction-sections -pipe -DCRYPTOPP_DATA_DIR='"@pkgdatadir@/cryptopp/"' -g -O2 -pthread -Wl,--gc-sections -o cryptest.exe cryptest-test.o cryptest-bench1.o cryptest-bench2.o cryptest-validat0.o cryptest-validat1.o cryptest-validat2.o cryptest-validat3.o cryptest-datatest.o cryptest-regtest1.o cryptest-regtest2.o cryptest-regtest3.o cryptest-dlltest.o cryptest-fipsalgt.o cryptest-adhoc.o libcryptopp.la /bin/sh ./libtool --tag=CXX --mode=link g++ -pthread -fdata-sections -ffunction-sections -pipe -g -O2 -pthread -Wl,--gc-sections -o cryptestcwd.exe cryptestcwd-test.o cryptestcwd-bench1.o cryptestcwd-bench2.o cryptestcwd-validat0.o cryptestcwd-validat1.o cryptestcwd-validat2.o cryptestcwd-validat3.o cryptestcwd-datatest.o cryptestcwd-regtest1.o cryptestcwd-regtest2.o cryptestcwd-regtest3.o cryptestcwd-dlltest.o cryptestcwd-fipsalgt.o cryptestcwd-adhoc.o libcryptopp.la libtool: link: g++ -pthread -fdata-sections -ffunction-sections -pipe -g -O2 -pthread -Wl,--gc-sections -o .libs/cryptestcwd.exe cryptestcwd-test.o cryptestcwd-bench1.o cryptestcwd-bench2.o cryptestcwd-validat0.o cryptestcwd-validat1.o cryptestcwd-validat2.o cryptestcwd-validat3.o cryptestcwd-datatest.o cryptestcwd-regtest1.o cryptestcwd-regtest2.o cryptestcwd-regtest3.o cryptestcwd-dlltest.o cryptestcwd-fipsalgt.o cryptestcwd-adhoc.o ./.libs/libcryptopp.a -pthread libtool: link: g++ -pthread -fdata-sections -ffunction-sections -pipe -DCRYPTOPP_DATA_DIR=\"@pkgdatadir@/cryptopp/\" -g -O2 -pthread -Wl,--gc-sections -o .libs/cryptest.exe cryptest-test.o cryptest-bench1.o cryptest-bench2.o cryptest-validat0.o cryptest-validat1.o cryptest-validat2.o cryptest-validat3.o cryptest-datatest.o cryptest-regtest1.o cryptest-regtest2.o cryptest-regtest3.o cryptest-dlltest.o cryptest-fipsalgt.o cryptest-adhoc.o ./.libs/libcryptopp.a -pthread ./.libs/lt-cryptestcwd.c: In function 'main': ./.libs/lt-cryptest.c: In function 'main': ./.libs/lt-cryptestcwd.c:319:16: warning: implicit declaration of function '_spawnv' [-Wimplicit-function-declaration] rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); ^~~~~~~ ./.libs/lt-cryptest.c:319:16: warning: implicit declaration of function '_spawn ' [-Wimplicit-function-declaration] rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); ^~~~~~~ /tmp/ccFfsaBb.o: In function `main': /home/cryptopp/./.libs/lt-cryptest.c:319: undefined reference to `_spawnv' /home/cryptopp/./.libs/lt-cryptest.c:319:(.text.startup+0x4b4): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_spawnv' collect2: error: ld returned 1 exit status /tmp/ccfJfnlw.o: In function `main': /home/cryptopp/./.libs/lt-cryptestcwd.c:319: undefined reference to `_spawnv' /home/cryptopp/./.libs/lt-cryptestcwd.c:319:(.text.startup+0x4b4): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_spawnv' strip: './cryptest.exe': No such file collect2: error: ld returned 1 exit status strip: './cryptestcwd.exe': No such file ./libtool: line 11083: ./cryptest.exe: No such file or directory ./libtool: line 11083: ./cryptestcwd.exe: No such file or directory make[1]: Leaving directory '/home/cryptopp' ...
bug-libtool <at> gnu.org
:bug#29298
; Package libtool
.
(Tue, 14 Nov 2017 17:09:01 GMT) Full text and rfc822 format available.Message #8 received at 29298 <at> debbugs.gnu.org (full text, mbox):
From: Jeffrey Walton <noloader <at> gmail.com> To: 29298 <at> debbugs.gnu.org Subject: Re: bug#29298: C++ compiler, Newlib and "implicit declaration of function '_spawnv'" Date: Tue, 14 Nov 2017 12:08:44 -0500
On Tue, Nov 14, 2017 at 11:57 AM, Jeffrey Walton <noloader <at> gmail.com> wrote: > Hi Everyone, > > We are testing an Autotools front-end on MSYS2. The download is > available from https://mingw-w64.org/. > > ... > /bin/sh ./libtool --tag=CXX --mode=link g++ -pthread > -fdata-sections -ffunction-sections -pipe > -DCRYPTOPP_DATA_DIR='"@pkgdatadir@/cryptopp/"' -g -O2 -pthread > -Wl,--gc-sections -o cryptest.exe cryptest-test.o cryptest-bench1.o > cryptest-bench2.o cryptest-validat0.o cryptest-validat1.o > cryptest-validat2.o cryptest-validat3.o cryptest-datatest.o > cryptest-regtest1.o cryptest-regtest2.o cryptest-regtest3.o > cryptest-dlltest.o cryptest-fipsalgt.o cryptest-adhoc.o libcryptopp.la > /bin/sh ./libtool --tag=CXX --mode=link g++ -pthread > -fdata-sections -ffunction-sections -pipe -g -O2 -pthread > -Wl,--gc-sections -o cryptestcwd.exe cryptestcwd-test.o > cryptestcwd-bench1.o cryptestcwd-bench2.o cryptestcwd-validat0.o > cryptestcwd-validat1.o cryptestcwd-validat2.o cryptestcwd-validat3.o > cryptestcwd-datatest.o cryptestcwd-regtest1.o cryptestcwd-regtest2.o > cryptestcwd-regtest3.o cryptestcwd-dlltest.o cryptestcwd-fipsalgt.o > cryptestcwd-adhoc.o libcryptopp.la > libtool: link: g++ -pthread -fdata-sections -ffunction-sections -pipe > -g -O2 -pthread -Wl,--gc-sections -o .libs/cryptestcwd.exe > cryptestcwd-test.o cryptestcwd-bench1.o cryptestcwd-bench2.o > cryptestcwd-validat0.o cryptestcwd-validat1.o cryptestcwd-validat2.o > cryptestcwd-validat3.o cryptestcwd-datatest.o cryptestcwd-regtest1.o > cryptestcwd-regtest2.o cryptestcwd-regtest3.o cryptestcwd-dlltest.o > cryptestcwd-fipsalgt.o cryptestcwd-adhoc.o ./.libs/libcryptopp.a > -pthread > libtool: link: g++ -pthread -fdata-sections -ffunction-sections -pipe > -DCRYPTOPP_DATA_DIR=\"@pkgdatadir@/cryptopp/\" -g -O2 -pthread > -Wl,--gc-sections -o .libs/cryptest.exe cryptest-test.o > cryptest-bench1.o cryptest-bench2.o cryptest-validat0.o > cryptest-validat1.o cryptest-validat2.o cryptest-validat3.o > cryptest-datatest.o cryptest-regtest1.o cryptest-regtest2.o > cryptest-regtest3.o cryptest-dlltest.o cryptest-fipsalgt.o > cryptest-adhoc.o ./.libs/libcryptopp.a -pthread > ./.libs/lt-cryptestcwd.c: In function 'main': > ./.libs/lt-cryptest.c: In function 'main': > ./.libs/lt-cryptestcwd.c:319:16: warning: implicit declaration of > function '_spawnv' [-Wimplicit-function-declaration] > rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); > ^~~~~~~ > ./.libs/lt-cryptest.c:319:16: warning: implicit declaration of > function '_spawn ' [-Wimplicit-function-declaration] > rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); > ^~~~~~~ > /tmp/ccFfsaBb.o: In function `main': > /home/cryptopp/./.libs/lt-cryptest.c:319: undefined reference to `_spawnv' > /home/cryptopp/./.libs/lt-cryptest.c:319:(.text.startup+0x4b4): > relocation truncated to fit: R_X86_64_PC32 against undefined symbol > `_spawnv' > collect2: error: ld returned 1 exit status > /tmp/ccfJfnlw.o: In function `main': > /home/cryptopp/./.libs/lt-cryptestcwd.c:319: undefined reference to `_spawnv' > /home/cryptopp/./.libs/lt-cryptestcwd.c:319:(.text.startup+0x4b4): > relocation truncated to fit: R_X86_64_PC32 against undefined symbol > `_spawnv' > strip: './cryptest.exe': No such file > collect2: error: ld returned 1 exit status > strip: './cryptestcwd.exe': No such file > ./libtool: line 11083: ./cryptest.exe: No such file or directory > ./libtool: line 11083: ./cryptestcwd.exe: No such file or directory > make[1]: Leaving directory '/home/cryptopp' Looking at the flags selected by libtool, I think there's another bug present (correct me if I am wrong)... When C and C++ are mixed/matched like above, the C source files also need to be compiled with (1) -frtti to ensure type information is available; and (2) -fexceptions to ensure exceptions pass correctly through functions in C object files. It may be better for libtools to provide both lt-cryptest.cpp and lt-cryptestcwd.cpp in C++ projects so the mixing and matching does not occur. That is, the libtool provided files will get the correct CXXFLAGS by default. It may be worth mentioning: we don't use/set CFLAGS; libtool needs to get the project flags through CXXFLAGS in this case. Jeff
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.