G++ cannot execute binary file: Exec format error - g++

Compile command:
g++ -c main.cxx -o test_bot --std=c++17 -I/usr/local/include -lTgBot -lboost_system -lssl -lcrypto -lpthread
On local machine all is OK, but on prod it is erroring:
-bash: ./test_bot: cannot execute binary file: Exec format error
Local machine arch: x86_64, on prod aarch64

Related

Unable to compile with Rcpp

I use R version 4.0.2 (2020-06-22) -- "Taking Off Again". My system is W10 enterprise 1909.
I assume I have correctly installed Rtools40, since:
install.packages("jsonlite", type = "source") terminates correctly
I used some code from devtools: has_rtools() and it returns TRUE.
install.packages("jsonlite", type = "source")
essai de l'URL 'https://cran.rstudio.com/src/contrib/jsonlite_1.6.1.tar.gz'
Content type 'application/x-gzip' length 1057910 bytes (1.0 MB)
downloaded 1.0 MB
* installing *source* package 'jsonlite' ...
** package 'jsonlite' correctement décompressé et sommes MD5 vérifiées
** using staged installation
** libs
*** arch - i386
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/i386/Makeconf:244: warning: overriding recipe for target '.m.o'
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/i386/Makeconf:237: warning: ignoring old recipe for target '.m.o'
"C:/rtools40//mingw32/bin/"gcc -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
[...]
"C:/rtools40//mingw32/bin/"ar rcs yajl/libstatyajl.a yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o
C:/rtools40//mingw32/bin/gcc -shared -s -static-libgcc -o jsonlite.dll tmp.def base64.o collapse_array.o collapse_object.o collapse_pretty.o escape_chars.o integer64_to_na.o is_datelist.o is_recordlist.o is_scalarlist.o modp_numtoa.o null_to_na.o num_to_char.o parse.o prettify.o push_parser.o r-base64.o register.o row_collapse.o transpose_list.o validate.o -Lyajl -lstatyajl -LC:/Users/toto26/DOCUME~1/R/R-40~1.2/bin/i386 -lR
installing to C:/Users/toto26/Documents/R/R-4.0.2/library/00LOCK-jsonlite/00new/jsonlite/libs/i386
*** arch - x64
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/x64/Makeconf:244: warning: overriding recipe for target '.m.o'
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/x64/Makeconf:237: warning: ignoring old recipe for target '.m.o'
"C:/rtools40//mingw64/bin/"gcc -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
[...]
"C:/rtools40//mingw64/bin/"ar rcs yajl/libstatyajl.a yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o
C:/rtools40//mingw64/bin/gcc -shared -s -static-libgcc -o jsonlite.dll tmp.def base64.o collapse_array.o collapse_object.o collapse_pretty.o escape_chars.o integer64_to_na.o is_datelist.o is_recordlist.o is_scalarlist.o modp_numtoa.o null_to_na.o num_to_char.o parse.o prettify.o push_parser.o r-base64.o register.o row_collapse.o transpose_list.o validate.o -Lyajl -lstatyajl -LC:/Users/toto26/DOCUME~1/R/R-40~1.2/bin/x64 -lR
installing to C:/Users/toto26/Documents/R/R-4.0.2/library/00LOCK-jsonlite/00new/jsonlite/libs/x64
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'jsonlite'
finding HTML links ... fini
base64 html
flatten html
fromJSON html
prettify html
rbind_pages html
read_json html
serializeJSON html
stream_in html
unbox html
validate html
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (jsonlite)
The downloaded source packages are in
‘C:\Users\toto26\AppData\Local\Temp\RtmpQrssTP\downloaded_packages’
One of my issue may come from the location of make:
Sys.which("make")
make
"C:\\WINDOWS\\SYSTEM32\\make.exe"
instead of the expected
Sys.which("make")
## "C:\\rtools40\\usr\\bin\\make.exe"
I have asked my IT department to remove the system32 version from my laptop.
Nevertheless, I am not sure it is the root cause of my issues:
install.packages("Rcpp", type = 'source')
essai de l'URL 'https://cran.rstudio.com/src/contrib/Rcpp_1.0.4.6.tar.gz'
Content type 'application/x-gzip' length 2751467 bytes (2.6 MB)
downloaded 2.6 MB
* installing *source* package 'Rcpp' ...
** package 'Rcpp' correctement décompressé et sommes MD5 vérifiées
** using staged installation
** libs
*** arch - i386
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/i386/Makeconf:244: warning: overriding recipe for target '.m.o'
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/i386/Makeconf:237: warning: ignoring old recipe for target '.m.o'
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c api.cpp -o api.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c attributes.cpp -o attributes.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c barrier.cpp -o barrier.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c date.cpp -o date.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c module.cpp -o module.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c rcpp_init.cpp -o rcpp_init.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -shared -s -static-libgcc -o Rcpp.dll tmp.def api.o attributes.o barrier.o date.o module.o rcpp_init.o -LC:/Users/toto26/DOCUME~1/R/R-40~1.2/bin/i386 -lR
/usr/bin/sh: line 8: "C:/rtools40//mingw32/bin/"g++ -std=gnu++11 : No such file or directory
aucune DLL n'a pas été créé
ERROR: compilation failed for package 'Rcpp'
* removing 'C:/Users/toto26/Documents/R/R-4.0.2/library/Rcpp'
Warning in install.packages :
installation of package ‘Rcpp’ had non-zero exit status
If I install the compiled version it works, but then I can't use Rcpp:
install.packages("Rcpp")
essai de l'URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/Rcpp_1.0.4.6.zip'
Content type 'application/zip' length 3167452 bytes (3.0 MB)
downloaded 3.0 MB
package ‘Rcpp’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\toto26\AppData\Local\Temp\RtmpQrssTP\downloaded_packages
> Rcpp::evalCpp("2+2")
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/x64/Makeconf:244: warning: overriding recipe for target '.m.o'
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/x64/Makeconf:237: warning: ignoring old recipe for target '.m.o'
"C:/rtools40//mingw64/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I"C:/Users/toto26/Documents/R/R-4.0.2/library/Rcpp/include" -I"C:/Users/toto26/AppData/Local/Temp/RtmpQrssTP/sourceCpp-x86_64-w64-mingw32-1.0.4.6" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c file477046ea4828.cpp -o file477046ea4828.o
"C:/rtools40//mingw64/bin/"g++ -std=gnu++11 -shared -s -static-libgcc -o sourceCpp_2.dll tmp.def file477046ea4828.o -LC:/Users/toto26/DOCUME~1/R/R-40~1.2/bin/x64 -lR
/usr/bin/sh: line 8: "C:/rtools40//mingw64/bin/"g++ -std=gnu++11 : No such file or directory
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, :
Error occurred building shared library.
Any hints would be more than welcome.
Thanks a lot in advance.
Emmanuel
edit: here is my path:
> Sys.getenv('PATH')
[1] "C:\\rtools40\\usr\\bin;C:\\Users\\toto26\\Documents\\R\\R-4.0.2\\bin\\x64;C:\\rtools40\\usr\\bin;C:\\rtools40\\mingw64\\bin;C:\\ProgramData\\DockerDesktop\\version-bin;C:\\Program Files\\Docker\\Docker\\Resources\\bin;C:\\RBuildTools\\bin;C:\\RBuildTools\\mingw_64\\bin;C:\\RBuildTools\\mingw_32\\bin;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\MATLAB\\R2018a\\runtime\\win64;C:\\Program Files\\MATLAB\\R2018a\\bin;C:\\Program Files (x86)\\PDFtk\\bin\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\rtools40\\usr\\bin;C:\\RBuildTools\\3.5\\mingw_64\\bin;C:\\RBuildTools\\3.5\\bin;C:\\Python\\Scripts\\;C:\\Python\\;C:\\Users\\toto26\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\toto26\\AppData\\Local\\atom\\bin;C:\\Users\\toto26\\AppData\\Local\\Programs\\MiKTeX 2.9\\miktex\\bin\\x64\\;C:\\RBuildTools\\3.3\\mingw_64\\bin;C:\\MinGW\\bin;C:\\Users\\toto26\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\toto26\\AppData\\Local\\Pandoc\\;"

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.

g++ error: Cannot specify -static with -fsanitize=address

I am trying to use address sanitizer with g++ and during the build it produces the following linker command, which produces the error g++: error: cannot specify -static with -fsanitize=address
I don't understand what this means, so any help is appreciated. The g++ version is g++ (GCC) 8.3.0 20190222 (Cray Inc.).
g++ -g -fsanitize=address CMakeFiles/pisa.dir/src/Alphabet.cpp.o {more .o files} -o pisa -L/global/homes/e/esaliya/sali/git/bitbucket/combinatorial-blas-2.0/CombBLAS/_install/lib -Wl,-rpath,/global/homes/e/esaliya/sali/git/bitbucket/combinatorial-blas-2.0/CombBLAS/_install/lib -lCombBLAS -lGraphGenlib -lUsortlib

bazel compile error: linux/magic.h: No such file or directory

ERROR: /ban/yohchang/practice/tensorflow/bazel-0.5.1-dist/src/main/cpp/BUILD:7:1: C++ compilation of rule '//src/main/cpp:blaze_util' failed: gcc failed: error executing command
(cd /tmp/bazel_tC149834/out/execroot/bazel-0.5.1-dist &&
exec env -
LD_LIBRARY_PATH=:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/gcc-4.8.1/lib:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/gcc-4.8.1/lib64/:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/mpc-0.8.1/lib:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/gmp-4.3.2/lib:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/mpfr-2.4.2/lib:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/isl-0.11/lib:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/cloog-0.18.0/lib
PATH=/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/binutils-2.28:/sc10/ap/sivl/2005.09-SP1-1/bin:/vol0/sys/myPrint/print_execd-6.2u4/bin/lx24-amd64:/sc10/ap/linux/bin:/ban/yohchang/:.:/bin:/usr/ucb:/usr/ccs/bin:/usr/dt/bin:/usr/openwin/bin:/usr/local/bin:/usr/ucb/bin:/usr/bin:/usr/sbin:/bin/X11:/usr/X11R6/bin:/sc10/ap/xv/sun:/ban/wchuang/tool:/sc10/ap/tool:/vol0/sys/tool:/usr/bin:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/gcc-4.8.1/bin
PWD=/proc/self/cwd
/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/gcc-4.8.1/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/gcc-4.8.1/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/local-opt/bin/src/main/cpp/objs/blaze_util/src/main/cpp/blaze_util_linux.d '-frandom-seed=bazel-out/local-opt/bin/src/main/cpp/objs/blaze_util/src/main/cpp/blaze_util_linux.o' -DBLAZE_OPENSOURCE -iquote . -iquote bazel-out/local-opt/genfiles -iquote external/bazel_tools -iquote bazel-out/local-opt/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/main/cpp/blaze_util_linux.cc -o bazel-out/local-opt/bin/src/main/cpp/_objs/blaze_util/src/main/cpp/blaze_util_linux.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
src/main/cpp/blaze_util_linux.cc:18:25: fatal error: linux/magic.h: No such file or directory
#include "linux/magic.h"
^
compilation terminated.
Don't really know how to solve this...
I try to use google to find some information. It tells me that maybe this problem is caused by my old kernel. But I don't really know what I can do next.
Environment info
Operating System:
Red Hat Enterprise Linux Server release 5.7 (Tikanga)
ldd (GNU libc) 2.5
gcc-4.8.1 (I install this compiler additionally.)
other information:
I can't use yum or any other on-line update to install package...
So I download source code and compile them on my redhat computer.
Bazel version (output of bazel info release):
0.5.1-dist
If you need any other information, please let me know!
Thanks for help!
linux/magic.h is not part of Bazel, it's part of the environment. I, for example, have it in /usr/include/linux/magic.h.
Can you download the equivalent of kernel-headers (the ones you would install by yum install kernel-headers) and put them somewhere gcc can see them? That would be into one of the directories returned by gcc -E -xc++ - -v.

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 :)