Problem trying to configure and build Ignition Common when installing Gazebo for windows - dll

I am trying to install Gazebo for Windows following this tutorial https://gazebosim.org/tutorials?tut=install_on_windows&cat=install
I have already faced several issues from point 8 in advance, as I had to manually add to "DCMAKE_PREFIX_PATH" in the configure bat files some dependecies as it wasn't able to locate them.
However, I am now in step 10 trying to configure and build Ignition Common, but I get an error when linking.
Here is my configure file:
:: Install dependencies
call %win_lib% :download_unzip_install dlfcn-win32-vc15-x64-dll-MD.zip
call %win_lib% :install_ign_project ign-math ign-math4
:: Set configuration variables
#set build_type=Release
#if not "%1"=="" set build_type=%1
#echo Configuring for build type %build_type%
:: Go to the directory that this configure.bat file exists in
cd /d %~dp0
:: Create a build directory and configure
md build
cd build
cmake .. -G "NMake Makefiles" -DCMAKE_PREFIX_PATH="C:\Users\yimmi\gz-ws\ign-cmake\build\install\Release\lib\cmake;C:\Users\yimmi\gz-ws\ign-math\build\install\Release\lib\cmake\ignition-math4;C:\Users\yimmi\gz-ws\dlfcn-win32-vc15-x64-dll-MD\share\dlfcn-win32" -DCMAKE_INSTALL_PREFIX="%WORKSPACE_INSTALL_DIR%" -DCMAKE_BUILD_TYPE="%build_type%" -DBUILD_TESTING:BOOL=False
:: Note: We disable testing by default. If the intention is for the CI to build and test
:: this project, then the CI script will turn it back on.
:: If the caller wants to build and/or install, they should do so after calling this script
When running it in Visual Studio 2019 Developer Command Prompt i get the following messages
-- The C compiler identification is MSVC 19.29.30141.0
-- The CXX compiler identification is MSVC 19.29.30141.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x86/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- ignition-common1 version 1.1.1
-- Operating system is Windows
--
-- ====== Finding Dependencies ======
-- Looking for ignition-math4 - found
-- Skipping search for tinyxml2 and using an internal version
-- Found DL: TRUE
-- Looking for libdl - found
CMake Warning (dev) at C:/Users/yimmi/gz-ws/ign-cmake/build/install/Release/lib/cmake/ignition-cmake0/cmake0/IgnUtils.cmake:265 (message):
-- THIS MESSAGE IS INTENDED FOR IGNITION-COMMON AUTHORS --
(IF YOU SEE THIS, PLEASE REPORT IT)
Could not find pkg-config information for DL. It was not provided by the
find-module for the package, nor was it explicitly passed into the call to
ign_find_package(~). This is most likely an error in this project's use of
ign-cmake.
Call Stack (most recent call first):
CMakeLists.txt:62 (ign_find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- -------------------------------------------
-- Adding tinyxml2 source files
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
-- Performing Test COMPILER_HAS_DEPRECATED
-- Performing Test COMPILER_HAS_DEPRECATED - Success
-- Testing is disabled -- skipping UNIT tests
-- Build configuration successful
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Build type: Release
-- Install prefix:
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/yimmi/gz-ws/ign-common/build
I think everything worked fine, but then, if I call nmake this is what I get at the end:
[ 97%] Building CXX object src/CMakeFiles/ignition-common1.dir/tinyxml2/tinyxml2.cpp.obj
cl : Línea de comandos warning D9025 : invalidando '/W3' con '/W2'
tinyxml2.cpp
[100%] Linking CXX shared library ignition-common1.dll
LINK: command "C:\PROGRA~2\MICROS~4\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx86\x86\link.exe /nologo #CMakeFiles\ignition-common1.dir\objects1.rsp /out:ignition-common1.dll /implib:ignition-common1.lib /pdb:C:\Users\yimmi\gz-ws\ign-common\build\src\ignition-common1.pdb /dll /version:1.1 /machine:X86 /INCREMENTAL:NO C:\Users\yimmi\gz-ws\ign-math\build\install\Release\lib\ignition-math4.lib C:\Users\yimmi\gz-ws\dlfcn-win32-vc15-x64-dll-MD\lib\dl.lib psapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:ignition-common1.dll.manifest" failed (exit code 1120) with the following output:
Animation.cc.obj : se encontró .netmodule MSIL o un módulo compilado con /GL; reiniciando la vinculación con /LTCG; agregue /LTCG a la línea de comandos de vínculo para mejorar el rendimiento del vinculador
Creando biblioteca ignition-common1.lib y objeto ignition-common1.exp
PluginLoader.cc.obj : error LNK2001: símbolo externo _dlsym sin resolver
PluginLoader.cc.obj : error LNK2001: símbolo externo _dlerror sin resolver
PluginLoader.cc.obj : error LNK2001: símbolo externo _dlopen sin resolver
ignition-common1.dll : fatal error LNK1120: 3 externos sin resolver
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : código devuelto '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\nmake.exe"' : código devuelto '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\nmake.exe"' : código devuelto '0x2'
Stop.
Can anybody help me?
Thank you in advance!

Related

Conan and Raspberry Pico, how to use together?

Good morning!
I'm rewriting this question because, after a lot of reading and try-fails, I go further on that but I get staked again.
What I'm trying to accomplice here is: Use Conan as a Package manager for the embedded device "Raspberry PICO" from my Mac (with CLion)
The change from the previous question is that now I'm creating a package and I do not use only the "standalone" packages manager.
This "package" is on github.com. To install and try to compile it, you will need also the Pico SDK.
Some facts:
The new c++ project without Conan but with SDK is compiling and working on an embedded device.
The Conan project without Pico SDK is compiling correctly.
I really tried every possible configuration on the profile file and there are two mainly configuration profiles that brings to two different errors during build:
The first one is without any environments. This is because on CLion I'm not adding any environment and the project itself (without conan, but oblivious with SDK for pico) is builder correctly.
[settings]
os_build=Macos
arch_build=x86_64
os=Linux
arch=armv7
# os=Macos
# arch=x86_64
# compiler=apple-clang
compiler=gcc
# compiler.version=12.0
compiler.version=9.2
# compiler.libcxx=libc++
compiler.libcxx=libstdc++
build_type=Release
[options]
[build_requires]
[env]
ps. The commented lines are additional tests that resolve on the same result after conan build ..
The error is this:
jure.prah#MacBook-Pro-di-Jure conan-blink-mosfet % conan build .
Using lockfile: '/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/conan.lock'
Using cached profile from lockfile
conanfile.py (blink/0.1): Calling build()
conanfile.py (blink/0.1): CMake command: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/package" "/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/src"
Using PICO_SDK_PATH from environment ('/Users/jure.prah/CLionProjects/pico-sdk')
PICO_SDK_PATH is /Users/jure.prah/CLionProjects/pico-sdk
Defaulting PICO_PLATFORM to rp2040 since not specified.
-- Defaulting build type to 'Release' since not specified.
Using Conan toolchain through /Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/generators/conan_toolchain.cmake.
-- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON (options.fPIC)
-- Conan toolchain: Setting BUILD_SHARED_LIBS= OFF
-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- The ASM compiler identification is Clang
-- Found assembler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Detecting C compiler ABI info
Using Conan toolchain through .
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
Using Conan toolchain through .
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Defaulting PICO target board to pico since not specified.
Using board configuration from /Users/jure.prah/CLionProjects/pico-sdk/src/boards/include/boards/pico.h
-- Found Python3: /usr/local/Frameworks/Python.framework/Versions/3.9/bin/python3.9 (found version "3.9.6") found components: Interpreter
TinyUSB available at /Users/jure.prah/CLionProjects/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; adding USB support.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release
conanfile.py (blink/0.1): CMake command: cmake --build '/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release'
[ 25%] Building CXX object CMakeFiles/blink.dir/blink.cpp.o
[ 50%] Linking CXX static library libblink.a
[ 50%] Built target blink
Scanning dependencies of target bs2_default
[ 75%] Building ASM object pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/compile_time_choice.S.o
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:89:1: error: unknown directive
.syntax unified
^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:90:1: error: unknown directive
.cpu cortex-m0plus
^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:91:1: error: unknown directive
.thumb
^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:93:15: error: unexpected token in '.section' directive
.section .text
^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:101:1: error: unknown directive
.type _stage2_boot,%function
^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:102:1: error: unknown directive
.thumb_func
^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:104:11: error: unknown token in expression
push {lr}
^
[...]
^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:285:1: error: unknown directive
.ltorg
^
make[2]: *** [pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/compile_time_choice.S.o] Error 1
make[1]: *** [pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/all] Error 2
make: *** [all] Error 2
ERROR: conanfile.py (blink/0.1): Error in build() method, line 40
cmake.build()
ConanException: Error 2 while executing cmake --build '/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release'
The second profile configuration is based on the example from conan.com (thanks to #uilianres) and sets the environments.:
toolchain_path=/usr/local/bin
toolchain=arm-none-eabi
[settings]
os_build=Macos
arch_build=x86_64
#os=Macos
#arch=x86_64
os=Linux
arch=armv7
compiler=apple-clang
# compiler=gcc
compiler.version=12.0
# compiler.version=9.2
compiler.libcxx=libc++
# compiler.libcxx=libstdc++
build_type=Release
[options]
[build_requires]
[env]
CONAN_CMAKE_FIND_ROOT_PATH=$toolchain_path/
AR=$toolchain-ar
AS=$toolchain-as
CC=$toolchain-gcc
CXX=$toolchain-g++
STRIP=$toolchain-strip
Using command conan build . resolve on different error:
jure.prah#MacBook-Pro-di-Jure conan-blink-mosfet % conan build .
Using lockfile: '/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/conan.lock'
Using cached profile from lockfile
conanfile.py (blink/0.1): Calling build()
conanfile.py (blink/0.1): CMake command: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/package" "/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/src"
Using PICO_SDK_PATH from environment ('/Users/jure.prah/CLionProjects/pico-sdk')
PICO_SDK_PATH is /Users/jure.prah/CLionProjects/pico-sdk
Defaulting PICO_PLATFORM to rp2040 since not specified.
-- Defaulting build type to 'Release' since not specified.
Using Conan toolchain through /Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/generators/conan_toolchain.cmake.
-- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON (options.fPIC)
-- Conan toolchain: Setting BUILD_SHARED_LIBS= OFF
-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/local/bin/arm-none-eabi-gcc
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - no
-- Detecting C compiler ABI info
Using Conan toolchain through .
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/local/bin/arm-none-eabi-gcc
Using Conan toolchain through .
-- Check for working C compiler: /usr/local/bin/arm-none-eabi-gcc - broken
CMake Error at /usr/local/Cellar/cmake/3.21.0/share/cmake/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"/usr/local/bin/arm-none-eabi-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_69910/fast && /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_69910.dir/build.make CMakeFiles/cmTC_69910.dir/build
Building C object CMakeFiles/cmTC_69910.dir/testCCompiler.c.o
/usr/local/bin/arm-none-eabi-gcc -D_GLIBCXX_USE_CXX11_ABI=0 -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -fPIE -o CMakeFiles/cmTC_69910.dir/testCCompiler.c.o -c /Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_69910
/usr/local/Cellar/cmake/3.21.0/bin/cmake -E cmake_link_script CMakeFiles/cmTC_69910.dir/link.txt --verbose=1
/usr/local/bin/arm-none-eabi-gcc -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_69910.dir/testCCompiler.c.o -o cmTC_69910
/usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol arch_paths_first; defaulting to 0000000000008018
/usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2: error: ld returned 1 exit status
make[1]: *** [cmTC_69910] Error 1
make: *** [cmTC_69910/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:5 (project)
-- Configuring incomplete, errors occurred!
See also "/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release/CMakeFiles/CMakeOutput.log".
See also "/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release/CMakeFiles/CMakeError.log".
ERROR: conanfile.py (blink/0.1): Error in build() method, line 39
cmake.configure()
ConanException: Error 1 while executing cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/package" "/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/src"
Also here I did all the variants and tests, but everything leads to this error. Besides, I checked the toolchain paths and there are correct.
I'm completely lost now. :(

CMake - cannot build OpenCascade from source

I am trying to Build OpenCascade from source.
I am using this guide:
https://github.com/tpaviot/oce/blob/master/BUILD.MINGWw64.md
All the steps from 1-5, which include downloading stuff have been performed.
Now i am trying to build using CMAKE
*I used "Where is the source code" option to point to the directory of the oce (as instructed).
*I used "Where to build the binaries" option, to point the a folder which i named 'BUILD' inside the directory mentioned in the above step (as instructed).
*I pressed 'Configure' and selected "MSYS Makefiles" with default native compilers.
Here started the errors.
I noticed that CMake had produced a text file, so i went inside and changed the CMAKE MAKE location: CMAKE_MAKE_PROGRAM:FILEPATH=C:/Users/User1/Desktop/OPENCA~1/msys/bin
There i moved forward but new errors spawned.
so how do i move forward?
The guide then says:
"
Check OCE_USE_BUNDLE_SOURCE
Check OCE_WITH_FREEIMAGE
Check OCE_WITH_GL2PS
Check OCE_VISUALISATION
"
Where do i set these?
There are no such variables inside the text file, and neither i can set them up on CMAKE.
EDIT:
These are the errors i get now:
The C compiler identification is GNU 8.1.0
The CXX compiler identification is GNU 8.1.0
Detecting C compiler ABI info
CMake Error: Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_a5bfb/fast &&
Detecting C compiler ABI info - failed
Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_d3ad7/fast &&
Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_d3ad7/fast && Access is denied
Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_d3ad7/fast &&
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:20 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeOutput.log".
See also "C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeError.log".
EDIT 2:
There are some null options in CMake:
EDIT 3:
After following the advice of Tsyvarev, i changed the line to
CMAKE_MAKE_PROGRAM:FILEPATH=C:/Users/User1/Desktop/OPENCA~1/msys/bin/make.exe
These are the errors i get:
The C compiler identification is GNU 8.1.0
The CXX compiler identification is GNU 8.1.0
Detecting C compiler ABI info
CMake Error: Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_51dc6/fast &&
Detecting C compiler ABI info - failed
Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_88ba8/fast &&
Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_88ba8/fast && Access is denied
Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_88ba8/fast &&
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:20 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeOutput.log".
See also "C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeError.log".
Here's how I built OpenCascade 7.4.0 (static+shared) from http://www.opencascade.com/content/latest-release under MSYS2 using Ninja:
INSTALLPREFIX=/usr/local
mkdir -p build_static build_shared &&
cmake.exe -Wno-dev -GNinja -DCMAKE_INSTALL_PREFIX:PATH=$INSTALLPREFIX/share/opencascade -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_LIBRARY_TYPE:STRING=Static -DUSE_VTK:BOOL=OFF -DUSE_RAPIDJSON:BOOL=ON -DUSE_FREEIMAGE:BOOL=OFF -DUSE_FFMPEG:BOOL=OFF -DUSE_D3D:BOOL=OFF -DBUILD_RELEASE_DISABLE_EXCEPTIONS:BOOL=ON -DBUILD_USE_PCH:BOOL=OFF -DBUILD_SAMPLES_QT:BOOL=OFF -S. -Bbuild_static &&
cmake.exe -Wno-dev -GNinja -DCMAKE_INSTALL_PREFIX:PATH=$INSTALLPREFIX/share/opencascade -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_LIBRARY_TYPE:STRING=Shared -DUSE_VTK:BOOL=OFF -DUSE_RAPIDJSON:BOOL=ON -DUSE_FREEIMAGE:BOOL=OFF -DUSE_FFMPEG:BOOL=OFF -DUSE_D3D:BOOL=OFF -DBUILD_RELEASE_DISABLE_EXCEPTIONS:BOOL=ON -DBUILD_USE_PCH:BOOL=OFF -DBUILD_SAMPLES_QT:BOOL=OFF -S. -Bbuild_shared &&
sed -i.bak -e "s/LINK_LIBRARIES *= *[^ ]*libTKTopAlgo\.dll\.a.*-lfreetype.*libTKernel\.dll\.a.*$/& -Wl,--as-needed -lz -lbz2 -lharfbuzz -lpng -lbrotlidec/" build_shared/build.ninja &&
ninja -Cbuild_static install/strip &&
ninja -Cbuild_shared install/strip &&
echo Success

CMake path with special symbols

I'm using CLion and whenever I'm working on a project, it can't be in path with special symbols (such as º, ç, ã...), failing with the following message:
The C compiler
"C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe"
is not able to compile a simple test program.
MinGW's make program does not handle non-ASCII characters smoothly. I was able to reproduce this on my machine using a path containing ñ:
The C compiler
"C:/apps/MinGW/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/workspace/peña/build2/CMakeFiles/CMakeTmp
Run Build Command(s):C:/apps/MinGW/bin/mingw32-make.exe cmTC_fe654/fast && C:/apps/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_fe654.dir\build.make CMakeFiles/cmTC_fe654.dir/build
mingw32-make.exe[1]: Entering directory 'C:/workspace/pe±a/build2/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_fe654.dir/testCCompiler.c.obj
C:\apps\MinGW\bin\gcc.exe -o CMakeFiles\cmTC_fe654.dir\testCCompiler.c.obj -c C:\workspace\pe├▒a\build2\CMakeFiles\CMakeTmp\testCCompiler.c
gcc.exe: error: C:\workspace\pe├▒a\build2\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
CMakeFiles\cmTC_fe654.dir\build.make:81: recipe for target 'CMakeFiles/cmTC_fe654.dir/testCCompiler.c.obj' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_fe654.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/workspace/pe±a/build2/CMakeFiles/CMakeTmp'
Makefile:137: recipe for target 'cmTC_fe654/fast' failed
mingw32-make.exe: *** [cmTC_fe654/fast] Error 2
Note, CMake switches to the temporary build directory with the correct path, but when mingw32-make.exe is executing, the path is now garbled:
C:/workspace/pe±a/build2/CMakeFiles/CMakeTmp
The easiest way to avoid this issue is to simply change your project path to be one that does not contain non-ASCII characters.
Another option would be to use a different generator (something other than MinGW Makefiles). For example, Visual Studio configures and builds correctly, even though the non-ASCII characters are in the project path:
> cmake -G"Visual Studio 16 2019" ..
Re-run cmake no build system arguments
C:/workspace/peña
-- The CXX compiler identification is MSVC 19.23.28106.4
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/workspace/peña/build

Having problems with mingw32-make to make googletest

This is my current environment.
Windows 10 64bit, MinGW, CMake 3.15.2, Python 3.7.
I downloaded googletest from https://github.com/google/googletest.
I ran cmake and the following is the output.
C:\googletest-master>cd build
C:\googletest-master\build>cmake ../ -G "MinGW Makefiles"
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: C:/Users/sangjin/AppData/Local/Programs/Python/Python37-32/python.exe (found version "3.7.4")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/googletest-master/build
But when I ran mingw32-make I got the following error message.
C:\googletest-master\build>mingw32-make
Scanning dependencies of target gtest
[ 12%] Building CXX object googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj
In file included from C:\googletest-master\googletest\src\gtest-all.cc:41:
C:/googletest-master/googletest/src/gtest.cc:86:11: fatal error: crtdbg.h: No such file or directory
# include <crtdbg.h> // NOLINT
^~~~~~~~~~
compilation terminated.
googletest\CMakeFiles\gtest.dir\build.make:62: recipe for target 'googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj' failed
mingw32-make[2]: *** [googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj] Error 1
CMakeFiles\Makefile2:171: recipe for target 'googletest/CMakeFiles/gtest.dir/all' failed
mingw32-make[1]: *** [googletest/CMakeFiles/gtest.dir/all] Error 2
Makefile:139: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
C:\googletest-master\build>
Can anyone help me fix this problem.
This version of google test doesn't have that issue, try to build it
https://github.com/google/googletest/tree/216c37f057ae0fff38062984c890df912f40ccf6
Here is a solution for
mingw32-base version 2013072200
mingw32-gcc-g++ version 6.3.0-1
gtest version 1.10.0
In ...\googletest\src\gtest.cc
first at (original) line 86, make header inclusion conditional to MSC toolchain using #ifdef _MSC_VER ... #endif preprocessor macros.
#ifdef _MSC_VER
# include <crtdbg.h> // NOLINT
# include <debugapi.h> // NOLINT
#endif // _MSC_VER
then at (original) line 4913, make assertion redirection also conditional.
#ifdef _MSC_VER
// In debug mode, the Windows CRT can crash with an assertion over invalid
// input (e.g. passing an invalid file descriptor). The default handling
// for these assertions is to pop up a dialog and wait for user input.
// Instead ask the CRT to dump such assertions to stderr non-interactively.
if (!IsDebuggerPresent()) {
(void)_CrtSetReportMode(_CRT_ASSERT,
_CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
(void)_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
}
#endif // _MSC_VER
With theese changes, unit tests build and execute as expected.

CMake building for Windows (clang-cl) using Ninja Generator

I am trying to build a simple application on a Windows machine using CMake as the main build tool. Once CMake is invoked on the project the is an error on configuration phase:
> cmake -H. -G Ninja -Bbuild -DCMAKE_C_COMPILER:PATH="C:\Program Files\LLVM\bin\clang-cl.exe" -DCMAKE_CXX_COMPILER:PATH="C:\Program Files\LLVM\bin\clang-cl.exe"
-- The C compiler identification is Clang 7.0.0
-- The CXX compiler identification is Clang 7.0.0
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang-cl.exe
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang-cl.exe --broken
CMake Error at C:/Program Files/CMake/share/cmake-3.12/Modules/CMakeTestCCompile
r.cmake:52 (message):
The C compiler
"C:/Program Files/LLVM/bin/clang-cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/mak/Desktop/cmake-test/build/CMakeFiles/CMakeTmp
Run Build Command:"C:/Qt/Tools/QtCreator/bin/ninja.exe" "cmTC_f5485"
[1/2] Building C object CMakeFiles\cmTC_f5485.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTC_f5485.exe
FAILED: cmTC_f5485.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_f5485.dir --manifests -- CMAKE_LINKER-NOTFOUND /nologo CMakeFiles\cmTC_f5485.dir\testCCompiler.c.obj /out:cmTC_f5485.exe /implib:cmTC_f5485.lib /pdb:cmTC_f5485.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
RC Pass 1: command "rc /foCMakeFiles\cmTC_f5485.dir/manifest.res CMakeFiles\cmTC_f5485.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the given file
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
I read a lot through the web but my problem was not solved by any proposed solution. What I found so far is a simmilar but maybe outdated solution to the same problem which did not work for me, because Ninja was not able to build the executable:
> ninja all
[1/2] Building CXX object CMakeFiles/minimal.dir/main.cpp.obj
FAILED: CMakeFiles/minimal.dir/main.cpp.obj
C:\PROGRA~1\LLVM\bin\clang-cl.exe -MD -MT CMakeFiles/minimal.dir/main.cpp.obj -MF CMakeFiles\minimal.dir\main.cpp.obj.d -o CMakeFiles/minimal.dir/main.cpp.obj -c ../main.cpp
clang-cl.exe: warning: unknown argument ignored in clang-cl: '-MF' [-Wunknown-argument]
clang-cl.exe: error: no such file or directory: 'CMakeFiles/minimal.dir/main.cpp.obj'
clang-cl.exe: error: no such file or directory: 'CMakeFiles\minimal.dir\main.cpp.obj.d'
ninja: build stopped: subcommand failed.
Before this error CMake configured properly except that all compilers ABI info detection failed - but CMake resumed without error. There are some other questions out there which did not help either.
The official documentation states it is quite simple but in fact it is not.
So: How do I build a simple C++ project using CMake with the Ninja generator and Clang as the compiler? I try to avoid the installation of Visual Studio but it would be great if generated binaries are compatible with MSVC build binaries.
Versions:
CMake 3.12.2
Ninja 1.8.2
Clang 7.0.0
Example: Here is the minial example which I am working with:
CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
project(minimal)
add_executable(${PROJECT_NAME} main.cpp)
main.cpp
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
return 0;
}
To compile with clang-cl, it is necessary to run cmake with MSVC environment loaded (use vcvarsall.bat). Otherwise it tries to use GCC compatibility options.
It is enough to install just the Build Tools.