[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#29298: C++ compiler, Newlib and "implicit declaration of function '_
From: |
Jeffrey Walton |
Subject: |
bug#29298: 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#29298: C++ compiler, Newlib and "implicit declaration of function '_spawnv'",
Jeffrey Walton <=