conan-io / conan-center-index

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

[iconv] libiconv/1.15: build failed under windows with clang-cl 11 #20848

Open Evgueni-Petrov-aka-espetrov opened 8 months ago

Evgueni-Petrov-aka-espetrov commented 8 months ago

Description

the following command fails

c:\Users\...\catboost_git\catboost\catboost>conan install . -pr:b clang-cl --build 2>stderr.txt 1>stdout.txt
c:\Users\...\catboost_git\catboost\catboost>type clang-cl
[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=clang
compiler.version=11
build_type=Release
[options]
[build_requires]
[env]
CC=C:\Users\espetrov\Home\scratch\catboost_git\catboost\catboost\build_build\Llvm\x64\bin\clang-cl.exe
CXX=C:\Users\espetrov\Home\scratch\catboost_git\catboost\catboost\build_build\Llvm\x64\bin\clang-cl.exe
LD=C:\Users\espetrov\Home\scratch\catboost_git\catboost\catboost\build_build\Llvm\x64\bin\clang-cl.exe

C:\Users\espetrov\Home\scratch\catboost_git\catboost\catboost\build_build\Llvm is a copy of "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm" to rule out issue with spaces in paths

c:\Users\...\catboost_git\catboost\catboost>type conanfile.txt
[requires]
libiconv/1.15

[options]
libiconv:shared=True

[generators]
cmake_find_package
cmake_paths

Package and Environment Details

Conan profile

[settings] os=Windows os_build=Windows arch=x86_64 arch_build=x86_64 compiler=clang compiler.version=11 compiler.libcxx=libstdc++ build_type=Release [options] [conf] [build_requires] [env]

Steps to reproduce

conan install . -pr:b clang-cl --build 2>stderr.txt 1>stdout.txt

Logs

Click to expand log [conan_stdout.zip](https://github.com/conan-io/conan-center-index/files/13212971/conan_stdout.zip)
SpaceIm commented 8 months ago

I don't see any errors in your log, could you clarify please?

When compiler.runtime is not set, conancenter recipes don't assume that you are using clang-cl but clang mingw. For your case (clang-cl), compiler.runtime & compiler.runtime_type should be set instead of compiler.libcxx (see https://blog.conan.io/2022/10/13/Different-flavors-Clang-compiler-Windows.html).

Evgueni-Petrov-aka-espetrov commented 8 months ago

hmhm, let me double check

Evgueni-Petrov-aka-espetrov commented 8 months ago

i'm sorry for wrong information above - i was trying to get a smaller reproducer, and it went wrong :-\

the whole thing takes place in x64 Native Tools Command Prompt for VS 2019

build fails with multiple errors, the first error message is as follows

/c/users/espetrov/.conan/data/libiconv/1.15/_/_/build/2208196f49362071ecd2491b9a7469a803b18064/src/srclib/lstat.c:67:1: error: conflicting types for ‘rpl_lstat’; have ‘int(const char *, struct _stati64 *)’
   67 | rpl_lstat (const char *file, struct stat *sbuf)
      | ^~~~~~~~~
In file included from /usr/include/time.h:158,
                 from ./time.h:41,
                 from /usr/include/sys/stat.h:9,
                 from ./sys/stat.h:32,
                 from /c/users/espetrov/.conan/data/libiconv/1.15/_/_/build/2208196f49362071ecd2491b9a7469a803b18064/src/srclib/lstat.c:35:
./sys/stat.h:827:1: note: previous declaration of ‘rpl_lstat’ with type ‘int(const char *, struct _stati64 *)’
  827 | _GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
      | ^~~~~~~~~~~~~~~~

cmake launches conan as follows

C:/Users/espetrov/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0/LocalCache/local-packages/Python39/Scripts/conan.exe ^
install C:/Users/espetrov/Home/scratch/catboost_git/catboost/catboost --remote conancenter ^
--install-folder C:/Users/espetrov/Home/scratch/catboost_git/catboost/catboost/build_build --build missing --env ^
CONAN_CMAKE_GENERATOR=Visual Studio 16 2019 --settings build_type=Release --settings compiler=clang --settings ^
compiler.version=11 --settings compiler.cppstd=20 --conf tools.cmake.cmaketoolchain:generator=Visual Studio 16 2019

conanfile.txt

[requires]
libiconv/1.15
openssl/1.1.1t

[tool_requires]
ragel/6.10
swig/4.0.2
yasm/1.3.0

[options]
libiconv:shared=True

[imports]
bin, *swig* -> ./bin
bin, *yasm* -> ./bin
bin, ragel* -> ./bin
bin, ytasm* -> ./bin

[generators]
cmake_find_package
cmake_paths

.conan/profiles/default

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=clang-cl
compiler.version=11
compiler.runtime=dynamic
compiler.runtime_type=Release
build_type=Release
[options]
[build_requires]
[env]

just in case, here is cmake launch

cmake -B build_build -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR_TOOLSET=CLangCl -G "Visual Studio 16 2019" ^
-DCATBOOST_COMPONENTS=app 1> stdout_202311031318.txt 2> stderr_202311031318.txt

here are conan logs conan_output_202311031318.zip

Evgueni-Petrov-aka-espetrov commented 7 months ago

@SpaceIm ping?

SpaceIm commented 7 months ago

See https://github.com/conan-io/conan-center-index/issues/506. You have to explicitly set path to your compiler in your profile (in conf tools.buils.compiler_executables).

Evgueni-Petrov-aka-espetrov commented 7 months ago

@SpaceIm i've added to .conan/profiles/default

[conf]
tools.build:compiler_executables={"c":"clang-cl.exe", "cpp":"clang-cl.exe"}

this setting appears at the top of the build log however, configuring iconv fails with the following error message in config.log

configure:4285: clang-cl.exe -o conftest.exe  -m64 -O3  -DNDEBUG  -m64 conftest.c  >&5
clang-cl: warning: argument unused during compilation: '-O3' [-Wunused-command-line-argument]
conftest.c(15,11): warning: 'fopen' is deprecated: This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
FILE *f = fopen ("conftest.out", "w");
          ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\stdio.h(212,20): note: 'fopen' has been explicitly marked deprecated here
    _Check_return_ _CRT_INSECURE_DEPRECATE(fopen_s)
                   ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vcruntime.h(320,55): note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vcruntime.h(310,47): note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
1 warning generated.
configure:4289: $? = 0
configure:4296: ./conftest.exe
/c/users/espetrov/.conan/data/libiconv/1.15/_/_/build/2208196f49362071ecd2491b9a7469a803b18064/src/configure: line 4298: ./conftest.exe: Permission denied
configure:4300: $? = 126
configure:4307: error: in `/c/Users/espetrov/.conan/data/libiconv/1.15/_/_/build/2208196f49362071ecd2491b9a7469a803b18064/build-release':
configure:4309: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

conan_output_202311101523.zip

SpaceIm commented 7 months ago

/c/users/espetrov/.conan/data/libiconv/1.15///build/2208196f49362071ecd2491b9a7469a803b18064/src/configure: line 4298: ./conftest.exe: Permission denied

You'll have to understand why there is a permission denied here, it may be specific to permission on your machine. You have also to look at config.log content.

Evgueni-Petrov-aka-espetrov commented 7 months ago

/c/users/espetrov/.conan/data/libiconv/1.15///build/2208196f49362071ecd2491b9a7469a803b18064/src/configure: line 4298: ./conftest.exe: Permission denied

You'll have to understand why there is a permission denied here, it may be specific to permission on your machine. You have also to look at config.log content.

here is the config.log -- nothing special there

i do think that, as windows user, i have all necessary permissions since other dependencies of catboost like bzip2, ragel etc. are configured and built successfully

could you please help with debugging iconv build?

config.log

Evgueni-Petrov-aka-espetrov commented 7 months ago

hmhm, on my side i'll check whether there's a problem with antivirus blocking|removing the executable file...