How to cross-compile a Chromium Embedded Framework (CEF) Windows app on Linux using MinGW - cmake

I'm trying to compile the cefclient and cefsimple applications provided in the CEF3 distribution into Windows executables from my Linux machine.
I'm running Linux Mint 17 (64-bit), and I'm trying to compile the Windows 32-bit versions of cefclient and cefsimple from Branch 2454.
I have cmake and the MinGW cross-compilers installed, and I tested each individually. They all work well. I also have the build-essential, libgtk2.0-dev, and libgtkglext1-dev dependencies installed.
When I try to build the MakeFiles from a new CEF/build directory, I get an error:
Command:
> cmake -G "Unix Makefiles" -D CMAKE_C_COMPILER=i686-w64-mingw32-gcc -D CMAKE_CXX_COMPILER=i686-w64-mingw32-g++ ..
CMakeError.log
Determining if the C compiler works failed with the following output:
Change Dir: /path/to/CEF/Source/build/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/make "cmTryCompileExec1497229498/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec1497229498.dir/build.make CMakeFiles/cmTryCompileExec1497229498.dir/build
make[1]: Entering directory '/path/to/CEF/Source/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /path/to/CEF/Source/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object
CMakeFiles/cmTryCompileExec1497229498.dir/testCCompiler.c.o
/usr/bin/i686-w64-mingw32-gcc -o
CMakeFiles/cmTryCompileExec1497229498.dir/testCCompiler.c.o -c /path/to/CEF/Source/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTryCompileExec1497229498
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1497229498.dir/link.txt --verbose=1
/usr/bin/i686-w64-mingw32-gcc CMakeFiles/cmTryCompileExec1497229498.dir/testCCompiler.c.o -o cmTryCompileExec1497229498 -rdynamic
i686-w64-mingw32-gcc: error: unrecognized command line option '-rdynamic'
make[1]: *** [cmTryCompileExec1497229498] Error 1
make[1]: Leaving directory `/path/to/CEF/Source/build/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec1497229498/fast] Error 2
This is my first attempt to cross-compile anything from Linux to Windows. Am I doing it wrong? Is there something I'm missing? What is the error message indicating?

Related

Errors in p4est and cmake when install dealii

Can anyone help me with this issue?
In order to use dealii, I tried to install p4est using the command
./configure && make && make install
and
cmake .. -DP4EST_DIR=/usr/local -DDEAL_II_WITH_P4EST=ON -DDEAL_II_WITH_MPI=ON -DCMAKE_INSTALL_PREFIX=/usr/local
under "build" folder, but some error occurs.
I also opened the file dealii-9.0.0/build/CMakeFiles/CMakeError.log, it says:
Source file was:
int main() { return 0; }
Performing C++ SOURCE FILE Test rt_LIBRARY failed with the following output:
Change Dir: /Users/chuxiaoyun/Downloads/dealii-9.0.0/build/CMakeFiles/CMakeScratch/TryCompile-Fscvq9
Run Build Command(s):/usr/bin/make -f Makefile cmTC_bc7f9/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_bc7f9.dir/build.make CMakeFiles/cmTC_bc7f9.dir/build
Building CXX object CMakeFiles/cmTC_bc7f9.dir/src.cxx.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -Drt_LIBRARY -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -mmacosx-version-min=11.6 -MD -MT CMakeFiles/cmTC_bc7f9.dir/src.cxx.o -MF CMakeFiles/cmTC_bc7f9.dir/src.cxx.o.d -o CMakeFiles/cmTC_bc7f9.dir/src.cxx.o -c /Users/chuxiaoyun/Downloads/dealii-9.0.0/build/CMakeFiles/CMakeScratch/TryCompile-Fscvq9/src.cxx
Linking CXX executable cmTC_bc7f9
/opt/homebrew/Cellar/cmake/3.25.0/bin/cmake -E cmake_link_script CMakeFiles/cmTC_bc7f9.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -mmacosx-version-min=11.6 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_bc7f9.dir/src.cxx.o -o cmTC_bc7f9 -lrt
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_bc7f9] Error 1
make: *** [cmTC_bc7f9/fast] Error 2
CMake Error at cmake/macros/macro_configure_feature.cmake:112 (MESSAGE):
Could not find the p4est library!
Insufficient p4est installation found!
p4est has to be configured with MPI enabled.
Please ensure that a suitable p4est library is installed on your computer.
If the library is not at a default location, either provide some hints for
autodetection,
$ P4EST_DIR="..." cmake <...>
$ cmake -DP4EST_DIR="..." <...>
or set the relevant variables by hand in ccmake.
Call Stack (most recent call first):
cmake/macros/macro_configure_feature.cmake:269 (FEATURE_ERROR_MESSAGE)
cmake/configure/configure_p4est.cmake:78 (CONFIGURE_FEATURE)
cmake/macros/macro_verbose_include.cmake:19 (INCLUDE)
CMakeLists.txt:124 (VERBOSE_INCLUDE)
I guess I haven't installed p4est correctly, so I configure it again.
# p4est-2.8 ./configure --enable-mpi.
( Here shows we are using MPI. I also tried p4est-2.8 ./configure --enable-mpi --prefix=/usr/local)
Then I tried to build and install p4est, but it gives me an error during installation:
# make
# ➜ p4est-2.8 make install
/Applications/Xcode.app/Contents/Developer/usr/bin/make install-recursive
Making install in sc
/Applications/Xcode.app/Contents/Developer/usr/bin/make install-am
build-aux/install-sh -c -d '/Users/xiaoyun/Downloads/p4est-2.8/local/lib'
/bin/sh ./libtool --mode=install /usr/bin/install -c src/libsc.la '/Users/xiaoyun/Downloads/p4est-2.8/local/lib'
libtool: install: /usr/bin/install -c src/.libs/libsc.0.dylib /Users/xiaoyun/Downloads/p4est-2.8/local/lib/libsc.0.dylib
install: /Users/xiaoyun/Downloads/p4est-2.8/local/lib/libsc.0.dylib: Permission denied
make[4]: *** [install-libLTLIBRARIES] Error 71
make[3]: *** [install-am] Error 2
make[2]: *** [install] Error 2
make[1]: *** [install-recursive] Error 1
I have no idea why the permission is denied, I also tried sudo make install:
objc[71909]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x20230f7e8) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10c9082c8). One of the two will be used. Which one is undefined.
objc[71909]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x20230f838) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10c908318). One of the two will be used. Which one is undefined.
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Operation not permitted
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Operation not permitted
make: getcwd: Operation not permitted
make: Nothing to be done for `install'.

failed to install it on Ubuntu 22.04, with gcc-11.2

all:
I successfully configured and built gdal-3.4.3, but failed to install it on Ubuntu 22.04, with gcc-11.2,
My ENV:
➜ ~ uname -r
5.15.0-27-generic
➜ ~ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
➜ ~ gcc --version
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 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.
my installation outcome:
Installing with make install...
========================= Installation results ===========================
/usr/local/bin/cmake -S....../GDAL -B....../GDAL/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start ....../GDAL/build/CMakeFiles ....../GDAL/build//CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '....../GDAL/build'
make -f CMakeFiles/generate_gdal_version_h.dir/build.make CMakeFiles/generate_gdal_version_h.dir/depend
make[2]: Entering directory '....../GDAL/build'
cd ....../GDAL/build && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" ....../GDAL ....../GDAL ....../GDAL/build ....../GDAL/build ....../GDAL/build/CMakeFiles/generate_gdal_version_h.dir/DependInfo.cmake --color=
make[2]: Leaving directory '....../GDAL/build'
make -f CMakeFiles/generate_gdal_version_h.dir/build.make CMakeFiles/generate_gdal_version_h.dir/build
make[2]: Entering directory '....../GDAL/build'
/usr/local/bin/cmake -DSOURCE_DIR=....../GDAL -DBINARY_DIR=....../GDAL/build -DGDAL_SHA1SUM= -DGDAL_RELEASE_DATE= -P ....../GDAL/cmake/helpers/generate_gdal_version_h.cmake
-- Found Git: /usr/bin/git (found version "2.34.1")
CMake Error at ....../GDAL/cmake/helpers/generate_gdal_version_h.cmake:27 (string):
string sub-command SUBSTRING requires four arguments.
make[2]: *** [CMakeFiles/generate_gdal_version_h.dir/build.make:73: CMakeFiles/generate_gdal_version_h] Error 1
make[2]: Leaving directory '....../GDAL/build'
make[1]: *** [CMakeFiles/Makefile2:4367: CMakeFiles/generate_gdal_version_h.dir/all] Error 2
make[1]: Leaving directory '....../GDAL/build'
make: *** [Makefile:149: all] Error 2
**** Installation failed. Aborting package creation.
Restoring overwritten files from backup...OK
Cleaning up...OK
Bye.
Actually, line 27 of file ....../GDAL/cmake/helpers/generate_gdal_version_h.cmake is string(SUBSTRING ${GDAL_GIT_HASH} 0 10 REV), it looks okay to me...
Did anybody meet the same issue?

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.

Unable to use specific compiler in cmake created CodeBlocks project

I have various projects that I need to compile them with different compilers.
So, what I need is an IDE that lets easily allow me to choose/change a target and compile projects for that target.
Another need is to use cmake.
I am now trying CodeBlocks in windows. First I try to add a compiler:
I have set:
Settings->Toolchain executables->Compiler's installation directory->Program Files
Then I create CodeBlocks project with cmake -G "CodeBlocks - MinGW Makefiles"
I open the project in CodeBlocks that is generated by cmake.
I chose compiler in Project Settings.
I build.
Then I discover that compiler in Project Settings is totally ignored! Because it is used the one in CMakeCache.
Thus, I write a script that first set CC and CXX, then run cmake.
With this way I see that CMakeCache has the compiler that I want.
Then I build the project in CodeBlocks.
Now, for g++.exe, the correct compiler is used. However, CodeBlocks insists and insists again to use default MinGW compiler (which is in path) for mingw32-make.exe
Here is the last build output, where D:/Qt/Qt5.4.1/Tools/mingw491_32/bin is default and C:\mingw_x86_64\release7.1.0-posix-dwarf-rt_v5-rev2.7\bin is the correct one.
-------------- Build: 32bit in deneme21 (compiler: MinGW GCC Compiler 32bit)---------------
Checking if target is up-to-date: mingw32-make.exe -q -f Makefile 32bit
Running command: D:/Qt/Qt5.4.1/Tools/mingw491_32/bin/mingw32-make.exe -f "D:/Qt_ws/deneme/deneme31/Makefile" VERBOSE=1 install/strip
C:\CMake3.10.2\win32\bin\cmake.exe -HD:\Qt_ws\deneme\deneme31 -BD:\Qt_ws\deneme\deneme31 --check-build-system CMakeFiles\Makefile.cmake 0
C:\CMake3.10.2\win32\bin\cmake.exe -E cmake_progress_start D:\Qt_ws\deneme\deneme31\CMakeFiles D:\Qt_ws\deneme\deneme31\CMakeFiles\progress.marks
D:/Qt/Qt5.4.1/Tools/mingw491_32/bin/mingw32-make.exe -f CMakeFiles\Makefile2 all
mingw32-make.exe[1]: Entering directory 'D:/Qt_ws/deneme/deneme31'
D:/Qt/Qt5.4.1/Tools/mingw491_32/bin/mingw32-make.exe -f CMakeFiles\deneme21.dir\build.make CMakeFiles/deneme21.dir/depend
mingw32-make.exe[2]: Entering directory 'D:/Qt_ws/deneme/deneme31'
C:\CMake3.10.2\win32\bin\cmake.exe -E cmake_depends "MinGW Makefiles" D:\Qt_ws\deneme\deneme31 D:\Qt_ws\deneme\deneme31 D:\Qt_ws\deneme\deneme31 D:\Qt_ws\deneme\deneme31 D:\Qt_ws\deneme\deneme31\CMakeFiles\deneme21.dir\DependInfo.cmake --color=
mingw32-make.exe[2]: Leaving directory 'D:/Qt_ws/deneme/deneme31'
D:/Qt/Qt5.4.1/Tools/mingw491_32/bin/mingw32-make.exe -f CMakeFiles\deneme21.dir\build.make CMakeFiles/deneme21.dir/build
mingw32-make.exe[2]: Entering directory 'D:/Qt_ws/deneme/deneme31'
[ 50%] Building CXX object CMakeFiles/deneme21.dir/src/foo.cpp.obj
C:\mingw_x86_64\release7.1.0-posix-dwarf-rt_v5-rev2.7\bin\g++.exe #CMakeFiles/deneme21.dir/includes_CXX.rsp -m32 -o CMakeFiles\deneme21.dir\src\foo.cpp.obj -c D:\Qt_ws\deneme\deneme31\src\foo.cpp
[100%] Linking CXX static library libdeneme21.a
C:\CMake3.10.2\win32\bin\cmake.exe -P CMakeFiles\deneme21.dir\cmake_clean_target.cmake
C:\CMake3.10.2\win32\bin\cmake.exe -E cmake_link_script CMakeFiles\deneme21.dir\link.txt --verbose=1
C:\mingw_x86_64\release7.1.0-posix-dwarf-rt_v5-rev2.7\bin\ar.exe qc libdeneme21.a CMakeFiles/deneme21.dir/src/foo.cpp.obj
C:\mingw_x86_64\release7.1.0-posix-dwarf-rt_v5-rev2.7\bin\ranlib.exe libdeneme21.a
mingw32-make.exe[2]: Leaving directory 'D:/Qt_ws/deneme/deneme31'
[100%] Built target deneme21
mingw32-make.exe[1]: Leaving directory 'D:/Qt_ws/deneme/deneme31'
C:\CMake3.10.2\win32\bin\cmake.exe -E cmake_progress_start D:\Qt_ws\deneme\deneme31\CMakeFiles 0
D:/Qt/Qt5.4.1/Tools/mingw491_32/bin/mingw32-make.exe -f CMakeFiles\Makefile2 preinstall
How can I make CodeBlocks use the compiler that I want in cmake created project?

Compile Apache 2.4.6 in Solaris 10 in a SPARC machine (64bits) errors

I've been compiling Httpd 2.4.6 in Solaris 10 in a SPARC machine from last Monday. I get some errors that I have no idea how to fix.
I've successfully compile the Httpd 2.4.6 in Solaris 10 x86, according this article:
Compile Apache 2.4.2 in Solaris 10 in a x86 machine (64bits) errors
I tried several compiler flags, which failed with different errors.
Here is the steps how I did the build:
export PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/xpg4/bin:/usr/sfw/bin:/usr/sfw/sbin:/usr/ccs/bin
#export LDFLAGS=" -L/usr/sfw/lib -R/usr/sfw/lib -L/usr/X/lib -R/usr/X/lib -L/usr/X11/lib -R/usr/X11/lib -L/usr/ccs/lib -R/usr/ccs/lib "
#export LDFLAGS="-L/usr/sfw/lib/sparcv9 -L/usr/lib/sparcv9 -L/usr/sfw/lib -R/usr/sfw/lib -L/usr/X/lib -R/usr/X/lib -L/usr/X11/lib -R/usr/X11/lib -L/usr/ccs/lib -R/usr/ccs/lib "
#export LDFLAGS="-L/usr/local/lib -R/usr/local/lib -R/usr/lib -L/usr/lib -R/usr/openwin/lib -L/usr/openwin/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/local/BerkeleyDB.4.2/lib -R/usr/local/BerkeleyDB.4.2/lib -L/usr/sfw/lib/sparcv9 -L/usr/lib/sparcv9 -L/usr/sfw/lib -R/usr/sfw/lib -L/usr/X/lib -R/usr/X/lib -L/usr/X11/lib -R/usr/X11/lib -L/usr/ccs/lib -R/usr/ccs/lib "
#export LD_LIBRARY_PATH=/usr/lib:/usr/sfw/lib
#export LD_LIBRARY_PATH_64=/usr/lib/64:/usr/sfw/lib/64
#Dont use CC, use GCC! This is VERY important. It wont work otherwise!!
export CC=gcc
#export CFLAGS="-m64 -O3"
export CFLAGS="-m64 -O2 -L/usr/local/lib -R/usr/local/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/openwin/lib -R/usr/openwin/lib -I/usr/local/rrdtool-1.2.19/include -I/usr/local/BerkeleyDB.4.7/include -I/usr/local/include/cairo"
export CPPFLAGS="-m64 -I/usr/local/include -I/usr/local/ssl/include -I/usr/local/include/ncurses -I/usr/openwin/include -I/usr/local/rrdtool-1.2.19/include -I/usr/local/BerkeleyDB.4.7/include -I/usr/local/include/lzo"
export LDFLAGS="-L/usr/local/lib -R/usr/local/lib -R/usr/lib -L/usr/lib -R/usr/openwin/lib -L/usr/openwin/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/X11R6/lib -R/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.7/lib -R/usr/local/BerkeleyDB.4.7/lib"
#export CFLAGS=” -O2 -mcpu=v9 -m64″
#export CPP_FLAGS="-m64 -O3"
#export CPP_FLAGS="-m64 -O3 -I/usr/sfw/include -I/usr/local/include -I/usr/local/ssl/include -I/usr/local/include/ncurses -I/usr/local/BerkeleyDB.4.2/include -I/usr/openwin/include"
#export CPP_FLAGS="-I/usr/sfw/include"
#export CXX_FLAGS="-m64 -O3"
bzip2 -dc apr-1.4.8.tar.bz2 | tar xf -
bzip2 -dc apr-util-1.5.2.tar.bz2 | tar xf -
bzip2 -dc httpd-2.4.6.tar.bz2.tar.bz2.tar.bz2 | tar xf -
mv apr-util-1.5.2/ httpd-2.4.6/srclib/apr-util
mv apr-1.4.8/ httpd-2.4.6/srclib/apr
gzip -dc m4-1.4.17.tar.gz | tar xf -
cd m4-1.4.17
./configure --prefix=/opt/cmtools/m4-1.4.17
gmake
gmake install
gmake clean
gzip -dc autoconf-2.69.tar.gz | tar xf -
cd autoconf-2.69
./configure --prefix=/opt/cmtools/autoconf-2.69 M4=/opt/cmtools/m4-1.4.17/bin/m4
gmake
gmake install
gmake clean
gzip -dc automake-1.13.2.tar.gz | tar xf -
cd automake-1.13.2
./configure --prefix=/opt/cmtools/automake-1.13.2 PATH=/opt/cmtools/autoconf-2.69/bin:$PATH
gmake
gmake install
gmake clean
bzip2 -dc pcre-8.33.tar.bz2 | tar xf -
cd pcre-8.33/
./configure --disable-cpp CFLAGS="-g -O3" CC="gcc -m64" --prefix=/usr/local/pcre
gmake
gmake install
gmake clean
gzip -dc openssl-1.0.1e.tar.gz | tar xf -
cd openssl-1.0.1e
./config --prefix=/usr/local/ssl shared -m32
gmake
gmake install
gmake clean
bzip2 -dc binutils-2.23.2.tar.bz2.tar.bz2.tar.bz2 | tar xf -
cd binutils-2.23.2
./configure --prefix=/opt/cmtools/binutils-2.23.2
gmake
gmake install
gmake clean
cd httpd-2.4.6
./configure --prefix=/usr/local/apache2 \
--enable-mods-shared=all \
--enable-proxy \
--enable-proxy-connect \
--enable-proxy-ftp \
--enable-proxy-http \
--enable-ssl=shared \
--enable-ssl \
--with-ssl=/usr/local/ssl \
--with-mpm=prefork --with-pcre=/usr/local/pcre \
-with-included-apr
gmake
gmake install
gmake clean
The main error that I encountered when tried with different compile flags are:
ld: fatal: file /usr/local/lib/libpcre.so: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to .libs/httpd
collect2: ld returned 1 exit status
gmake[1]: *** [httpd] Error 1
gmake[1]: Leaving directory `/opt/cmtools/soft/httpd-2.4.6'
gmake: *** [all-recursive] Error 1
ld: fatal: file /usr/local/ssl/lib/libssl.so: wrong ELF class: ELFCLASS32
ld: fatal: file /usr/local/ssl/lib/libcrypto.so: wrong ELF class: ELFCLASS32
ld: fatal: File processing errors. No output written to .libs/ab
collect2: ld returned 1 exit status
gmake[2]: *** [ab] Error 1
gmake[2]: Leaving directory `/opt/cmtools/soft/httpd-2.4.6/support'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/opt/cmtools/soft/httpd-2.4.6/support'
gmake: *** [all-recursive] Error 1
Undefined first referenced
symbol in file
TLSv1_2_client_method ab.o
TLSv1_1_client_method ab.o
BIO_set_callback ab.o
BIO_set_callback_arg ab.o
BIO_get_callback_arg ab.o
SSL_CTX_set_info_callback ab.o
ld: fatal: Symbol referencing errors. No output written to .libs/ab
collect2: ld returned 1 exit status
gmake[2]: *** [ab] Error 1
gmake[2]: Leaving directory `/opt/cmtools/soft/httpd-2.4.6/support'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/opt/cmtools/soft/httpd-2.4.6/support'
gmake: *** [all-recursive] Error 1
Here is the system info:
bash-3.00# uname -a
SunOS hegel 5.10 Generic_142909-17 sun4v sparc SUNW,SPARC-Enterprise-T5120
bash-3.00# cat /etc/release
Oracle Solaris 10 9/10 s10s_u9wos_14a SPARC
Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
Assembled 11 August 2010
bash-3.00# isainfo -b
64
Appreciated for any thread for this.
Thanks.
You're building PCRE as a 64-bit library ("-m64"), but trying to build OpenSSL as a 32-bit library ("-m32") and link against that PCRE. That won't work.
Try building OpenSSL as 64-bit.
You may find that you need to edit the OpenSSL "Configure" file to adjust the compiler flags used for your hardware and compiler combination. For instance, if building on Solaris x86 using the Sun Studio compiler, the Configure script includes the "-fast" compiler flag. I found out the hard way that this hurts you when you build on a box with an AMD processor, but plan to use the code on boxes with Intel processors: the "-fast" flag enables all applicable optimizations for your compile box, including things like AMD 3DNow! extensions. Better to edit the Configure file before running it, and substitute "-fast" with architecture optimizations that are sensible for your lowest-common-denominator Intel systems in that case. OpenSSL uses an unusual Configure script that ignores the usual environment variables like CFLAGS, so editing Configure is occasionally necessary.
Also, don't be tempted to do a parallel make ("gmake -j n") with OpenSSL. The Makefile generated by OpenSSL's Configure isn't parallel-safe, and it won't build.