cmake-conan
cmake-conan copied to clipboard
ubuntu wine msvc cross-compiling windows binary file failed
ubuntu wine msvc dockerfile and cmake's cross tool chain configuration
MY Custom CMakelist.txt ,when I used x86_64-mingw toolchain can crossbuild successful: CMakeLists.txt
build output:
packager@8745ebee5be6:~/cmake-conan-crossbuild/build$ cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../windows-x86_64-msvc.cmake ..
-- The CXX compiler identification is Clang 11.0.0 with MSVC-like command-line
-- Check for working CXX compiler: /usr/bin/clang-cl
-- Check for working CXX compiler: /usr/bin/clang-cl -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Downloading conan.cmake from https://github.com/conan-io/cmake-conan
clang: warning: unknown argument ignored in clang-cl: '-x' [-Wunknown-argument]
clang: warning: unknown argument ignored in clang-cl: '-dM' [-Wunknown-argument]
clang: error: no such file or directory: 'c++'
-- Conan: checking conan executable
-- Conan: Found program /home/packager/.local/bin/conan
-- Conan: Version found Conan version 1.39.0
-- Conan executing: /home/packager/.local/bin/conan install . --remote conan-center --build missing --env CC=/usr/bin/clang-cl --env CXX=/usr/bin/clang-cl --env CFLAGS= --env CXXFLAGS=--target=x86_64-pc-windows-msvc -fms-compatibility /arch:AVX -Xclang -ivfsoverlay -Xclang "/home/packager/.wine/drive_c/Program Files (x86)/Windows Kits/10/Include/vfs_overlay.yaml" /DWIN32 /D_WINDOWS /W3 /GR /EHsc --settings build_type=Debug --settings compiler=clang --settings compiler.version=11 --settings compiler.libcxx=libc++ --settings:host arch=x86_64 --settings:host os=Windows --settings:build build_type=Debug --settings:build compiler=clang --settings:build compiler.version=11 --settings:build compiler.libcxx=libc++ --settings:build arch=x86_64 --settings:build os=Linux
Auto detecting your dev setup to initialize the default profile (/home/packager/.conan/profiles/default)
CC and CXX: None, /usr/bin/clang-cl
Found clang 11.0
clang>=8, using the major as version
Default settings
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=clang
compiler.version=11
compiler.libcxx=libstdc++
build_type=Release
*** You can change them in /home/packager/.conan/profiles/default ***
*** Or override with -s compiler='other' -s ...s***
Configuration (profile_host):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=clang
compiler.libcxx=libc++
compiler.version=11
os=Windows
os_build=Linux
[options]
[build_requires]
[env]
CC=/usr/bin/clang-cl
CFLAGS=
CXX=/usr/bin/clang-cl
CXXFLAGS=--target=x86_64-pc-windows-msvc -fms-compatibility /arch:AVX -Xclang -ivfsoverlay -Xclang "/home/packager/.wine/drive_c/Program Files (x86)/Windows Kits/10/Include/vfs_overlay.yaml" /DWIN32 /D_WINDOWS /W3 /GR /EHsc
Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=clang
compiler.libcxx=libc++
compiler.version=11
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
fmt/7.1.3: Retrieving from server 'conan-center'
fmt/7.1.3: Trying with 'conan-center'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
fmt/7.1.3: Downloaded recipe revision 0
conanfile.txt: Installing package
Requirements
fmt/7.1.3 from 'conan-center' - Downloaded
Packages
fmt/7.1.3:e17123538fdd4f375408fef9c930034774ad2025 - Build
Cross-build from 'Linux:x86_64' to 'Windows:x86_64'
Installing (downloading, building) binaries...
Downloading conan_sources.tgz
fmt/7.1.3: Configuring sources in /home/packager/.conan/data/fmt/7.1.3/_/_/source
fmt/7.1.3: Copying sources to build folder
fmt/7.1.3: Building your package in /home/packager/.conan/data/fmt/7.1.3/_/_/build/e17123538fdd4f375408fef9c930034774ad2025
fmt/7.1.3: Generator cmake created conanbuildinfo.cmake
fmt/7.1.3: Aggregating env generators
fmt/7.1.3: Calling build()
-- The C compiler identification is Clang 11.0.0 with MSVC-like command-line
-- The CXX compiler identification is Clang 11.0.0 with MSVC-like command-line
-- Check for working C compiler: /usr/bin/clang-cl
-- Check for working C compiler: /usr/bin/clang-cl -- broken
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/usr/bin/clang-cl"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/packager/.conan/data/fmt/7.1.3/_/_/build/e17123538fdd4f375408fef9c930034774ad2025/build_subfolder/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_623ff/fast && /usr/bin/make -f CMakeFiles/cmTC_623ff.dir/build.make CMakeFiles/cmTC_623ff.dir/build
make[1]: Entering directory '/home/packager/.conan/data/fmt/7.1.3/_/_/build/e17123538fdd4f375408fef9c930034774ad2025/build_subfolder/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_623ff.dir/testCCompiler.c.obj
/usr/bin/clang-cl /nologo /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 /FoCMakeFiles/cmTC_623ff.dir/testCCompiler.c.obj /FdCMakeFiles/cmTC_623ff.dir/ -c /home/packager/.conan/data/fmt/7.1.3/_/_/build/e17123538fdd4f375408fef9c930034774ad2025/build_subfolder/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_623ff.exe
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_623ff.dir/link.txt --verbose=1
/usr/bin/cmake -E vs_link_exe --intdir=CMakeFiles/cmTC_623ff.dir --rc=/usr/bin/llvm-rc --mt=CMAKE_MT-NOTFOUND --manifests -- /usr/bin/lld-link /nologo @CMakeFiles/cmTC_623ff.dir/objects1.rsp /out:cmTC_623ff.exe /implib:cmTC_623ff.lib /pdb:/home/packager/.conan/data/fmt/7.1.3/_/_/build/e17123538fdd4f375408fef9c930034774ad2025/build_subfolder/CMakeFiles/CMakeTmp/cmTC_623ff.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
LINK Pass 1: command "/usr/bin/lld-link /nologo @CMakeFiles/cmTC_623ff.dir/objects1.rsp /out:cmTC_623ff.exe /implib:cmTC_623ff.lib /pdb:/home/packager/.conan/data/fmt/7.1.3/_/_/build/e17123538fdd4f375408fef9c930034774ad2025/build_subfolder/CMakeFiles/CMakeTmp/cmTC_623ff.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 /MANIFEST /MANIFESTFILE:CMakeFiles/cmTC_623ff.dir/intermediate.manifest CMakeFiles/cmTC_623ff.dir/manifest.res" failed (exit code 1) with the following output:
lld-link: error: could not open 'kernel32.lib': No such file or directory
lld-link: error: could not open 'user32.lib': No such file or directory
lld-link: error: could not open 'gdi32.lib': No such file or directory
lld-link: error: could not open 'winspool.lib': No such file or directory
lld-link: error: could not open 'shell32.lib': No such file or directory
lld-link: error: could not open 'ole32.lib': No such file or directory
lld-link: error: could not open 'oleaut32.lib': No such file or directory
lld-link: error: could not open 'uuid.lib': No such file or directory
lld-link: error: could not open 'comdlg32.lib': No such file or directory
lld-link: error: could not open 'advapi32.lib': No such file or directory
lld-link: error: could not open 'msvcrtd.lib': No such file or directory
lld-link: error: could not open 'oldnames.lib': No such file or directory
make[1]: *** [CMakeFiles/cmTC_623ff.dir/build.make:88: cmTC_623ff.exe] Error 255
make[1]: Leaving directory '/home/packager/.conan/data/fmt/7.1.3/_/_/build/e17123538fdd4f375408fef9c930034774ad2025/build_subfolder/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_623ff/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/home/packager/.conan/data/fmt/7.1.3/_/_/build/e17123538fdd4f375408fef9c930034774ad2025/build_subfolder/CMakeFiles/CMakeOutput.log".
See also "/home/packager/.conan/data/fmt/7.1.3/_/_/build/e17123538fdd4f375408fef9c930034774ad2025/build_subfolder/CMakeFiles/CMakeError.log".
fmt/7.1.3:
WARN: Remotes registry file missing, creating default one in /home/packager/.conan/remotes.json
fmt/7.1.3: ERROR: Package 'e17123538fdd4f375408fef9c930034774ad2025' build failed
fmt/7.1.3: WARN: Build folder /home/packager/.conan/data/fmt/7.1.3/_/_/build/e17123538fdd4f375408fef9c930034774ad2025
ERROR: fmt/7.1.3: Error in build() method, line 63
cmake = self._configure_cmake()
while calling '_configure_cmake', line 56
self._cmake.configure(build_folder=self._build_subfolder)
ConanException: Error 1 while executing cd '/home/packager/.conan/data/fmt/7.1.3/_/_/build/e17123538fdd4f375408fef9c930034774ad2025/build_subfolder' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_SYSTEM_NAME="Windows" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="clang" -DCONAN_COMPILER_VERSION="11" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DCONAN_LIBCXX="libc++" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="/home/packager/.conan/data/fmt/7.1.3/_/_/package/e17123538fdd4f375408fef9c930034774ad2025" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -DFMT_DOC="False" -DFMT_TEST="False" -DFMT_INSTALL="True" -DFMT_LIB_DIR="lib" -Wno-dev '/home/packager/.conan/data/fmt/7.1.3/_/_/build/e17123538fdd4f375408fef9c930034774ad2025'
CMake Error at build/conan.cmake:631 (message):
Conan install failed='1'
Call Stack (most recent call first):
CMakeLists.txt:48 (conan_cmake_install)
-- Configuring incomplete, errors occurred!
See also "/home/packager/cmake-conan-crossbuild/build/CMakeFiles/CMakeOutput.log".
See also "/home/packager/cmake-conan-crossbuild/build/CMakeFiles/CMakeError.log".
Those files are in the file system, these paths are also configured through link_directories in toolchain.cmake, and normal cmake (not including conan.cmake) is normal.
This seems a complicated cross-build scenario, I am not sure I understood correctly: are you saying that this works without cmake-conan (but Conan commands, etc), but fails only with cmake-conan?
You say can crossbuild successful:
but actually in the log I see it failing.
@memsharded
Q: You say can crossbuild successful A: I used x86_64-w64-mingw32 toolchain which another way to cross compile windows bin files can crossbuild this cmake-conan example successful 。
Q:are you saying that this works without cmake-conan (but Conan commands, etc), but fails only with cmake-conan? A: I mean in ubuntu wine microsoft Visual C++ environment ,if I compile helloTest (another test not this one) without including the three-party dependencies, it can be compiled successfully, but this cmake-conan example build failed
Thanks best regards