conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
950 stars 1.73k forks source link

[package] icu/74.2: won't build with msvc17 from within msys2, without MSVC paths pre-setup #23679

Open paulharris opened 5 months ago

paulharris commented 5 months ago

Description

I use msys2 as my shell (git-sdk-64), on my M: I set up a python devenv with a dos prompt first, using Windows python (not msys),

Then in msys terminal, I run . /m/conan4/devenv/Scripts/activate This works with most things - let me know if I should be doing things differently. (I want to build with msvc17 and (in future) clang+msvc)

Now, I have 2 options when running my terminal. I'll just talk about DOS prompts, but I actually use Windows Terminal. 1) I start a plain DOS prompt. Enter bash. ie standard msys startup. 2) I run the MSVC command prompt setup first, and THEN enter bash.

The ICU build works with approach #2, which means the recipe DEPENDS ON the environment of the calling conan command. It SHOULD be using the conan environment setup, like all the other recipes!

So, anyway, without the initial MSVC environment setup, I then run my big conan install for my recipe, and this is what happens when it comes to ICU's build:

see log below

NOTE that it complains, and then asks me to check config.log I checked, the difference is there are MSVC bin paths in the PATH variable in the working example.

Package and Environment Details

Conan profile

======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Debug compiler=msvc compiler.cppstd=20 compiler.runtime=dynamic compiler.runtime_type=Debug compiler.version=193 os=Windows [options] libcurl/:with_ssl=schannel mxrap/:shared=True qt/*:openssl=False [conf] tools.cmake.cmaketoolchain:generator=Ninja

Profile build: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=20 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows [options] libcurl/:with_ssl=schannel qt/:openssl=False [conf] tools.cmake.cmaketoolchain:generator=Ninja

Steps to reproduce

Open MSYS

conan create . --version 74.2 --user test --channel test1 -pr:h theprofileh -pr:b theprofileb

Logs

Click to expand log ``` -------- Installing package icu/74.2 (40 of 68) -------- icu/74.2: Building from source icu/74.2: Package icu/74.2:08facffd46140036be35c6dc82940b177605cc13 icu/74.2: Copying sources to build folder icu/74.2: Building your package in M:\cocache4\cache\b\icuf12bbba6c97ae\b icu/74.2: Calling generate() icu/74.2: Generators folder: M:\cocache4\cache\b\icuf12bbba6c97ae\b\build-debug\conan icu/74.2: Generating aggregated env files icu/74.2: Generated aggregated env files: ['conanbuild.sh', 'conanbuild.bat', 'conanrun.bat'] icu/74.2: Calling build() icu/74.2: Apply patch (file): patches/0001-69.1-fix-mingw.patch icu/74.2: Calling: > "/m/cocache4/cache/b/icuf12bbba6c97ae/b/src/source/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib --includedir=${prefix}/include --oldincludedir=${prefix}/include --datarootdir=${prefix}/lib --enable-release=no --enable-debug=yes --enable-dyload=yes --enable-extras=no --enable-icuio=yes --disable-layoutex --disable-layout --enable-tools=yes --enable-tests=no --disable-samples --with-library-bits=64 icu/74.2: RUN: "/m/cocache4/cache/b/icuf12bbba6c97ae/b/src/source/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib --includedir=${prefix}/include --oldincludedir=${prefix}/include --datarootdir=${prefix}/lib --enable-release=no --enable-debug=yes --enable-dyload=yes --enable-extras=no --enable-icuio=yes --disable-layoutex --disable-layout --enable-tools=yes --enable-tests=no --disable-samples --with-library-bits=64 conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.3 [vcvarsall.bat] Environment initialized for: 'x64' mkdir: cannot create directory ‘/dev/shm’: Read-only file system Creating /dev/shm directory failed. POSIX semaphores and POSIX shared memory will not work mkdir: cannot create directory ‘/dev/mqueue’: Read-only file system Creating /dev/mqueue directory failed. POSIX message queues will not work configure: loading site script /etc/config.site checking for ICU version numbers... release 74.2, library 74.2, unicode version 15.1 checking build system type... x86_64-w64-mingw32 checking host system type... x86_64-w64-mingw32 checking whether to build debug libraries... yes checking whether to build release libraries... no checking whether the C compiler works... no configure: error: in `/m/cocache4/cache/b/icuf12bbba6c97ae/b/build-debug': configure: error: C compiler cannot create executables See `config.log' for more details icu/74.2: ERROR: Package '08facffd46140036be35c6dc82940b177605cc13' build failed icu/74.2: WARN: Build folder M:\cocache4\cache\b\icuf12bbba6c97ae\b\build-debug ERROR: icu/74.2: Error in build() method, line 204 autotools.configure(build_script_folder=os.path.join(self.source_folder, "source")) ConanException: Error 77 while executing ```
paulharris commented 5 months ago

I guess the base question is: Must I always run conan builds from within a terminal with MS vcvars already executed? Or is this something I should expect conan to initialise with each package build step?

paulharris commented 5 months ago

I have managed to get this to build with some changes to the conan source code. I'm making a PR.