MinGW g++ can't find _G_config.h in same include folder as file including it - g++

I'm trying to do a cross-compile with MinGW g++ and it seems to have selective issues finding files in a system include folder.
It finds stdio.h fine, and finds libio.h fine, but it fails to find _G_config.h even though all three files are in the same folder, with the same permissions, being included in the same way.
Here's the verbose output (unwrapped to make legible; username scrubbed):
-\Documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\arm-linux-gnueabihf-g++.exe -v -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"MainSPI.d" -MT"MainSPI.o" -o "MainSPI.o" "../MainSPI.cpp"
Using built-in specs.
COLLECT_GCC=C:\Users\user-------------\Documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\arm-linux-gnueabihf-g++.exe
Target: arm-linux-gnueabihf
Configured with: /home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/snapshots/gcc-linaro-5.3-2016.02/configure
SHELL=/bin/bash --with-bugurl=https://bugs.linaro.org --with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/builds/destdir/i686-w64-mingw32 --with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/builds/destdir/i686-w64-mingw32 --with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/builds/destdir/i686-w64-mingw32 --with-gnu-as --with-gnu-ld --disable-libstdcxx-pch --disable-libmudflap --with-cloog=no --with-ppl=no --with-isl=no --disable-nls --enable-c99 --with-tune=cortex-a9 --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-multilib --enable-multiarch --with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/sysroots/arm-linux-gnueabihf --enable-lto --enable-linker-build-id --enable-long-long --enable-shared --with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/builds/destdir/i686-w64-mingw32/arm-linux-gnueabihf/libc --enable-languages=c,c++,fortran,lto --enable-checking=release --disable-bootstrap --with-bugurl=https://bugs.linaro.org --build=x86_64-unknown-linux-gnu --host=i686-w64-mingw32 --target=arm-linux-gnueabihf --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/builds/destdir/i686-w64-mingw32
Thread model: posix
gcc version 5.3.1 20160113 (Linaro GCC 5.3-2016.02)
COLLECT_GCC_OPTIONS='-v' '-O0' '-g3' '-Wall' '-c' '-fmessage-length=0' '-MMD' '-MP' '-MF' 'MainSPI.d' '-MT' 'MainSPI.o' '-o' 'MainSPI.o' '-shared-libgcc' '-march=armv7-a' '-mtune=cortex-a9' '-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-mthumb' '-mtls-dialect=gnu'
c:/users/user-------------/documents/case-sensitive/gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf/bin/../libexec/gcc/arm-linux-gnueabihf/5.3.1/cc1plus.exe -quiet -v -imultilib . -imultiarch arm-linux-gnueabihf -iprefix c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\../lib/gcc/arm-linux-gnueabihf/5.3.1/ -isysroot c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\../arm-linux-gnueabihf/libc -MMD MainSPI.d -MF MainSPI.d -MP -MT MainSPI.o -dD -D_GNU_SOURCE ../MainSPI.cpp -quiet -dumpbase MainSPI.cpp -march=armv7-a -mtune=cortex-a9 -mfloat-abi=hard -mfpu=vfpv3-d16 -mthumb -mtls-dialect=gnu -auxbase-strip MainSPI.o -g3 -O0 -Wall -version -fmessage-length=0 -o
C:\Users\user\AppData\Local\Temp\cce7dljB.s
GNU C++ (Linaro GCC 5.3-2016.02) version 5.3.1 20160113 (arm-linux-gnueabihf)
compiled by GNU C version 4.9.1, GMP version 6.0.0, MPFR version 3.1.3,
MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "c:/users/user-------------/documents/case-sensitive/gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf/lib/gcc/../../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../../arm-linux-gnueabihf/include/c++/5.3.1"
ignoring duplicate directory "c:/users/user-------------/documents/case-sensitive/gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf/lib/gcc/../../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../../arm-linux-gnueabihf/include/c++/5.3.1/arm-linux-gnueabihf/."
ignoring duplicate directory "c:/users/user-------------/documents/case-sensitive/gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf/lib/gcc/../../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../../arm-linux-gnueabihf/include/c++/5.3.1/backward"
ignoring duplicate directory "c:/users/user-------------/documents/case-sensitive/gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf/lib/gcc/../../lib/gcc/arm-linux-gnueabihf/5.3.1/include"
ignoring nonexistent directory "c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\../arm-linux-gnueabihf/libc/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/builds/destdir/i686-w64-mingw32/lib/gcc/arm-linux-gnueabihf/5.3.1/../../../../include/arm-linux-gnueabihf"
ignoring nonexistent directory "c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\../arm-linux-gnueabihf/libc/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/builds/destdir/i686-w64-mingw32/lib/gcc/arm-linux-gnueabihf/5.3.1/../../../../include"
ignoring duplicate directory "c:/users/user-------------/documents/case-sensitive/gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf/lib/gcc/../../lib/gcc/arm-linux-gnueabihf/5.3.1/include-fixed"
ignoring duplicate directory "c:/users/user-------------/documents/case-sensitive/gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf/lib/gcc/../../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../../arm-linux-gnueabihf/include"
#include "..." search starts here:
#include <...> search starts here:
c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../../arm-linux-gnueabihf/include/c++/5.3.1
c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../../arm-linux-gnueabihf/include/c++/5.3.1/arm-linux-gnueabihf/.
c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../../arm-linux-gnueabihf/include/c++/5.3.1/backward
c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\../lib/gcc/arm-linux-gnueabihf/5.3.1/include
c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\../lib/gcc/arm-linux-gnueabihf/5.3.1/include-fixed
c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../../arm-linux-gnueabihf/include
c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\../arm-linux-gnueabihf/libc/usr/include/arm-linux-gnueabihf
c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin\../arm-linux-gnueabihf/libc/usr/include
End of search list.
GNU C++ (Linaro GCC 5.3-2016.02) version 5.3.1 20160113 (arm-linux-gnueabihf)
compiled by GNU C version 4.9.1, GMP version 6.0.0, MPFR version 3.1.3,
MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: d41011bf5dc0e7b64084b0a5dc2942fd
In file included from c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\arm-linux-gnueabihf\libc\usr\include\stdio.h:75:0,
from ../MainSPI.cpp:4:
c:\users\user-------------\documents\case-sensitive\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\arm-linux-gnueabihf\libc\usr\include\libio.h:32:23:
fatal error: _G_config.h: No such file or directory
compilation terminated.
And here's my double checking that yes the files are in the 8th/last search directory:
...abihf/arm-linux-gnueabihf/libc/usr/include$ ls -l _G_config.h stdio.h libio.h
-rwxrwxrwx 1 root root 2526 Jun 19 2017 _G_config.h
-rwxrwxrwx 1 root root 17790 Jun 19 2017 libio.h
-rwxrwxrwx 1 root root 31525 Jun 19 2017 stdio.h
...abihf/arm-linux-gnueabihf/libc/usr/include$ sed -n '32p' libio.h
#include <_G_config.h>
...abihf/arm-linux-gnueabihf/libc/usr/include$ sed -n '75p' stdio.h
#include <libio.h>
I don't think it's relevant but this is on Windows 10 with WSL enabled and I enabled the case sensitive filesystem for the folder case-sensitive.
As for my actual question: Why can't g++ find _G_config.h and how can I fix it so it can?

I am not sure whether this is THE answer. But, I faced a similar situation with Linaro GCC 5.5.0-2017.10 and it turned out to be an issue with the path length on Windows.
This could be the case for you too, as the file that is not being found has a longer name than the two that are found (as it was in my case).
The test is simple, remove some levels from your directory structure (for the purpose of this test) [e.g. by just moving the base folder or your project, or renaming parts of it with a shorter name], and see if the build starts working.

Related

Why Autotools Ignores Installed Static Library?

I have installed ROHC library (http://rohc-lib.org) using following commands during installation:
autoreconf -if
./configure --enable-static=yes --enable-shared=no --disable-shared --prefix=/usr
make
make install
It successfully installed static (and only static) libraries in /usr/lib directory. It contains librohc.a and librohc.la and no shared-library (i.e. librohc.so*).
I am trying to link this library with OpenVPN. I added following lines in configure.ac of OpenVPN:
AC_CHECK_HEADERS(
[rohc/rohc.h rohc/rohc_comp.h rohc/rohc_decomp.h],
,
[AC_MSG_ERROR([ROHC headers not found])]
)
AC_CHECK_LIB(
[rohc],
[rohc_compress4],
,
[AC_MSG_ERROR([ROHC library not found])]
)
But when I run make in OpenVPN source directory, I get the following error:
/bin/sh ../../libtool --tag=CC --mode=link gcc -DPLUGIN_LIBDIR=\"/usr/local/lib/openvpn/plugins\" -Wall -Wno-unused-parameter -Wno-unused-function -g -O2 -std=c99 -lrt -o openvpn argv.o base64.o buffer.o clinat.o comp.o compstub.o comp-lz4.o crypto.o crypto_openssl.o crypto_mbedtls.o dhcp.o error.o event.o fdmisc.o forward.o fragment.o gremlin.o helper.o httpdigest.o lladdr.o init.o interval.o list.o lzo.o manage.o mbuf.o misc.o platform.o console.o console_builtin.o console_systemd.o mroute.o mss.o mstats.o mtcp.o mtu.o mudp.o multi.o ntlm.o occ.o pkcs11.o pkcs11_openssl.o pkcs11_mbedtls.o openvpn.o options.o otime.o packet_id.o perf.o pf.o ping.o plugin.o pool.o proto.o proxy.o ps.o push.o reliable.o route.o schedule.o session_id.o shaper.o sig.o socket.o socks.o ssl.o ssl_openssl.o ssl_mbedtls.o ssl_verify.o ssl_verify_openssl.o ssl_verify_mbedtls.o status.o tls_crypt.o tun.o win32.o rohc.o trunk.o cryptoapi.o ../../src/compat/libcompat.la -lnsl -lresolv -llzo2 -llz4 -lssl -lcrypto -ldl -lrohc
libtool: link: gcc -DPLUGIN_LIBDIR=\"/usr/local/lib/openvpn/plugins\" -Wall -Wno-unused-parameter -Wno-unused-function -g -O2 -std=c99 -o openvpn argv.o base64.o buffer.o clinat.o comp.o compstub.o comp-lz4.o crypto.o crypto_openssl.o crypto_mbedtls.o dhcp.o error.o event.o fdmisc.o forward.o fragment.o gremlin.o helper.o httpdigest.o lladdr.o init.o interval.o list.o lzo.o manage.o mbuf.o misc.o platform.o console.o console_builtin.o console_systemd.o mroute.o mss.o mstats.o mtcp.o mtu.o mudp.o multi.o ntlm.o occ.o pkcs11.o pkcs11_openssl.o pkcs11_mbedtls.o openvpn.o options.o otime.o packet_id.o perf.o pf.o ping.o plugin.o pool.o proto.o proxy.o ps.o push.o reliable.o route.o schedule.o session_id.o shaper.o sig.o socket.o socks.o ssl.o ssl_openssl.o ssl_mbedtls.o ssl_verify.o ssl_verify_openssl.o ssl_verify_mbedtls.o status.o tls_crypt.o tun.o win32.o rohc.o trunk.o cryptoapi.o ../../src/compat/.libs/libcompat.a -lrt -lnsl -lresolv -llzo2 -llz4 -lssl -lcrypto -ldl /usr/lib/librohc.so
gcc: /usr/lib/librohc.so: No such file or directory
Yes, /usr/lib/librohc.so does not exist, but /usr/lib/librohc.a exists. Why is it not linking with the static library /usr/lib/librohc.a at absence of .so ?
You may ask me why I am not installing shared libs of ROHC; answer is that I want to force static linking with ROHC, and when it is done I will uninstall ROHC libs.
If someone could show me how to do this static linking without installing ROHC first (like adding dependency to configure.ac or Makefile.am of OpenVPN), it would be better for me.
Note that, both OpenVPN and ROHC library require autotools.
I specified --libdir=/usr/lib64 with ./configure of ROHC library and finally the build system used the static library librohc.a when linking with OpenVPN. I installed ROHC with:
autoreconf -if
./configure --enable-static --disable-shared --prefix=/usr --libdir=/usr/lib64
make
make install
Now it installs the library as /usr/lib64/librohc.a and Compilation of OpenVPN successfully finds and links to it.
And surely, it took place in a 64 bit machine (CentOS 6). In a 32 bit environment (OpenWrt in a 32-bit MIPS router) where there is nothing like /usr/lib64, the problem in the question does not take place.

CMake and MinGW - "The C Compiler is not able to compile a simple test program"

I am using CMake and MinGW-w64 64-bit to build. I have used this exact same setup with the same compiler on my other PC and it has worked. Not sure what's wrong.
I have the MinGW-w64 bin in my PATH. When I run cmake and do not specify the compiler path, it generates MinGW Makefiles successfully. However, when I specify the compiler (which I know does work, I got it from winlibs.com) it produces the following log. I am running Windows 10.
Detecting C compiler ABI info failed to compile with the following output:
Change Dir: C:/Libraries/Projects/CMakeTest/build/MinGW-10.1.0-64-bit/debug/CMakeFiles/CMakeTmp
Run Build Command(s):C:/MinGW/MinGW-10.1.0-64-bit/bin/mingw32-make.exe cmTC_a01cd/fast && C:/MinGW/MinGW-10.1.0-64-bit/bin/mingw32-make.exe -f CMakeFiles\cmTC_a01cd.dir\build.make CMakeFiles/cmTC_a01cd.dir/build
mingw32-make[1]: Entering directory 'C:/Libraries/Projects/CMakeTest/build/MinGW-10.1.0-64-bit/debug/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_a01cd.dir/CMakeCCompilerABI.c.obj
C:\MinGW\MinGW-10.1.0-64-bit\bin\x86_64-w64-mingw32-gcc.exe -v -o CMakeFiles\cmTC_a01cd.dir\CMakeCCompilerABI.c.obj -c "C:\Program Files\CMake\share\cmake-3.18\Modules\CMakeCCompilerABI.c"
Using built-in specs.
COLLECT_GCC=C:\MinGW\MinGW-10.1.0-64-bit\bin\x86_64-w64-mingw32-gcc.exe
Target: x86_64-w64-mingw32
Configured with: ../configure --prefix=/R/winlibs64_10.1.0/inst_gcc-10.1.0/share/gcc --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --with-pkgversion='MinGW-W64 x86_64-posix-seh, built by Brecht Sanders' --with-tune=generic --enable-checking=release --enable-threads=posix --disable-sjlj-exceptions --disable-libunwind-exceptions --enable-serial-configure --disable-bootstrap --enable-host-shared --enable-plugin --enable-default-ssp --disable-rpath --disable-libstdcxx-pch --enable-libstdcxx-time=yes --disable-libstdcxx-debug --disable-version-specific-runtime-libs --with-stabs --disable-symvers --enable-languages=c,c++,fortran,lto,objc,obj-c++,d --disable-gold --disable-nls --disable-stage1-checking --disable-win32-registry --disable-multilib --enable-ld --enable-libquadmath --enable-libada --enable-libssp --enable-libstdcxx --enable-lto --enable-fully-dynamic-string --enable-libgomp --enable-graphite --enable-mingw-wildcard --with-mpc=/d/winlibs64_10.1.0/custombuilt --with-mpfr=/d/winlibs64_10.1.0/custombuilt --with-gmp=/d/winlibs64_10.1.0/custombuilt --with-isl=/d/winlibs64_10.1.0/custombuilt --enable-install-libiberty --enable-__cxa_atexit --without-included-gettext --with-diagnostics-color=auto --with-libiconv --with-system-zlib --with-build-sysroot=/R/winlibs64_10.1.0/gcc-10.1.0/build_mingw/mingw-w64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.1.0 (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders)
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_a01cd.dir\CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=x86-64'
c:/mingw/mingw-10.1.0-64-bit/bin/../libexec/gcc/x86_64-w64-mingw32/10.1.0/cc1.exe -quiet -v -iprefix c:\mingw\mingw-10.1.0-64-bit\bin\../lib/gcc/x86_64-w64-mingw32/10.1.0/ -D_REENTRANT C:\Program Files\CMake\share\cmake-3.18\Modules\CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles\cmTC_a01cd.dir\CMakeCCompilerABI.c.obj -version -o C:\Users\gvcal\AppData\Local\Temp\ccHRxkpy.s
GNU C17 (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) version 10.1.0 (x86_64-w64-mingw32)
compiled by GNU C version 10.1.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "c:/mingw/mingw-10.1.0-64-bit/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/10.1.0/include"
ignoring nonexistent directory "R:/winlibs64_10.1.0/inst_gcc-10.1.0/share/gcc/include"
ignoring nonexistent directory "/R/winlibs64_10.1.0/inst_gcc-10.1.0/share/gcc/include"
ignoring duplicate directory "c:/mingw/mingw-10.1.0-64-bit/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/10.1.0/include-fixed"
ignoring duplicate directory "c:/mingw/mingw-10.1.0-64-bit/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
c:\mingw\mingw-10.1.0-64-bit\bin\../lib/gcc/x86_64-w64-mingw32/10.1.0/include
c:\mingw\mingw-10.1.0-64-bit\bin\../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../include
c:\mingw\mingw-10.1.0-64-bit\bin\../lib/gcc/x86_64-w64-mingw32/10.1.0/include-fixed
c:\mingw\mingw-10.1.0-64-bit\bin\../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/include
End of search list.
GNU C17 (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) version 10.1.0 (x86_64-w64-mingw32)
compiled by GNU C version 10.1.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 21a8d9a0add79f637093bff9641d5f35
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_a01cd.dir\CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=x86-64'
c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/as.exe -v -o CMakeFiles\cmTC_a01cd.dir\CMakeCCompilerABI.c.obj C:\Users\gvcal\AppData\Local\Temp\ccHRxkpy.s
GNU assembler version 2.34 (x86_64-w64-mingw32) using BFD version (Binutils for MinGW-W64 x86_64, built by Brecht Sanders) 2.34
COMPILER_PATH=c:/mingw/mingw-10.1.0-64-bit/bin/../libexec/gcc/x86_64-w64-mingw32/10.1.0/;c:/mingw/mingw-10.1.0-64-bit/bin/../libexec/gcc/;c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/
LIBRARY_PATH=c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/;c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/;c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/lib/../lib/;c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../lib/;c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/lib/;c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_a01cd.dir\CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=x86-64'
Linking C executable cmTC_a01cd.exe
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_a01cd.dir\link.txt --verbose=1
"C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_a01cd.dir/objects.a
CMAKE_AR-NOTFOUND cr CMakeFiles\cmTC_a01cd.dir/objects.a #CMakeFiles\cmTC_a01cd.dir\objects1.rsp
Error running link command: The system cannot find the file specified
mingw32-make[1]: *** [CMakeFiles\cmTC_a01cd.dir\build.make:107: cmTC_a01cd.exe] Error 2
mingw32-make[1]: Leaving directory 'C:/Libraries/Projects/CMakeTest/build/MinGW-10.1.0-64-bit/debug/CMakeFiles/CMakeTmp'
mingw32-make: *** [makefile:140: cmTC_a01cd/fast] Error 2
Determining if the C compiler works failed with the following output:
Change Dir: C:/Libraries/Projects/CMakeTest/build/MinGW-10.1.0-64-bit/debug/CMakeFiles/CMakeTmp
Run Build Command(s):C:/MinGW/MinGW-10.1.0-64-bit/bin/mingw32-make.exe cmTC_f77ee/fast && C:/MinGW/MinGW-10.1.0-64-bit/bin/mingw32-make.exe -f CMakeFiles\cmTC_f77ee.dir\build.make CMakeFiles/cmTC_f77ee.dir/build
mingw32-make[1]: Entering directory 'C:/Libraries/Projects/CMakeTest/build/MinGW-10.1.0-64-bit/debug/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_f77ee.dir/testCCompiler.c.obj
C:\MinGW\MinGW-10.1.0-64-bit\bin\x86_64-w64-mingw32-gcc.exe -o CMakeFiles\cmTC_f77ee.dir\testCCompiler.c.obj -c C:\Libraries\Projects\CMakeTest\build\MinGW-10.1.0-64-bit\debug\CMakeFiles\CMakeTmp\testCCompiler.c
Linking C executable cmTC_f77ee.exe
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_f77ee.dir\link.txt --verbose=1
"C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_f77ee.dir/objects.a
CMAKE_AR-NOTFOUND cr CMakeFiles\cmTC_f77ee.dir/objects.a #CMakeFiles\cmTC_f77ee.dir\objects1.rsp
Error running link command: The system cannot find the file specified
mingw32-make[1]: *** [CMakeFiles\cmTC_f77ee.dir\build.make:108: cmTC_f77ee.exe] Error 2
mingw32-make[1]: Leaving directory 'C:/Libraries/Projects/CMakeTest/build/MinGW-10.1.0-64-bit/debug/CMakeFiles/CMakeTmp'
mingw32-make: *** [makefile:140: cmTC_f77ee/fast] Error 2
My PATH and complete command line used:
Path:
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\MATLAB\R2019b\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\CMake\bin;C:\MinGW\MinGW-10.1.0-64-bit\bin;C:\Users\gvcal\AppData\Local\Microsoft\WindowsApps;
Command line:
"C:\Program Files\CMake\bin\cmake.EXE" -Hc:/Libraries/Projects/CMakeTest -Bc:/Libraries/Projects/CMakeTest/build -G "MinGW Makefiles"
I think this may be a bug with CMake and MinGW Makefiles. Still not entirely sure what it is.
Anyways, I switched to the Ninja build system (https://ninja-build.org/) and all is working fine now.

Error Building Giraffe (Chess Program): /opt/local/bin/as: assembler (/opt/local/bin/clang) not installed

I'm trying to build the Giraffe Deep Belief Chess Playing program which I downloaded from Mercurial.
From README.md:
Tested on Linux (GCC 4.9), OS X (GCC 4.9), Windows (MinGW-W64 GCC 5.1). GCC versions earlier than 4.8 are definitely NOT supported, due to broken regex implementation in libstdc++.
Here's the error:
David-Laxers-MacBook-Pro:giraffe davidlaxer$ make
g++ -Wall -Wextra -Wno-unused-function -std=gnu++11 -mtune=native -Wa,-q -ffast-math -pthread -fopenmp -DHGVERSION="\"efceca80bf74\"" -O3 -march=native -Wa,-q -I. -c backend.cpp -o obj/backend.o
/opt/local/bin/as: assembler (/opt/local/bin/clang) not installed
make: *** [obj/backend.o] Error 1
I'm on OS X 10.10.5.
port select --list clang
Available versions for clang:
mp-clang-3.5
mp-clang-3.7
none (active)
David-Laxers-MacBook-Pro:giraffe davidlaxer$ ls -l /opt/local/bin/as
-r-xr-xr-x 1 root admin 28012 Feb 15 2015 /opt/local/bin/as
David-Laxers-MacBook-Pro:giraffe davidlaxer$ /opt/local/bin/as -v
Apple Inc version cctools-862, GNU assembler version 1.38
David-Laxers-MacBook-Pro:giraffe davidlaxer$ file /opt/local/bin/as
/opt/local/bin/as: Mach-O 64-bit executable x86_64
David-Laxers-MacBook-Pro:giraffe davidlaxer$ g++ --version
g++ (MacPorts gcc49 4.9.3_0) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
From Makefile:
#CXX=g++-4.9 # I changed this - dbl
CXX=g++
# this is used to build gtb only
CC=gcc-4.9
HGVERSION:= $(shell hg parents --template '{node|short}')
CXXFLAGS_BASE = \
-Wall -Wextra -Wno-unused-function -std=gnu++11 -mtune=native -Wa,-q -ffast-math \
-pthread -fopenmp -DHGVERSION="\"${HGVERSION}\""
Here is what I did to solve this issue using Brew,
$ clang
zsh: no such file or directory: clang
$ brew install llvm --with-clang --with-asan
==> Downloading http://llvm.org/releases/3.5.0/llvm-3.5.0.src.tar.xz
######################################################################## 100.0%
🍺 /usr/local/Cellar/llvm/3.5.0: 1235 files, 171M, built in 16.8 minutes
$ clang -v
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

libtool picks up 64-bit library when I tries to build 32-bit program

I have a GNU build system with autoconf-2.69, automake-1.14.1, libtool-2.4.2. I've configured with --host=i686-linux on a x86_64 RHEL6 host OS to build a 32-bit program. The libtool command seems to be:
/bin/sh ../libtool --tag=CXX --mode=link g++ -I/home/STools/RLX/boost/include/boost-1_44 -m32 -g3 -Wall -static -o engine engine-main.o ../components/librlxvm.la /home/STools/RLX/boost/include/boost-1_44/../../lib/libboost_program_options-gcc42-mt-1_44.a -lz -lpthread -ldl -lrt -ldl -lz -lm
But the real command is to search the 64-bit libraries not the 32-bit libraries as shown below:
libtool: link: g++ -I/home/STools/RLX/boost/include/boost-1_44 -m32 -g3 -Wall -o engine engine-main.o -L/home/robert_bu/src/gcc/gcc-4.2.2/build-x86_64/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/home/robert_bu/src/gcc/gcc-4.2.2/build-x86_64/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/home/robert_bu/src/gcc/gcc-4.2.2/build-x86_64/./gcc ../components/.libs/librlxvm.a /home/STools/RLX/boost/include/boost-1_44/../../lib/libboost_program_options-gcc42-mt-1_44.a /home/STools/RLX/gcc-4.2.2-x86_64/lib/../lib64/libstdc++.so -L/lib/../lib64 -L/usr/lib/../lib64 -lc -lgcc_s -lrt -ldl -lz -lm -pthread -Wl,-rpath -Wl,/home/STools/RLX/gcc-4.2.2-x86_64/lib/../lib64 -Wl,-rpath -Wl,/home/STools/RLX/gcc-4.2.2-x86_64/lib/../lib64
The --host config seems to have no effect. Is there anyway to tell libtool that 32-bit libraries are what we want?
It seems that libtool uses "CC", "CXX" to check the library search path. After I set CC to "gcc -m32", and CXX to "g++ -m32", it works. So libtool does not add "-m32" automatically even if I try to build a 32-bit program on a 64-bit system.
You're being hit by the problem of libtool .la files expansion. In particular libstdc++.la is being expanded for you to a full path rather than a simple -lstdc++.
My suggestion is to remove .la file from the SDK you're using (/home/STools). This way libtool can't assume things for you. Usually the ones you have in the system are fine, because the libraries are already in the search path, so it does not need to use -rpath or the full path to the .so file.
Depending on how well the SDK was crafted, this might or might not work correctly, so take it with a grain of salt.

Make execvp permission denied

I've got a makefile I'm trying to run without too much luck. Here's what happens
I try to make, and it start out ok. It then gives an error that it can't find the file. However, I can do an ls -ld on the file without any problem. Do you have any idea whats going on?
pgr#pgr:~/start_code_1$ make
gcc -Wall -g -m32 -c -fomit-frame-pointer -O2 -fno-builtin bootblock.s
ld -nostartfiles -nostdlib -melf_i386 -Ttext 0x0 -o bootblock bootblock.o
gcc -c -o createimage.o createimage.c
gcc -o createimage createimage.o
gcc -Wall -g -m32 -c -fomit-frame-pointer -O2 -fno-builtin kernel.s
ld -nostartfiles -nostdlib -melf_i386 -Ttext 0x1000 -o kernel kernel.o
./createimage.given --extended ./bootblock ./kernel
make: ./createimage.given: Command not found
make: *** [image] Error 127
pgr#pgr:~/start_code_1$ ls -ld ./createimage.given
-rwxr-xr-x 1 pgr pgr 26110 Sep 16 13:03 ./createimage.given
UPDATED
pgr#pgr:~/workspace/318/bootloader$ file createimage.given
createimage.given: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped
UPDATE 2
pgr#pgr:~/phdvdev/workspace/318/bootloader$ ldd createimage.given
not a dynamic executable
Most likely your createimage.given script has wrong interpreter in shebang line. And the chances are it's been edited on windows machine and has trailing carriage return :)