Open yowidin opened 1 year ago
I would say it's not a libiconv recipe bug, but a conan client bug. Ask to conan team why they have rejected https://github.com/conan-io/conan/pull/12194. As you have noticed, it would be impractical to fix all Autotools based recipes in order to fix a conan client issue.
Usually, you can be confident that when you have to write such micro management of specific profiles in build helpers for all recipes, it is likely the consequence of a conan client bug, not a recipe bug.
Description
It's both a bug report and a conceptual question. While trying to build
libiconv
for Android on Windows, I've stumbled upon a potential issue with theAutotoolsToolchain
: paths handling (see the steps to reproduce section).The fix is relatively easy: wrap the compiler paths in a
unix_path
call. The problem I see with this approach is that where are a lot of recipes, doing the same thing over and over again, and some of them forget to do that. So my suggestion is to somehow add that functionality to theAutotoolsToolchain
.Package and Environment Details
Conan profile
Steps to reproduce
You will need an Android profile, e.g.:
Running this under the Windows
Command Prompt
Will result in the attached logs. As you can see the path to the compiler is not passed down correctly (
\
vs/
for MSYS). Applying the following patch, solves the issue:Click to expand path file
```diff diff --git a/recipes/libiconv/all/conanfile.py b/recipes/libiconv/all/conanfile.py index 544fb2b4a..013a74d1b 100644 --- a/recipes/libiconv/all/conanfile.py +++ b/recipes/libiconv/all/conanfile.py @@ -117,6 +117,18 @@ class LibiconvConan(ConanFile): env.define("RANLIB", ":") env.define("NM", "dumpbin -symbols") env.define("win32_target", "_WIN32_WINNT_VISTA") + + if cross_building(self) and self.win_bash: + compilers = self.conf.get("tools.build:compiler_executables", default={}, check_type=dict) + if compilers: + build_aux_path = os.path.join(self.source_folder, "build-aux") + lt_compile = unix_path(self, os.path.join(build_aux_path, "compile")) + if 'c' in compilers: + env.define("CC", f"{lt_compile} {unix_path(self, compilers['c'])}") + + if 'cpp' in compilers: + env.define("CXX", f"{lt_compile} {unix_path(self, compilers['cpp'])}") + tc.generate(env) def build(self): ```Logs
Click to expand log
``` Microsoft Windows [Version 10.0.19045.2728] (c) Microsoft Corporation. All rights reserved. C:\Users\YoWiDiN>cd conan-center-index\recipes\libiconv\all C:\Users\YoWiDiN\conan-center-index\recipes\libiconv\all>conan create -pr:h ./android -pr:b default . --version 1.17 ======== Exporting recipe to the cache ======== libiconv/1.17: Exporting package recipe: C:\Users\YoWiDiN\conan-center-index\recipes\libiconv\all\conanfile.py libiconv/1.17: exports: File 'conandata.yml' found. Exporting it... libiconv/1.17: Calling export_sources() libiconv/1.17: Copied 1 '.yml' file: conandata.yml libiconv/1.17: Copied 1 '.py' file: conanfile.py libiconv/1.17: Exported to cache folder: C:\Users\YoWiDiN\.conan2\p\libica01fb8516e93b\e libiconv/1.17: Exported: libiconv/1.17#80da49fca2bee7160307d39a19feff20 (2023-04-20 18:01:13 UTC) ======== Input profiles ======== Profile host: [settings] arch=armv7 build_type=Release compiler=clang compiler.cppstd=17 compiler.libcxx=c++_static compiler.runtime=dynamic compiler.version=9 os=Android os.api_level=19 [tool_requires] *: android-ndk/r25c [conf] Profile build: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=192 os=Windows [conf] ======== Computing dependency graph ======== Graph root cli Requirements libiconv/1.17#80da49fca2bee7160307d39a19feff20 - Cache Build requirements android-ndk/r25c#1074190db41752676a64dd472d274a86 - Cache msys2/cci.latest#567331f1604f3c584f04feade960f06e - Cache ======== Computing necessary packages ======== libiconv/1.17: Forced build from source Requirements libiconv/1.17#80da49fca2bee7160307d39a19feff20:0ac119fce722e07914030f75b0123da5f4c6eaed - Build Build requirements android-ndk/r25c#1074190db41752676a64dd472d274a86:522dcea5982a3f8a5b624c16477e47195da2f84f#d95ca3a4f5fee72bf8932f87e9feaaf6 - Cache msys2/cci.latest#567331f1604f3c584f04feade960f06e:956a88975bda9dfcc485e2861d71e74bd7e2b9a5#ce3addef73068ed1ad9ca9976b2d50c1 - Cache ======== Installing packages ======== android-ndk/r25c: Already installed! (1 of 3) msys2/cci.latest: Already installed! (2 of 3) -------- Installing package libiconv/1.17 (3 of 3) -------- libiconv/1.17: Building from source libiconv/1.17: Package libiconv/1.17:0ac119fce722e07914030f75b0123da5f4c6eaed libiconv/1.17: Copying sources to build folder libiconv/1.17: Building your package in C:\Users\YoWiDiN\.conan2\p\t\libice4f4c75f72f6c\b libiconv/1.17: Calling generate() libiconv/1.17: Generators folder: C:\Users\YoWiDiN\.conan2\p\t\libice4f4c75f72f6c\b\build-release\conan libiconv/1.17: Generating aggregated env files libiconv/1.17: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh'] libiconv/1.17: Calling build() libiconv/1.17: Calling: > "/c/users/yowidin/.conan2/p/t/libice4f4c75f72f6c/b/src/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib --includedir=${prefix}/include --oldincludedir=${prefix}/include --host=arm-linux-androideabi --build=x86_64-unknown-windows libiconv/1.17: RUN: "/c/users/yowidin/.conan2/p/t/libice4f4c75f72f6c/b/src/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib --includedir=${prefix}/include --oldincludedir=${prefix}/include --host=arm-linux-androideabi --build=x86_64-unknown-windows configure: loading site script /etc/config.site checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for arm-linux-androideabi-strip... /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe checking for a race-free mkdir -p... /c/users/yowidin/.conan2/p/msys27027d02bfdf83/p/bin/msys64/usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether make sets $(MAKE)... (cached) yes checking for arm-linux-androideabi-gcc... C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... yes checking for suffix of object files... o checking whether the compiler supports GNU C... yes checking whether C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd accepts -g... yes checking for C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd option to enable C11 features... none needed checking whether C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd understands -c and -o together... yes checking whether the compiler is clang... yes checking for compiler option needed when checking for declarations... -Werror=implicit-function-declaration checking whether make supports the include directive... yes (GNU style) checking dependency style of C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd... none checking how to run the C preprocessor... C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd -E checking for strip... /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe checking for arm-linux-androideabi-strip... (cached) /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe checking build system type... x86_64-unknown-windows checking host system type... arm-unknown-linux-androideabi checking for stdio.h... yes checking for stdlib.h... yes checking for string.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for strings.h... yes checking for sys/stat.h... yes checking for sys/types.h... yes checking for unistd.h... yes checking for wchar.h... yes checking for minix/config.h... no checking for sys/param.h... yes checking for sys/socket.h... yes checking for limits.h... yes checking for sys/time.h... yes checking for features.h... yes checking for crtdefs.h... no checking whether it is safe to define __EXTENSIONS__... yes checking whether _XOPEN_SOURCE should be defined... no checking for grep that handles long lines and -e... /c/users/yowidin/.conan2/p/msys27027d02bfdf83/p/bin/msys64/usr/bin/grep checking for egrep... /c/users/yowidin/.conan2/p/msys27027d02bfdf83/p/bin/msys64/usr/bin/grep -E checking for Minix Amsterdam compiler... no checking for arm-linux-androideabi-ar... /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar.exe checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... 64 checking for time_t past the year 2038... no checking for 64-bit time_t with _TIME_BITS=64... no configure: WARNING: The 'time_t' type stops working after January 2038, and this package needs a wider 'time_t' type if there is any way to access timestamps after that. Configure with 'CC="C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd -m64"' perhaps? checking how to print strings... printf checking for a sed that does not truncate output... /c/users/yowidin/.conan2/p/msys27027d02bfdf83/p/bin/msys64/usr/bin/sed checking for fgrep... /c/users/yowidin/.conan2/p/msys27027d02bfdf83/p/bin/msys64/usr/bin/grep -F checking for ld used by C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd... /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/ld.exe checking if the linker (/c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/ld.exe) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-nm.exe checking the name lister (/c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-nm.exe) interface... BSD nm checking whether ln -s works... no, using cp -pR checking the maximum length of command line arguments... 24000 checking how to convert x86_64-unknown-windows file names to arm-unknown-linux-androideabi format... func_convert_file_noop checking how to convert x86_64-unknown-windows file names to toolchain format... func_convert_file_noop checking for /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/ld.exe option to reload object files... -r checking for arm-linux-androideabi-file... no checking for file... file configure: WARNING: using cross tools not prefixed with host triplet checking for arm-linux-androideabi-objdump... /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-objdump.exe checking how to recognize dependent libraries... pass_all checking for arm-linux-androideabi-dlltool... no checking for dlltool... dlltool checking how to associate runtime and link libraries... printf %s\n checking for arm-linux-androideabi-ar... (cached) /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar.exe checking for archiver @FILE support... @ checking for arm-linux-androideabi-strip... (cached) /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe checking for arm-linux-androideabi-ranlib... /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ranlib.exe checking command to parse /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-nm.exe output from C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd object... ok checking for sysroot... no checking for a working dd... /c/users/yowidin/.conan2/p/msys27027d02bfdf83/p/bin/msys64/usr/bin/dd checking how to truncate binary pipes... /c/users/yowidin/.conan2/p/msys27027d02bfdf83/p/bin/msys64/usr/bin/dd bs=4096 count=1 checking for arm-linux-androideabi-mt... no checking for mt... no checking if : is a manifest tool... no checking for dlfcn.h... yes checking for objdir... .libs checking if C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd supports -fno-rtti -fno-exceptions... yes checking for C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd option to produce PIC... -fPIC -DPIC checking if C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd PIC flag -fPIC -DPIC works... yes checking if C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd static flag -static works... yes checking if C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd supports -c -o file.o... yes checking if C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd supports -c -o file.o... (cached) yes checking whether the C:\Users\YoWiDiN\.conan2\p\androbb5d385741533\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.cmd linker (/c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/ld.exe) supports shared libraries... yes checking dynamic linker characteristics... Android linker checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... no checking whether to build static libraries... yes checking for ld... /c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/ld.exe checking if the linker (/c/users/yowidin/.conan2/p/androbb5d385741533/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/ld.exe) is GNU ld... yes checking for shared library path variable... LD_LIBRARY_PATH checking whether to activate relocatable installation... no checking how to copy files... cp -p checking how to make hard links... ln checking whether ln -s works... no, using cp -pR checking for arm-linux-androideabi-windres... no checking for windres... windres checking whether the -Werror option is usable... yes checking for simple visibility declarations... yes checking for shared library run path origin... done checking 32-bit host C ABI... yes checking for ELF binary format... yes checking for the common suffixes of directories in the library search path... lib,lib,lib checking for iconv... no, consider installing GNU libiconv checking whether NLS is requested... yes checking for msgfmt... /c/users/yowidin/.conan2/p/msys27027d02bfdf83/p/bin/msys64/usr/bin/msgfmt checking for gmsgfmt... /c/users/yowidin/.conan2/p/msys27027d02bfdf83/p/bin/msys64/usr/bin/msgfmt checking for xgettext... /c/users/yowidin/.conan2/p/msys27027d02bfdf83/p/bin/msys64/usr/bin/xgettext checking for msgmerge... /c/users/yowidin/.conan2/p/msys27027d02bfdf83/p/bin/msys64/usr/bin/msgmerge checking for CFPreferencesCopyAppValue... no checking for CFLocaleCopyPreferredLanguages... no checking for GNU gettext in libc... no checking for iconv... (cached) no, consider installing GNU libiconv checking for GNU gettext in libintl... no checking whether to use NLS... no checking for mbstate_t... yes checking for wchar_t... yes checking for getc_unlocked... yes checking for mbrtowc... yes checking for wcrtomb... yes checking for mbsinit... yes checking for setlocale... yes checking whetherThe most interesting part: