Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with conan on MinGW and Cygwin #1224

Closed
clanmills opened this issue May 30, 2020 · 4 comments
Closed

Build with conan on MinGW and Cygwin #1224

clanmills opened this issue May 30, 2020 · 4 comments
Assignees
Labels
request feature request or any other kind of wish

Comments

@clanmills
Copy link
Collaborator

I've documented conan/MinGW and conan/Cygwin as "unsupported" however, it's desirable to get this working. I do not believe there's much wrong.

On both MinGW and Cygwin, conan install .. dies when building expat from Expat/2.2.6@pix4d/stable. I believe Expat 2.2.9 is available. Perhaps all that needed is to get Expat from bin crafters instead of pix4d.

One other comment about this. I'd like to put something in README.md about choosing a particular version of a library. The only way I know is to modify conanfile.py. Is that correct, or is there a conan command-line option to override the values in conanfile.py?

178 CYGWIN rmills@rmillsmm-w10:/cygdrive/c/temp $ conan --version
Conan version 1.25.2
179 CYGWIN rmills@rmillsmm-w10:/cygdrive/c/temp $ mkdir -p ~/.conan/profiles
180 CYGWIN rmills@rmillsmm-w10:/cygdrive/c/temp $ cp /cygdrive/c/msys64/home/rmills/.conan/profiles/default ~/.conan/profiles/
181 CYGWIN rmills@rmillsmm-w10:/cygdrive/c/temp $ cd ~/gnu/github/exiv2/0.27-maintenance/
182 CYGWIN rmills@rmillsmm-w10:~/gnu/github/exiv2/0.27-maintenance $ rm -rf build ; mkdir build ; cd build
183 CYGWIN rmills@rmillsmm-w10:~/gnu/github/exiv2/0.27-maintenance/build $ conan install .. --build missing
WARN: Remotes registry file missing, creating default one in /home/rmills/.conan/remotes.json
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=7.4
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

zlib/1.2.11@conan/stable: Not found in local cache, looking in remotes...
zlib/1.2.11@conan/stable: Trying with 'conan-center'...
Downloading conanmanifest.txt completed [0.29k]
Downloading conanfile.py completed [8.74k]
Downloading conan_export.tgz completed [0.75k]
Decompressing conan_export.tgz completed [0.00k]
zlib/1.2.11@conan/stable: Downloaded recipe revision 0
gtest/1.8.1@bincrafters/stable: Not found in local cache, looking in remotes...
gtest/1.8.1@bincrafters/stable: Trying with 'conan-center'...
Downloading conanmanifest.txt completed [0.35k]
Downloading conanfile.py completed [4.04k]
Downloading conan_export.tgz completed [0.74k]
Decompressing conan_export.tgz completed [0.00k]
gtest/1.8.1@bincrafters/stable: Downloaded recipe revision 0
Expat/2.2.6@pix4d/stable: Not found in local cache, looking in remotes...
Expat/2.2.6@pix4d/stable: Trying with 'conan-center'...
Downloading conanmanifest.txt completed [0.06k]
Downloading conanfile.py completed [2.32k]
Expat/2.2.6@pix4d/stable: Downloaded recipe revision 0
conanfile.py: Installing package
Requirements
    Expat/2.2.6@pix4d/stable from 'conan-center' - Downloaded
    gtest/1.8.1@bincrafters/stable from 'conan-center' - Downloaded
    zlib/1.2.11@conan/stable from 'conan-center' - Downloaded
Packages
    Expat/2.2.6@pix4d/stable:0e4a4a07e6e14395689cb75f8c4aa10d823ef6ec - Build
    gtest/1.8.1@bincrafters/stable:1c2aa22f809d15d8acc6ccaf40aeace3ce6b2fb9 - Build
    zlib/1.2.11@conan/stable:dde8c9806fd70dcbba38b475531e2020efa1e6c0 - Build

Installing (downloading, building) binaries...
Expat/2.2.6@pix4d/stable: Configuring sources in /home/rmills/.conan/data/Expat/2.2.6/pix4d/stable/source
Cloning into 'libexpat'...
Note: switching to '39e487da353b20bb3a724311d179ba0fddffc65b'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

Expat/2.2.6@pix4d/stable: Copying sources to build folder
Expat/2.2.6@pix4d/stable: Building your package in /home/rmills/.conan/data/Expat/2.2.6/pix4d/stable/build/0e4a4a07e6e14395689cb75f8c4aa10d823ef6ec
Expat/2.2.6@pix4d/stable: Generator cmake created conanbuildinfo.cmake
Expat/2.2.6@pix4d/stable: Calling build()
CMake Error: Could not create named generator MinGW Makefiles

Generators
* Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.

Expat/2.2.6@pix4d/stable:
Expat/2.2.6@pix4d/stable: ERROR: Package '0e4a4a07e6e14395689cb75f8c4aa10d823ef6ec' build failed
Expat/2.2.6@pix4d/stable: WARN: Build folder /home/rmills/.conan/data/Expat/2.2.6/pix4d/stable/build/0e4a4a07e6e14395689cb75f8c4aa10d823ef6ec
ERROR: Expat/2.2.6@pix4d/stable: Error in build() method, line 45
        cmake.configure(source_dir="../libexpat/expat", build_dir="build", defs=cmake_args)
        ConanException: Error 1 while executing cd 'build' && cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="7.4" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="/home/rmills/.conan/data/Expat/2.2.6/pix4d/stable/package/0e4a4a07e6e14395689cb75f8c4aa10d823ef6ec" -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" -Wno-dev -DBUILD_doc="OFF" -DBUILD_examples="OFF" -DBUILD_shared="False" -DBUILD_tests="OFF" -DBUILD_tools="OFF" -DCMAKE_POSITION_INDEPENDENT_CODE="ON" -DCMAKE_DEBUG_POSTFIX="" -DMSVC_USE_STATIC_CRT="False" '../libexpat/expat'
184 CYGWIN rmills@rmillsmm-w10:~/gnu/github/exiv2/0.27-maintenance/build $
@clanmills clanmills added the request feature request or any other kind of wish label May 30, 2020
@clanmills clanmills added this to the v0.27.3 milestone May 30, 2020
@clanmills clanmills removed this from the v0.27.3 milestone May 30, 2020
@clanmills
Copy link
Collaborator Author

On both platforms, conan is trying to build with the -G "MinGW Makefiles". The platform provided cmake (as documented in README.md) does not provide that generator. I've tried to build cmake-3.17.2. Both platforms (with GCC 9.3) fail in the bootstrap saying:

loading initial cache file /home/rmills/gnu/cmake/cmake-3.17.2/Bootstrap.cmk/InitialCacheFlags.cmake
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/gcc.exe
-- Check for working C compiler: /usr/bin/gcc.exe - broken
CMake Error at Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/usr/bin/gcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/rmills/gnu/cmake/cmake-3.17.2/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make.exe cmTC_a2c57/fast && make  -f CMakeFiles/cmTC_a2c57.dir/build.make CMakeFiles/cmTC_a2c57.dir/build
    make[1]: Entering directory '/home/rmills/gnu/cmake/cmake-3.17.2/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_a2c57.dir/testCCompiler.c.o
    /usr/bin/gcc.exe    -o CMakeFiles/cmTC_a2c57.dir/testCCompiler.c.o   -c /home/rmills/gnu/cmake/cmake-3.17.2/CMakeFiles/CMakeTmp/testCCompiler.c
    gcc: error: /home/rmills/gnu/cmake/cmake-3.17.2/CMakeFiles/CMakeTmp/testCCompiler.c: No such file or directory
    gcc: fatal error: no input files

He's mad of course. The reason it doesn't compile is because the he didn't create the c file:

    gcc: error: /home/rmills/gnu/cmake/cmake-3.17.2/CMakeFiles/CMakeTmp/testCCompiler.c: No such file or directory

So, I helped him with:

$ cp Tests/TryCompile/testdef.c /home/rmills/gnu/cmake/cmake-3.17.2/CMakeFiles/CMakeTmp/testCCompiler.c
$ ./bootstrap
$ make
$ make install

I wonder if there's a method in conan to specify the Generator.

@clanmills
Copy link
Collaborator Author

clanmills commented May 30, 2020

Cannot build cmake3.17.2 on MinGW.

/home/rmills/gnu/cmake/cmake-3.17.2/Source/kwsys/ProcessWin32.c: In function 'kwsysProcessCleanup':
/home/rmills/gnu/cmake/cmake-3.17.2/Source/kwsys/ProcessWin32.c:1875:9: warning: implicit declaration of function '_snprintf'; did you mean 'asnprintf'? [-Wimplicit-function-declaration]
         _snprintf(cp->ErrorMessage, KWSYSPE_PIPE_BUFFER_SIZE,
         ^~~~~~~~~
         asnprintf
make: *** [Makefile:432: ProcessWin32.o] Error 1
---------------------------------------------
Error when bootstrapping CMake:
Problem while running make
---------------------------------------------
Log of errors: /home/rmills/gnu/cmake/cmake-3.17.2/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
370 MSYS rmills@rmillsmm-w10:~/gnu/cmake/cmake-3.17.2 $

I got cmake 3.17.2 to build on Cygwin. I saw it compile the MinGW generator files. However, cmake doesn't have that generator.

I don't think conan should use the Generator "MinGW Makefiles". Read this:
https://gitlab.kitware.com/cmake/cmake/-/issues/17376

Cygwin and MinGW and conan are not in a working state at this time.

@clanmills
Copy link
Collaborator Author

See: #1353 and #1356 (comment) concerning mingw-w64-x86_64-toolchain

I haven't been able to build cmake from source with the mingw-w64-x86_64-toolchain.

I haven't succeeded in building Exiv2 on MinGW/msys2 using conan. I've made several discoveries:

  1. Install pip with $ echo y | pacman -S mingw-w64-x86_64-python3-pip
  2. The conan profiles are stored in $USERPROFILE/.conan/profiles
    For me, Windows sets %USERPROFILE% to c:\Users\rmills\ and MinGW/msys2 bash inherits. So conan uses the same shared profiles with Visual Studio. The default profile is Visual Studio.
  3. The command $ conan install .. --profile <gcc-profile> --build missing downloads code and dies instantly when it calls cmake to create the build environment for libexpat.

@clanmills
Copy link
Collaborator Author

I'm going to close this. I implemented CI build on Cygwin/64 and MinGW/msys without Conan. #1434. This is discussed in README.md. The challenges of using conan on those platforms is not an Exiv2 issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request feature request or any other kind of wish
Projects
None yet
Development

No branches or pull requests

2 participants