conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.14k stars 970 forks source link

[question] Cygwin and include paths #5526

Open selassje opened 5 years ago

selassje commented 5 years ago

Hi,

I want to build the gtest package using cygwin with the following comand:

conan install -s arch=x86_64 -s os.subsystem=cygwin -s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=7 "../.." --build missing

I get the following error source_subfolder/src/gtest-all.cc:39:10: fatal error: gtest/gtest.h: No such file or directory

I believe the include paths are were not set correctly. Excerpt from flags.make:

CXX_INCLUDES = -IC:/cygwin64/home/User/.conan/data/gtest/1.7.0/bincrafters/stable/build/0d5c2358ea4208b7cb217c633ff8e47b2a094256/source_subfolder/C:/cygwin64/home/User/.conan/data/gtest/1.7.0/bincrafters/stable/build/0d5c2358ea4208b7cb217c633ff8e47b2a094256/source_subfolder/include -IC:/cygwin64/home/User/

When I build the package manually(using the downloaded gtest CMakefiles.txt) the include paths are set correctly:

CXX_INCLUDES = -I/home/User/.conan/data/gtest/1.7.0/bincrafters/stable/build/0d5c2358ea4208b7cb217c633ff8e47b2a094256/source_subfolder/include -I/home/User/.conan/data/gtest/1.7.0/bincrafters/stable/build/0d5c2358ea4208b7cb217c633ff8e47b2a094256/source_subfolder

Am I missing some option in the install command? I'm using conan 1.12 + cmake 3.6.2 on cygwin

selassje commented 5 years ago

Also, I am using export CONAN_CMAKE_GENERATOR="Unix Makefiles" as Conan chose MinGw generator on its own

memsharded commented 5 years ago

Hi @selassje

It seems it could be that something is not correctly managed for the Cygwin platform in this case. First thing, I would try to update to Conan 1.17 if possible, there has been quite a few improvements and fixes since 1.12, and that would help.

Then, I understand that you are using your own conanfile that depends on gtest 1.7.0 package.

Please tell if you are able to test with Conan 1.17, I will assign this to @SSE4 to help investigating the issue. Thanks!

selassje commented 5 years ago

Hi,

I installed 1.17, but it didn't help. For now, I am using MSYS instead.

Regards

SSE4 commented 5 years ago

reproduced via default profile:

[settings]
os=Windows
os.subsystem=cygwin
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=7
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
CONAN_CMAKE_GENERATOR=Unix Makefiles

conanfile.txt:

[requires]
gtest/1.7.0@bincrafters/stable

command line: conan install . --build missing

SSE4 commented 5 years ago

seems like there is a difference between running cmake from conan and directly from the cygwin shell: same CMake command run in plain cygwin shell works well:

#!/usr/bin/env bash

set -e

rm -rf build
mkdir build
pushd build

cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCONAN_EXPORTED="1" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="7" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DCONAN_LIBCXX="libstdc++11" -DBUILD_SHARED_LIBS="True" -DCMAKE_INSTALL_PREFIX="C:\cygwin64\home\sse4\.conan\data\gtest\1.7.0\bincrafters\stable\package\0d5c2358ea4208b7cb217c633ff8e47b2a094256" -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" -Dgtest_force_shared_crt="True" -Wno-dev ..

cmake --build .

popd
SSE4 commented 5 years ago

yeah, it seems to be a problem that python and conan are not from the cygwin subsystem:

$ which python
/cygdrive/c/Users/sse4/AppData/Local/Programs/Python/Python37/python
$ which conan
/cygdrive/c/Users/sse4/AppData/Local/Programs/Python/Python37/Scripts/conan
SSE4 commented 5 years ago

switching to conan/python from the cygwin fixes the problem but I think we should work in both cases

selassje commented 5 years ago

ok, thanks - I will try switching to cygwins' python

On Wed, Jul 24, 2019 at 12:32 PM SSE4 notifications@github.com wrote:

switching to conan/python from the cygwin fixes the problem but I think we should work in both cases

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/conan-io/conan/issues/5526?email_source=notifications&email_token=AKFUUT574T6OEFLLY2QXPYLQBAVU5A5CNFSM4IF5FC32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2V5IUI#issuecomment-514577489, or mute the thread https://github.com/notifications/unsubscribe-auth/AKFUUT6BLDKMEU4UPA6QFFDQBAVU5ANCNFSM4IF5FC3Q .