How to modify libstdc++ portfile to compile fat static library? - macos

I am using MacPorts to set up a universal build of GCC 4.7.2. One of its dependencies is a subport called libstdcxx, which it builds and then deletes.
I have edited the libstdcxx entry in the gcc47 portfile to keep from deleting the static libstdc++.a library, after rebuilding.
However, the static library is a 64-bit (x86_64) file:
$ sudo port -n upgrade --force libstdcxx +universal
---> Computing dependencies for libstdcxx
...
$ lipo -info /opt/local/lib/libstdc++.a
input file /opt/local/lib/libstdc++.a is not a fat file
Non-fat file: /opt/local/lib/libstdc++.a is architecture: x86_64
I would also like to add support to this file for the i386 architecture.
What additional steps should I follow to build a fat, static libstdc++ library? Or is this not possible with MacPorts? Is the only other option to redistribute and compile the entirety of GCC 4.7.2 twice (to get both i386 and x86_64 architecture support), along with the source to my application, just to link in this one static library?
Addition - 27 Mar 2013
Brett Hale's suggestion did not appear to work. The build process failed. Here is a snippet of the error log:
:notice:configure ---> Configuring libstdcxx
:debug:configure Using compiler 'Mac OS X clang'
:debug:configure Executing proc-pre-org.macports.configure-configure-0
:debug:configure Executing org.macports.configure (libstdcxx)
:debug:configure Environment: CPATH='/opt/local/include' CXXFLAGS='-pipe -O2' CPPFLAGS='-I/opt/local/include' CFLAGS='-pipe -O2' AS_FOR_TARGET='/opt/local/bin/as' LIBRARY_PATH='/opt/local/lib' MACOSX_DEPLOYMENT_TARGET='10.8' CXX='g++ -arch x86_64 i386' CPP='gcc -arch x86_64 i386 -E\
' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/libstdcxx/work/.CC_PRINT_OPTIONS' F90FLAGS='-pipe -O2' LD_FOR_TARGET='/opt/local/bin/ld' RANLIB_FOR_TARGET='/opt/local/bin/ranlib' LDFLAGS='-L\
/opt/local/lib' OBJDUMP_FOR_TARGET='/opt/local/bin/objdump' OTOOL='/opt/local/bin/otool' FCFLAGS='-pipe -O2' OBJC='/usr/bin/clang' INSTALL='/usr/bin/install -c' AR_FOR_TARGET='/opt/local/bin/ar' NM_FOR_TARGET='/opt/local/bin/nm' FFLAGS='-pipe -O2' OBJCFLAGS='-pipe -O2' CC_PRINT_OPT\
IONS='YES' STRIP_FOR_TARGET='/opt/local/bin/strip' CC='gcc -arch x86_64 i386' OTOOL64='/opt/local/bin/otool'
:debug:configure Assembled command: 'cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/libstdcxx/work/build" && ../gcc-4.7.2/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --includedir=/opt/local/incl\
ude/gcc47 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/gcc47/\
c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/lo\
cal/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-ppl-version-check --enable-languages=c++ --disable-bootstrap --with-pkgversion="MacPorts gcc47 4.7.2_2+universal"'
:debug:configure Executing command line: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/libstdcxx/work/build" && ../gcc-4.7.2/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --includedir=/opt/local\
/include/gcc47 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/g\
cc47/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/o\
pt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-ppl-version-check --enable-languages=c++ --disable-bootstrap --with-pkgversion="MacPorts gcc47 4.7.2_2+universal"
:info:configure checking build system type... x86_64-apple-darwin12
:info:configure checking host system type... x86_64-apple-darwin12
:info:configure checking target system type... x86_64-apple-darwin12
:info:configure checking for a BSD-compatible install... /usr/bin/install -c
:info:configure checking whether ln works... yes
:info:configure checking whether ln -s works... yes
:info:configure checking for a sed that does not truncate output... /usr/bin/sed
:info:configure checking for gawk... no
:info:configure checking for mawk... no
:info:configure checking for nawk... no
:info:configure checking for awk... awk
:info:configure checking for libitm support... yes
:info:configure checking for gcc... gcc -arch x86_64 i386
:info:configure checking for C compiler default output file name...
:info:configure configure: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/libstdcxx/work/build':
:info:configure configure: error: C compiler cannot create executables
:info:configure See `config.log' for more details.
:info:configure Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/libstdcxx/work/build" && ../gcc-4.7.2/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --includedir=/opt/local/include/\
gcc47 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/gcc47/c++/\
--with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/\
bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-ppl-version-check --enable-languages=c++ --disable-bootstrap --with-pkgversion="MacPorts gcc47 4.7.2_2+universal"
:info:configure Exit code: 77
:error:configure org.macports.configure for port libstdcxx returned: configure failure: command execution failed
:debug:configure Error code: NONE
:debug:configure Backtrace: configure failure: command execution failed
while executing
"$procedure $targetname"
:info:configure Warning: targets not executed for libstdcxx: org.macports.activate org.macports.configure org.macports.build org.macports.destroot org.macports.install
:notice:configure Please see the log file for port libstdcxx for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/libstdcxx/main.log

If you're building gcc with the gcc compiler, you could try to produce universal objects / libraries with the -arch option:
sudo port -n upgrade --force libstdcxx +universal \
configure.cc="gcc -arch x86_64 i386" configure.cxx="g++ -arch x86_64 i386"

Related

Build RocksDB static library using vcpkg and custom gcc on Windows

I am trying to create Kotlin/Native bindings for RocksDB. This requires that RocksDB is compiled using gcc and g++ version 9.2.0, because that is the only version that Kotlin/Native supports. If I build using 9.5.0 or later, then I get errors:
const: error: undefined reference to 'gettid'
The gettid wrapper was added to glibc 2.30, but Kotlin/Native uses glibc 2.15 when linking.
Since RocksDB has a Makefile that works on Linux and macOS, I am able to successfully build compatible RocksDB libraries. However, I am encountering problems when trying to build RocksDB on Windows.
The RocksDB wiki explains how to use vcpkg to build RocksDB on Windows, which is quite easy. However, vcpkg will use the system gcc, unless specially instructed otherwise using a special toolchain cmake file.
Updating vcpkg to use gcc 9.2.0
vcpkg will accept a custom cmake toolchain file where the location of gcc and g++ can be defined, so I have created that file:
# D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/konan-toolchain.cmake
set(CMAKE_C_COMPILER "C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/gcc.exe")
set(CMAKE_CXX_COMPILER "C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/g++.exe")
set(CMAKE_VERBOSE_MAKEFILE ON)
And then set the file location using the VCPKG_CHAINLOAD_TOOLCHAIN_FILE property in the vcpkg triplet file I use to build RocksDB on Windows:
echo "set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/konan-toolchain.cmake\")" \
>> ./triplets/community/x64-mingw-static.cmake
vcpkg install fails - "not able to compile a simple test program"
vcpkg seems to be correctly set up to use Kotlin/Native's gcc 9.2.0, but the vcpkg install fails:
Detecting compiler hash for triplet x64-windows...
Detecting compiler hash for triplet x64-mingw-static...
error: while detecting compiler information:
The log file content at "D:\a\kotlin-on-the-rocksdb\kotlin-on-the-rocksdb\vcpkg\buildtrees\detect_compiler\stdout-x64-mingw-static.log" is:
-- Found external ninja('1.10.2').
-- Configuring x64-mingw-static
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
Command failed: C:/ProgramData/chocolatey/bin/ninja.exe -v
Working Directory: D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/vcpkg-parallel-configure
Error code: 1
See logs for more information:
D:\a\kotlin-on-the-rocksdb\kotlin-on-the-rocksdb\vcpkg\buildtrees\detect_compiler\config-x64-mingw-static-rel-CMakeCache.txt.log
D:\a\kotlin-on-the-rocksdb\kotlin-on-the-rocksdb\vcpkg\buildtrees\detect_compiler\config-x64-mingw-static-out.log
Call Stack (most recent call first):
scripts/cmake/vcpkg_configure_cmake.cmake:310 (vcpkg_execute_required_process)
scripts/detect_compiler/portfile.cmake:18 (vcpkg_configure_cmake)
scripts/ports.cmake:147 (include)
error: vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.
Error: Process completed with exit code 1.
The log file contains more details:
[1/1] "C:/Program Files/CMake/bin/cmake.exe" -E chdir ".." "C:/Program Files/CMake/bin/cmake.exe" "D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/scripts/detect_compiler" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/packages/detect_compiler_x64-mingw-static" "-DCMAKE_MAKE_PROGRAM=C:/ProgramData/chocolatey/bin/ninja.exe" "-DCMAKE_SYSTEM_NAME=MinGW" "-DBUILD_SHARED_LIBS=OFF" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/konan-toolchain.cmake" "-DVCPKG_TARGET_TRIPLET=x64-mingw-static" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=external" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg" "-DZ_VCPKG_ROOT_DIR=D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg" "-D_VCPKG_INSTALLED_DIR=D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/vcpkg_installed" "-DVCPKG_MANIFEST_INSTALL=OFF"
FAILED: ../CMakeCache.txt
"C:/Program Files/CMake/bin/cmake.exe" -E chdir ".." "C:/Program Files/CMake/bin/cmake.exe" "D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/scripts/detect_compiler" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/packages/detect_compiler_x64-mingw-static" "-DCMAKE_MAKE_PROGRAM=C:/ProgramData/chocolatey/bin/ninja.exe" "-DCMAKE_SYSTEM_NAME=MinGW" "-DBUILD_SHARED_LIBS=OFF" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/konan-toolchain.cmake" "-DVCPKG_TARGET_TRIPLET=x64-mingw-static" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=external" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg" "-DZ_VCPKG_ROOT_DIR=D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg" "-D_VCPKG_INSTALLED_DIR=D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/vcpkg_installed" "-DVCPKG_MANIFEST_INSTALL=OFF"
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- The C compiler identification is GNU 9.2.0
-- Detecting C compiler ABI info
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/gcc.exe
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Check for working C compiler: C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/gcc.exe - works
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is unknown
-- Detecting CXX compiler ABI info
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/g++.exe
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Check for working CXX compiler: C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/g++.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeTestCXXCompiler.cmake:63 (message):
The C++ compiler
"C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/g++.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/CMakeFiles/CMakeScratch/TryCompile-0ck1wg
Run Build Command(s):C:/ProgramData/chocolatey/bin/ninja.exe cmTC_8403e && [1/2] Building CXX object CMakeFiles\cmTC_8403e.dir\testCXXCompiler.cxx.obj
FAILED: CMakeFiles/cmTC_8403e.dir/testCXXCompiler.cxx.obj
C:\Users\runneradmin\.konan\dependencies\msys2-mingw-w64-x86_64-2\bin\g++.exe -o CMakeFiles\cmTC_8403e.dir\testCXXCompiler.cxx.obj -c D:\a\kotlin-on-the-rocksdb\kotlin-on-the-rocksdb\vcpkg\buildtrees\detect_compiler\x64-mingw-static-rel\CMakeFiles\CMakeScratch\TryCompile-0ck1wg\testCXXCompiler.cxx
cc1plus.exe: error: unrecognized command-line option '-auxbase-strip'
cc1plus.exe: error: too many filenames given; type 'cc1plus.exe --help' for usage
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:12 (enable_language)
-- Configuring incomplete, errors occurred!
See also "D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/CMakeFiles/CMakeOutput.log".
See also "D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/CMakeFiles/CMakeError.log".
ninja: build stopped: subcommand failed.
The log indicates that the correct gcc/g++ commands are used:
The C compiler identification is GNU 9.2.0
But it fails.
What I've tried
Increase logging
I have tried increasing the log verbosity, but I wasn't able to get more information.
set(CMAKE_VERBOSE_MAKEFILE ON)
unrecognized command-line option '-auxbase-strip'
I was only able to find that this option is internal, and shouldn't be used. I don't know where it's coming from. There's no mention of it in vcpkg.
This question mentions auxbase, but not auxbase-strip, and has no answers.
too many filenames given
The answers in this question suggest
use -O2 instead of -o2, but from what I can tell RocksDB already uses -O2
no spaces in paths - but I'm pretty sure that there aren't any...
GitHub Workflow
I am using a GitHub Workflow, so I can automate building with a Windows machine.
Here is a summary:
Checkout vcpkg
git clone --depth 1 https://github.com/microsoft/vcpkg.git
cd vcpkg
Update the cmake to be a release library (which makes the produced library much smaller) and use the custom toolchain cmake.
echo "set(VCPKG_BUILD_TYPE release)" >> ./triplets/community/x64-mingw-static.cmake
echo "set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/konan-toolchain.cmake\")" >> ./triplets/community/x64-mingw-static.cmake
set up vcpkg, set the RocksDB version
./bootstrap-vcpkg.sh
touch vcpkg.json;
cat <<EOT >> vcpkg.json
{
"dependencies": [
"rocksdb",
"zstd",
"zlib",
"snappy",
"lz4",
"bzip2"
],
"overrides": [
{ "name": "rocksdb", "version": "${{ env.ROCKSDB_VERSION }}" }
]
}
EOT
vcpkg x-update-baseline --add-initial-baseline
vcpkg install
Additional logs
./vcpkg/buildtrees/detect_compiler/x64-windows-rel/CMakeFiles/CMakeOutput.log
The target system is: Windows - 10.0.20348 - AMD64
The host system is: Windows - 10.0.20348 - AMD64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe
Build flags: ;/nologo;/DWIN32;/D_WINDOWS;/W3;/utf-8;/MP;
Id flags:
The output was:
0
CMakeCCompilerId.c
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.exe"
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.obj"
The C compiler identification is MSVC, found in "D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/buildtrees/detect_compiler/x64-windows-rel/CMakeFiles/3.25.2/CompilerIdC/CMakeCCompilerId.exe"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe
Build flags: ;/nologo;/DWIN32;/D_WINDOWS;/W3;/utf-8;/GR;/EHsc;/MP;
Id flags:
The output was:
0
CMakeCXXCompilerId.cpp
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.exe"
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.obj"
The CXX compiler identification is MSVC, found in "D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/buildtrees/detect_compiler/x64-windows-rel/CMakeFiles/3.25.2/CompilerIdCXX/CMakeCXXCompilerId.exe"
./vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/CMakeFiles/CMakeError.log
Detecting C compiler ABI info failed to compile with the following output:
Change Dir: D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/CMakeFiles/CMakeScratch/TryCompile-oiuqqn
Run Build Command(s):C:/ProgramData/chocolatey/bin/ninja.exe cmTC_3a862 && [1/2] Building C object CMakeFiles/cmTC_3a862.dir/CMakeCCompilerABI.c.obj
Using built-in specs.
COLLECT_GCC=C:\Users\runneradmin\.konan\dependencies\msys2-mingw-w64-x86_64-2\bin\gcc.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-9.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++ --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --enable-plugin --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 9.2.0 (Rev2, Built by MSYS2 project)
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_3a862.dir/CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=x86-64'
C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/cc1.exe -quiet -v -iprefix C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/ -D_REENTRANT C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_3a862.dir/CMakeCCompilerABI.c.obj -version -o C:\Users\RUNNER~1\AppData\Local\Temp\ccTdIyhC.s
GNU C17 (Rev2, Built by MSYS2 project) version 9.2.0 (x86_64-w64-mingw32)
compiled by GNU C version 9.2.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.21-GMP
warning: GMP header version 6.1.2 differs from library version 6.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/9.2.0/include"
ignoring nonexistent directory "C:/building/msys64/mingw64/include"
ignoring nonexistent directory "/mingw64/include"
ignoring duplicate directory "C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/9.2.0/include-fixed"
ignoring duplicate directory "C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "C:/building/msys64/mingw64/x86_64-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/include
C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../include
C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/include-fixed
C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/include
End of search list.
GNU C17 (Rev2, Built by MSYS2 project) version 9.2.0 (x86_64-w64-mingw32)
compiled by GNU C version 9.2.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.21-GMP
warning: GMP header version 6.1.2 differs from library version 6.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3bcdf03344e3ad7cb057c2ec82f696e6
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_3a862.dir/CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=x86-64'
C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/as.exe -v -o CMakeFiles/cmTC_3a862.dir/CMakeCCompilerABI.c.obj C:\Users\RUNNER~1\AppData\Local\Temp\ccTdIyhC.s
GNU assembler version 2.32 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.32
COMPILER_PATH=C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/
LIBRARY_PATH=C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/../lib/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../lib/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_3a862.dir/CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=x86-64'
[2/2] Linking C executable cmTC_3a862
Using built-in specs.
COLLECT_GCC=C:\Users\runneradmin\.konan\dependencies\msys2-mingw-w64-x86_64-2\bin\gcc.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-9.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++ --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --enable-plugin --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 9.2.0 (Rev2, Built by MSYS2 project)
COMPILER_PATH=C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/
LIBRARY_PATH=C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/../lib/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../lib/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/;C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_3a862.exe' '-mtune=generic' '-march=x86-64'
C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/collect2.exe -plugin C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/liblto_plugin-0.dll -plugin-opt= -plugin-opt=-fresolution=C:\Users\RUNNER~1\AppData\Local\Temp\cc5FiNtF.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pep -Bdynamic -o cmTC_3a862.exe C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/crtbegin.o -LC:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0 -LC:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc -LC:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/../lib -LC:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../lib -LC:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib -LC:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../.. CMakeFiles/cmTC_3a862.dir/CMakeCCompilerABI.c.obj -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o C:/Users/runneradmin/.konan/dependencies/msys2-mingw-w64-x86_64-2/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/crtend.o
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_3a862.exe' '-mtune=generic' '-march=x86-64'
Cannot copy output executable
''
to destination specified by COPY_FILE:
'D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/CMakeFiles/3.25.2/CMakeDetermineCompilerABI_C.bin'
Recorded try_compile output location doesn't exist:
D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/CMakeFiles/CMakeScratch/TryCompile-oiuqqn/cmTC_3a862
Checking whether the CXX compiler is IAR using "" did not match "IAR .+ Compiler":
g++.exe: fatal error: no input files
compilation terminated.
Checking whether the CXX compiler is IAR using "" did not match "IAR .+ Compiler":
g++.exe: fatal error: no input files
compilation terminated.
Detecting CXX compiler ABI info failed to compile with the following output:
Change Dir: D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/CMakeFiles/CMakeScratch/TryCompile-s77rm4
Run Build Command(s):C:/ProgramData/chocolatey/bin/ninja.exe cmTC_4db65 && [1/2] Building CXX object CMakeFiles\cmTC_4db65.dir\CMakeCXXCompilerABI.cpp.obj
FAILED: CMakeFiles/cmTC_4db65.dir/CMakeCXXCompilerABI.cpp.obj
C:\Users\runneradmin\.konan\dependencies\msys2-mingw-w64-x86_64-2\bin\g++.exe -o CMakeFiles\cmTC_4db65.dir\CMakeCXXCompilerABI.cpp.obj -c "C:\Program Files\CMake\share\cmake-3.25\Modules\CMakeCXXCompilerABI.cpp"
cc1plus.exe: error: unrecognized command-line option '-auxbase-strip'
cc1plus.exe: error: too many filenames given; type 'cc1plus.exe --help' for usage
ninja: build stopped: subcommand failed.
Determining if the C++ compiler works failed with the following output:
Change Dir: D:/a/kotlin-on-the-rocksdb/kotlin-on-the-rocksdb/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/CMakeFiles/CMakeScratch/TryCompile-552faq
Run Build Command(s):C:/ProgramData/chocolatey/bin/ninja.exe cmTC_e2caf && [1/2] Building CXX object CMakeFiles\cmTC_e2caf.dir\testCXXCompiler.cxx.obj
FAILED: CMakeFiles/cmTC_e2caf.dir/testCXXCompiler.cxx.obj
C:\Users\runneradmin\.konan\dependencies\msys2-mingw-w64-x86_64-2\bin\g++.exe -o CMakeFiles\cmTC_e2caf.dir\testCXXCompiler.cxx.obj -c D:\a\kotlin-on-the-rocksdb\kotlin-on-the-rocksdb\vcpkg\buildtrees\detect_compiler\x64-mingw-static-rel\CMakeFiles\CMakeScratch\TryCompile-552faq\testCXXCompiler.cxx
cc1plus.exe: error: unrecognized command-line option '-auxbase-strip'
cc1plus.exe: error: too many filenames given; type 'cc1plus.exe --help' for usage
ninja: build stopped: subcommand failed.

GCC built out ELF64 binary but cannot execute binary file: Exec format error

I met strange issues about ELF32/ELF64 format in my building machine.
Both applications and kernle module don't work.
For applications (such as helloworld program), it can be built out to ELF64 but run failed.
For kernel modules it will always be built out to ELF32 format even if append -march=x86-64 to CFLGAS, which leads to Module has invalid ELF structures issue when insmoding.
If append -m64 and it will lead to cc1: error: CPU you selected does not support x86-64 instruction set
I guess when the first question fixed, the next will also be fixed, so I only post the first one here.
Ubunt 18.04, gcc 7.5.0 , x86_64 PC
GCC built out helloworld program to ELF64 binary but cannot run
gcc -o hello -v -c hello.c
...
chmod +x hello
./hello
-bash: ./hello: cannot execute binary file: Exec format error
uname -a
Linux AELAB146 5.4.0-74-generic #83~18.04.1-Ubuntu SMP Tue May 11 16:01:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
Kernel Module's Makefile
EXTRA_CFLAGS += -Wall (and others blablabla) -m64
KERNEL_BUILD ?= /lib/modules/$(shell uname -r)/build
pcie_objs := common/init.o common/pcie.o common/net.o platform.o
obj-m := pcie.o
pcie.o: $(pcie_objs)
ld -r $^ -o $#
all:
make -C $(KERNEL_BUILD) M=$(PWD) V=1 modules
I'v no idea about why it's so long for the gcc Configured options in my system.
You're not supposed to pass -c to GCC when building an executable. It means to compile and not link, but programs need to be linked to be ran. The fact that you had to do chmod +x hello should have been a clue that you were doing something very wrong. Run gcc -o hello -v hello.c and then ./hello.
I assume your issue with kernel modules is similarly caused by an incorrect command line, but since you didn't post the command line you used for it, I can't see where you went wrong with it.

centos ./configure error: libevent not found despite it is installed via yum

I have a really strange problem. I am trying to compile a source (telegram-cli) which has dependency on openssl, libevent and other libraries.
The system is centos 6.9
and "Development Tools" and libevent-devel and openssl-devel are installed via yum. By the way, ./configure results in this output:
Using this repo (Telegram-CLI):
git clone --recursive https://github.com/vysheng/tg.git && cd tg
./configure :
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for library containing clock_gettime... no
checking for library containing backtrace... no
checking for event_base_new in -levent... no
configure: error: no libevent found
gcc -v -N :
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
I also added this to /etc/ld.so.conf.d/ :
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/lib
/lib64
/usr/lib64/openssl/engines
/usr/lib64/libevent-1.4.so.2.1.3
/usr/lib64/libgcrypt.so
/usr/lib64/libevent.so
The strange point is all these configs are the same on another centos system and everything just works fine. :(
I guess the libraries exist on the system but gcc or linker could not find them. Can anyone help?
Thanks
You need libevent-devel
yum install libevent-devel

gcc-4.7.2 installation fails on Rhel 6

I tried to install gcc 4.7.2 on RHEL 6. I have downloaded tar.gz archive from here, and performed following steps.
tar zxvf gcc-4.7.2.tar.gz
cd gcc-4.7.2
./configure --prefix=/usr/local/gcc-4.7.2/ --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-tune=generic --with-gmp=/usr/local/gimp-4.3.2/ --with-mpfr=/usr/local/mpfr-2.4.2/ --with-mpc=/usr/local/mpc-0.8.1/ --with-ppl=/usr/local/ppl-0.11 --with-cloog=/usr/local/cloog-ppl-0.15/
make
Whenever I'm executing make, it is throwing following error:
cp ../.././gcc/../fixincludes/README-fixinc include-fixed/README
chmod a+r include-fixed/README
echo timestamp > stmp-int-hdrs
make[3]: Leaving directory `/temp/gcc-4.7.2/host-x86_64-redhat-linux/gcc'
Checking multilib configuration for libgcc...
Configuring stage 1 in x86_64-redhat-linux/libgcc
configure: loading cache ./config.cache
checking build system type... x86_64-redhat-linux-gnu
checking host system type... x86_64-redhat-linux-gnu
checking for --enable-version-specific-runtime-libs... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... gawk
checking for x86_64-redhat-linux-ar... ar
checking for x86_64-redhat-linux-lipo... lipo
checking for x86_64-redhat-linux-nm... /temp/gcc-4.7.2/host-x86_64-redhat-linux/gcc/nm
checking for x86_64-redhat-linux-ranlib... ranlib
checking for x86_64-redhat-linux-strip... strip
checking whether ln -s works... yes
checking for x86_64-redhat-linux-gcc... /temp/gcc-4.7.2/host-x86_64-redhat-linux/gcc/xgcc -B/temp/gcc-4.7.2/host-x86_64-redhat-linux/gcc/ -B/usr/local/gcc-4.7.2/x86_64-redhat-linux/bin/ -B/usr/local/gcc-4.7.2/x86_64-redhat-linux/lib/ -isystem /usr/local/gcc-4.7.2/x86_64-redhat-linux/include -isystem /usr/local/gcc-4.7.2/x86_64-redhat-linux/sys-include
checking for suffix of object files... configure: error: in `/temp/gcc-4.7.2/x86_64-redhat-linux/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/temp/gcc-4.7.2'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/temp/gcc-4.7.2'
make: *** [all] Error 2
How to resolve this error?
I have solved my problem. Just I have exported path for gmp, mpc, mpfr, ppl libraries to environment variable LD_LIBRARY_PATH.

configure fails with "C compiler cannot create executables"

Right now I'm trying to compile the google protocol buffers from source with MinGW but when I try:
Matthew#RaRemoz-8 /e/workspace/protobuf-2.5.0
$ ./configure
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking target system type... i686-pc-mingw32
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/e/workspace/protobuf-2.5.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
and the config says: This
it seems to fail around this
configure:3474: checking whether the C compiler works
configure:3496: gcc conftest.c >&5
gcc.exe: error: CreateProcess: No such file or directory
configure:3500: $? = 1
configure:3538: result: no
heres the output of -v:
$ gcc -v helloworld.c
Using built-in specs.
COLLECT_GCC=E:\MinGW\bin\gcc.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=m
ingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto
--enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++
,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-l
ibstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gm
p-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --
with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-
libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/
mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=pentiumpro'
cc1 -quiet -v -iprefix E:\MinGWmingw32/4.8.1/ helloworld.c -quiet -dumpbase hel
loworld.c -mtune=generic -march=pentiumpro -auxbase helloworld -version -o C:\Us
ers\Matthew\AppData\Local\Temp\ccVVxhTh.s
gcc.exe: error: CreateProcess: No such file or directory
anyone encountered this or can help with this?
There's something wrong with your MinGW install, or maybe it's just that your PATH environment variable isn't set up quite right.
COLLECT_GCC indicates that gcc is in E:\MinGW\bin\gcc.exe
COLLECT_GCC_OPTIONS indicates that gcc couldn't locate cc1.exe, so it's trying to execute it as a simple cc1 command hoping that the system will find it by a normal PATH search. The system doesn't find it, so you get the CreateProcess error. Because the Target that GCC is built for is mingw32, I'd expect that cc1.exe would be located in E:\MinGW\libexec\gcc\mingw32\4.8.1\cc1.exe.
There's something else interesting about the cc1 invocation: it specifies the option -iprefix E:\MinGWmingw32/4.8.1/.
I'd expect it to look like: -iprefix E:\MinGW\bin\../lib/gcc/mingw32/4.8.1/
Something is munging the -iprefix option, but I'm not sure what.
I'd suggest reinstalling MinGW. As mentioned in one of my comments, I'd choose one of the following distributions since they've always installed in a straightforward manner for me. I can't say the same thing for the standard MinGW distribution installer, though I hear it's been greatly improved over the past few years.
nuwen.net's MinGW Distro - note that recent versions of this are 64-bit native, so it will only run on 64-bit machines and apparently will only build 64-bit binaries (distro versions before 11.0 were 32-bit native and only built 32-bit binaries). One very nice thing about nuwen MinGW is that installation is simply unpacking the archive and setting the path appropriately. There's a set_distro_paths.bat that will add it to the path for you. Nuwen's distribution also includes several libraries, including Boost. Unfortunately C++11 threads don't seem to be supported just yet.
TDM MinGW - you have a choice of 32-bit or 64-bit versions. The 64-bit version will build either 32 or 64-bit targets. The toolchain itself is a 32-bit build, so it doesn't need a 64-bit machine to perform the compile/link steps. Use the -m32 option to build a 32-bit target. The installer for TDM is a wizard-style installer. C++ 11 threads are supported, but Boost isn't included.

Resources