conan-io / conan-center-index

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

[package] icu/69.1: cross-build to iOS fails #6648

Closed SpaceIm closed 3 years ago

SpaceIm commented 3 years ago

Package and Environment Details (include every applicable attribute)

Conan profile (output of conan profile show default or conan profile show <profile> if custom profile is in use)

profile-build

[settings]
os=Macos
arch=x86_64
compiler=apple-clang
compiler.version=12.0
compiler.libcxx=libc++
build_type=Release
[options]
[build_requires]
[env]

profile-host

[settings]
os=iOS
os.version=12.0
arch=armv8
compiler=apple-clang
compiler.version=12.0
compiler.libcxx=libc++
build_type=Release
[options]
[build_requires]
[env]

Steps to reproduce (Include if Applicable)

conan install icu/69.1@ -pr:b profile-build -pr:h profile-host -b missing

Logs (Include/Attach if Applicable)

Click to expand log ``` [HOOK - conan-center.py] pre_export(): [DEPRECATED GLOBAL CPPSTD (KB-H001)] OK [HOOK - conan-center.py] pre_export(): [REFERENCE LOWERCASE (KB-H002)] OK [HOOK - conan-center.py] pre_export(): [RECIPE METADATA (KB-H003)] OK [HOOK - conan-center.py] pre_export(): [HEADER_ONLY, NO COPY SOURCE (KB-H005)] OK [HOOK - conan-center.py] pre_export(): [FPIC OPTION (KB-H006)] OK [HOOK - conan-center.py] pre_export(): [VERSION RANGES (KB-H008)] OK [HOOK - conan-center.py] pre_export(): [RECIPE FOLDER SIZE (KB-H009)] Total recipe size: 47.5419921875 KB [HOOK - conan-center.py] pre_export(): [RECIPE FOLDER SIZE (KB-H009)] OK [HOOK - conan-center.py] pre_export(): [EXPORT LICENSE (KB-H023)] exports: None [HOOK - conan-center.py] pre_export(): [EXPORT LICENSE (KB-H023)] exports: patches/*.patch [HOOK - conan-center.py] pre_export(): [EXPORT LICENSE (KB-H023)] OK [HOOK - conan-center.py] pre_export(): [TEST PACKAGE FOLDER (KB-H024)] OK [HOOK - conan-center.py] pre_export(): [META LINES (KB-H025)] OK [HOOK - conan-center.py] pre_export(): [CONAN CENTER INDEX URL (KB-H027)] OK [HOOK - conan-center.py] pre_export(): [CMAKE MINIMUM VERSION (KB-H028)] OK [HOOK - conan-center.py] pre_export(): [TEST PACKAGE - RUN ENVIRONMENT (KB-H029)] OK [HOOK - conan-center.py] pre_export(): [SYSTEM REQUIREMENTS (KB-H032)] OK [HOOK - conan-center.py] pre_export(): [CONANDATA.YML FORMAT (KB-H030)] OK [HOOK - conan-center.py] pre_export(): [TEST PACKAGE - NO IMPORTS() (KB-H034)] OK [HOOK - conan-center.py] pre_export(): [NO AUTHOR (KB-H037)] OK [HOOK - conan-center.py] pre_export(): [NO TARGET NAME (KB-H040)] OK [HOOK - conan-center.py] pre_export(): [NO FINAL ENDLINE (KB-H041)] OK [HOOK - conan-center.py] pre_export(): [NO REQUIRES.ADD() (KB-H044)] OK [HOOK - conan-center.py] pre_export(): [DELETE OPTIONS (KB-H045)] OK [HOOK - conan-center.py] pre_export(): [NO ASCII CHARACTERS (KB-H047)] OK [HOOK - conan-center.py] pre_export(): [CMAKE VERBOSE MAKEFILE (KB-H046)] OK [HOOK - conan-center.py] pre_export(): [CMAKE VERSION REQUIRED (KB-H048)] OK [HOOK - conan-center.py] pre_export(): [CMAKE WINDOWS EXPORT ALL SYMBOLS (KB-H049)] OK [HOOK - conan-center.py] pre_export(): [DEFAULT OPTIONS AS DICTIONARY (KB-H051)] OK [HOOK - conan-center.py] pre_export(): [CONFIG.YML HAS NEW VERSION (KB-H052)] OK [HOOK - conan-center.py] pre_export(): [PRIVATE IMPORTS (KB-H053)] OK [HOOK - conan-center.py] pre_export(): [SINGLE REQUIRES (KB-H055)] OK [HOOK - conan-center.py] pre_export(): [ILLEGAL CHARACTERS (KB-H058)] OK [HOOK - conan-center.py] pre_export(): [CLASS NAME (KB-H059)] OK [HOOK - conan-center.py] pre_export(): [NO CRLF (KB-H060)] OK Exporting package recipe icu/69.1 exports: File 'conandata.yml' found. Exporting it... icu/69.1 exports: Copied 1 '.yml' file: conandata.yml icu/69.1 exports_sources: Copied 3 '.patch' files: 0001-69.1-fix-mingw.patch, 0001-67.1-fix-mingw.patch, 6aba9344a18f4f32e8070ee53b79495630901c26.patch [HOOK - conan-center.py] post_export(): [CONANDATA.YML REDUCE (KB-H031)] Saving conandata.yml: {'sources': {'69.1': {'url': 'https://github.com/unicode-org/icu/releases/download/release-69-1/icu4c-69_1-src.tgz', 'sha256': '4cba7b7acd1d3c42c44bb0c14be6637098c7faf2b330ce876bc5f3b915d09745'}}, 'patches': {'69.1': [{'patch_file': 'patches/0001-69.1-fix-mingw.patch', 'base_path': 'source_subfolder'}]}} [HOOK - conan-center.py] post_export(): [CONANDATA.YML REDUCE (KB-H031)] New conandata.yml contents: patches: '69.1': - base_path: source_subfolder patch_file: patches/0001-69.1-fix-mingw.patch sources: '69.1': sha256: 4cba7b7acd1d3c42c44bb0c14be6637098c7faf2b330ce876bc5f3b915d09745 url: https://github.com/unicode-org/icu/releases/download/release-69-1/icu4c-69_1-src.tgz [HOOK - conan-center.py] post_export(): [CONANDATA.YML REDUCE (KB-H031)] OK [HOOK - conan-center.py] post_export(): [DEFAULT SHARED OPTION VALUE (KB-H050)] OK [HOOK - conan-center.py] post_export(): [LICENSE PUBLIC DOMAIN (KB-H056)] OK icu/69.1: The stored package has not changed icu/69.1: Using the exported files summary hash as the recipe revision: 25ebb905737a0f074c2d4481055c9195 icu/69.1: Exported revision: 25ebb905737a0f074c2d4481055c9195 Configuration (profile_host): [settings] arch=armv8 build_type=Release compiler=apple-clang compiler.libcxx=libc++ compiler.version=12.0 os=iOS os.version=12.0 [options] [build_requires] [env] Configuration (profile_build): [settings] arch=x86_64 build_type=Release compiler=apple-clang compiler.libcxx=libc++ compiler.version=12.0 os=Macos [options] [build_requires] [env] icu/69.1: WARN: Package binary is corrupted, removing: e713d29ad52ea3a461c9d857b3294af4712c008b icu/69.1 (test package): Installing package Requirements icu/69.1 from 'conancenter' - Cache Packages icu/69.1:e713d29ad52ea3a461c9d857b3294af4712c008b - Build Build requirements icu/69.1 from 'conancenter' - Cache Build requirements packages icu/69.1:00395e88f4bd78b40c93f1fc576357f38a8a6f2c - Cache Cross-build from 'Macos:x86_64' to 'iOS:armv8' Installing (downloading, building) binaries... icu/69.1: Already installed! icu/69.1: Appending ICU_DATA environment variable: /Users/spaceim/.conan/data/icu/69.1/_/_/package/00395e88f4bd78b40c93f1fc576357f38a8a6f2c/res/icudt69l.dat icu/69.1: Appending PATH environment variable: /Users/spaceim/.conan/data/icu/69.1/_/_/package/00395e88f4bd78b40c93f1fc576357f38a8a6f2c/bin [HOOK - conan-center.py] post_package_info(): [CMAKE FILE NOT IN BUILD FOLDERS (KB-H019)] OK [HOOK - conan-center.py] post_package_info(): [LIBRARY DOES NOT EXIST (KB-H054)] OK icu/69.1: Applying build-requirement: icu/69.1 icu/69.1: WARN: Build folder is dirty, removing it: /Users/spaceim/.conan/data/icu/69.1/_/_/build/e713d29ad52ea3a461c9d857b3294af4712c008b icu/69.1: Copying sources to build folder icu/69.1: Building your package in /Users/spaceim/.conan/data/icu/69.1/_/_/build/e713d29ad52ea3a461c9d857b3294af4712c008b icu/69.1: Generator txt created conanbuildinfo.txt icu/69.1: Aggregating env generators [HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] OK. 'fPIC' option found and apparently well managed [HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] OK icu/69.1: Calling build() icu/69.1: icu/69.1: ERROR: Package 'e713d29ad52ea3a461c9d857b3294af4712c008b' build failed icu/69.1: WARN: Build folder /Users/spaceim/.conan/data/icu/69.1/_/_/build/e713d29ad52ea3a461c9d857b3294af4712c008b ERROR: icu/69.1: Error in build() method, line 103 self.run(self._build_config_cmd, win_bash=tools.os_info.is_windows) while calling '_build_config_cmd', line 200 return "../source/runConfigureICU %s" % " ".join(args) TypeError: sequence item 0: expected str instance, NoneType found ```

It comes from this logic in icu recipe: https://github.com/conan-io/conan-center-index/blob/564adba3032fa7dba45b22c7171f026d2c5bf758/recipes/icu/all/conanfile.py#L134-L200

icu recipe is broken for any host OS different than the ones listed here.

Why does recipe rely on runConfigureICU, instead of calling configure directly? Or call runConfigureICU for configurations handled in this script, otherwise call configure directly.

Honestly runConfigureICU seems to be useless for most OS:

runConfigureICU of icu 69.1 ```sh #!/bin/sh # Copyright (C) 2016 and later: Unicode, Inc. and others. # License & terms of use: http://www.unicode.org/copyright.html # Copyright (c) 1999-2015, International Business Machines Corporation and # others. All Rights Reserved. # runConfigureICU: This script will run the "configure" script for the appropriate platform # Only supported platforms are recognized me=`basename $0` OPTS= usage() { ec=0$1 if test $ec -eq 0 then uletter=U else uletter=u fi echo "${uletter}sage: $me [ -h, --help ] [ --enable-debug | --disable-release ] platform [ configurearg ... ]" if test $ec -eq 0 then cat <&1` RELEASE_CFLAGS='-O' RELEASE_CXXFLAGS='-O' export CFLAGS="-fp-model precise" export CXXFLAGS="-fp-model precise" if [ "${ICC_VER}" = "Version 9.0 " ]; then RELEASE_CFLAGS='' RELEASE_CXXFLAGS='' export CFLAGS="${CFLAGS} -O0" export CXXFLAGS="${CXXFLAGS} -O0" echo "ICC 9.0 does not work with optimization- disabling optimizations" fi THE_COMP="Intel ${ICC_VER}" ;; Linux/VA) THE_OS="Linux" THE_COMP="IBM XL C++ Compiler" CC=`which xlclang`; export CC CXX=`which xlclang++`; export CXX RELEASE_CFLAGS="-O3" RELEASE_CXXFLAGS="-O3" ;; Linux/gcc) THE_OS="Linux" THE_COMP="the GNU C++" CC=gcc; export CC CXX=g++; export CXX RELEASE_CFLAGS='-O3' RELEASE_CXXFLAGS='-O3' DEBUG_CFLAGS='-g' DEBUG_CXXFLAGS='-g' ;; Linux*) THE_OS="Linux" THE_COMP="the clang or else GNU C++" RELEASE_CFLAGS='-O3' RELEASE_CXXFLAGS='-O3' DEBUG_CFLAGS='-g' DEBUG_CXXFLAGS='-g' ;; Cygwin) THE_OS="Cygwin" THE_COMP="the GNU C++" RELEASE_CFLAGS='-O3' RELEASE_CXXFLAGS='-O3' ;; Cygwin/MSVC) THE_OS="Windows with Cygwin" THE_COMP="Microsoft Visual C++" CC=cl; export CC CXX=cl; export CXX RELEASE_CFLAGS='-Gy -MD' RELEASE_CXXFLAGS='-Gy -MD' DEBUG_CFLAGS='-FS -Zi -MDd' DEBUG_CXXFLAGS='-FS -Zi -MDd' DEBUG_LDFLAGS='-DEBUG' ;; Cygwin/MSVC2005) THE_OS="Windows with Cygwin" THE_COMP="Microsoft Visual C++ 2005" CC=cl; export CC CXX=cl; export CXX RELEASE_CFLAGS='/Gy /MD' RELEASE_CXXFLAGS='/Gy /MD' DEBUG_CFLAGS='/Zi /MDd' DEBUG_CXXFLAGS='/Zi /MDd' DEBUG_LDFLAGS='/DEBUG' ;; Cygwin/ICL) THE_OS="Windows with Cygwin" THE_COMP="Intel C++" CC=icl; export CC CXX=icl; export CXX # The Intel compiler has optimization bugs. So we disable optimization. RELEASE_CFLAGS='/Od' RELEASE_CXXFLAGS='/Od' DEBUG_CFLAGS='/Zi' DEBUG_CXXFLAGS='/Zi' DEBUG_LDFLAGS='/DEBUG' ;; MacOSX) THE_OS="MacOS X (Darwin)" THE_COMP="the default" RELEASE_CFLAGS='-O2' RELEASE_CXXFLAGS='-O2' DEBUG_CFLAGS='-g -O0' DEBUG_CXXFLAGS='-g -O0' ;; MacOSX/GCC) THE_OS="MacOS X (Darwin)" THE_COMP="the GNU C++" RELEASE_CFLAGS='-O2' RELEASE_CXXFLAGS='-O2' DEBUG_CFLAGS='-g -O0' DEBUG_CXXFLAGS='-g -O0' CC=gcc; export CC CXX=g++; export CXX ;; MinGW) THE_OS="MinGW" THE_COMP="the GNU C++" RELEASE_CFLAGS='-O3' RELEASE_CXXFLAGS='-O3' export CXXFLAGS ;; MSYS/MSVC) THE_OS="MSYS" THE_COMP="Microsoft Visual C++" CC=cl; export CC CXX=cl; export CXX RELEASE_CFLAGS='-Gy -MD' RELEASE_CXXFLAGS='-Gy -MD' DEBUG_CFLAGS='-FS -Zi -MDd' DEBUG_CXXFLAGS='-FS -Zi -MDd' DEBUG_LDFLAGS='-DEBUG' ;; *BSD) THE_OS="BSD" THE_COMP="the GNU C++" DEBUG_CFLAGS='-g -O0' DEBUG_CXXFLAGS='-g -O0' ;; TRU64V5.1/CXX) THE_OS="OSF1" THE_COMP="Compaq cxx" CC=cc; export CC CXX=cxx; export CXX ;; QNX) THE_OS="QNX" THE_COMP="QNX cc" CC=qcc; export CC CXX=QCC; export CXX ;; zOS) THE_OS="z/OS (OS/390)" THE_COMP="z/OS C/C++" CC=xlc; export CC CXX=xlC; export CXX RELEASE_CFLAGS="-O2 -Wc,'inline(AUTO,NOREPORT,1000,8000)'" RELEASE_CXXFLAGS="-O2 -Wc,'inline(AUTO,NOREPORT,1000,8000)'" ;; zOSV1R2) THE_OS="z/OS 1.2" THE_COMP="z/OS 1.2 C/C++" CC=cc; export CC CXX=cxx; export CXX export COMPILE_LINK_ENVVAR='_CXX_CICC_VER}=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000' export _CXX_CVERSION=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000 export LDFLAGS="-Wl,'compat=pm3'" export CFLAGS="-Wc,'target(zOSV1R2)'" export CXXFLAGS="-Wc,'target(zOSV1R2)'" RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'" RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'" ;; *) >&2 echo "$me: unrecognized platform \"$platform\" (use --help for help)" exit 1;; esac # Tweak flags if test $release -eq 1 then if test "$RELEASE_CFLAGS" = "" then case $CC in gcc|*/gcc|*-gcc-*|*/*-gcc-*) RELEASE_CFLAGS=-O3 ;; esac fi if test "$RELEASE_CFLAGS" != "" then CFLAGS="$RELEASE_CFLAGS $CFLAGS" fi if test "$RELEASE_CXXFLAGS" = "" then case $CXX in g++|*/g++|*-g++-*|*/*-g++-*) RELEASE_CXXFLAGS=-O3 ;; esac fi if test "$RELEASE_CXXFLAGS" != "" then CXXFLAGS="$RELEASE_CXXFLAGS $CXXFLAGS" fi if test "$RELEASE_LDFLAGS" != "" then LDFLAGS="$RELEASE_LDFLAGS $LDFLAGS" fi fi if test $debug -eq 1 then if test "$DEBUG_CFLAGS" != "" then CFLAGS="$DEBUG_CFLAGS $CFLAGS" fi if test "$DEBUG_CXXFLAGS" != "" then CXXFLAGS="$DEBUG_CXXFLAGS $CXXFLAGS" fi if test "$DEBUG_LDFLAGS" != "" then LDFLAGS="$DEBUG_LDFLAGS $LDFLAGS" fi fi export CFLAGS export CXXFLAGS export LDFLAGS # Run configure echo "export CPP=$CPP CC=$CC CXX=$CXX CPPFLAGS=$CPPFLAGS CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS MAKE=$MAKE" echo "Running ./configure $OPTS $@ for $THE_OS using $THE_COMP compiler" echo if $configure $OPTS $@ then echo echo If the result of the above commands looks okay to you, go to the directory echo source in the ICU distribution to build ICU. Please remember that ICU needs echo GNU make to build properly... else echo $0: ./configure failed exit 1 fi ```

/cc @SSE4 (you have ported this recipe from bincrafters, and this logic was already there, maybe you remember rational behind it).

SSE4 commented 3 years ago

this is from an official build instructions (http://userguide.icu-project.org/icufaq)

You need GNU's make program version 3.8 or later, and you need to run the runConfigureICU script, which is located in the icu/source directory.

all their docs reference runConfigureICU http://userguide.icu-project.org/icudata http://userguide.icu-project.org/packaging

we're building with runConfigureICU for 4 years already, and so far didn't encounter any problems with it.

SSE4 commented 3 years ago
TypeError: sequence item 0: expected str instance, NoneType found

this definitely needs an improvement for error handling in recipe. still, not a problem of runConfigureICU, which is robust and reliable.

SpaceIm commented 3 years ago

It's not robust, it doesn't handle many platforms.

SSE4 commented 3 years ago

It's not robust, it doesn't handle many platforms.

for instance? for really exotic platforms (e.g. HP-UX), they have a note:

if you are not using the runConfigureICU script, or your platform is not supported by the script, 
you may need to set your CC, CXX, CFLAGS and CXXFLAGS environment variables, 
and type "./configure". 
HP-UX users, please see this note regarding HP-UX multithreaded build issues with newer compilers. 
Solaris users, please see this note regarding Solaris multithreaded build issues.

otherwise, for major CCI platforms (Linux, Macos, Windows) it's well supported. more, runConfigureICU is responsible to ensure that correct configure flags are propagated for all supported (and tested) platforms.

SpaceIm commented 3 years ago

for instance?

iOS, tvOS, watchOS, Android (let's just say iOS & Android)? Less exotic than HP-UX.

more, runConfigureICU is responsible to ensure that correct configure flags are propagated for all supported (and tested) platforms.

Yes, some of them seem to be important, but does it honor CFLAGS and CXXFLAGS coming from profile?

SSE4 commented 3 years ago

Yes, some of them seem to be important, but does it honor CFLAGS and CXXFLAGS coming from profile?

seems like they just override, for some platforms, at least: https://chromium.googlesource.com/chromium/deps/icu/+/refs/heads/main/source/runConfigureICU#364

iOS, tvOS, watchOS, Android (let's just say iOS & Android)? Less exotic than HP-UX.

they literally say:

Can you help me build ICU4C for...
We can try.. make sure you read the latest "readme" and also the ICU Data section. You might also searching the icu-support archives, and then posting a question there. Additionally, sites such as StackOverflow may have helpful tips for your topic.
Android NDK
Please try searching the icu-support archives and also see StackOverflow.
iPhone
Please try searching the icu-support archives and also see StackOverflow.

so they don't provide any good instructions for that platforms. there are some gists and other scripts to build for iOS/Android available in the wild. some of them e.g. just use ./runConfigureICU Linux for Android. some use ./configure.

SpaceIm commented 3 years ago

Yes, some of them seem to be important, but does it honor CFLAGS and CXXFLAGS coming from profile?

seems like they just override, for some platforms, at least: https://chromium.googlesource.com/chromium/deps/icu/+/refs/heads/main/source/runConfigureICU#364

So RelWithDebInfo and MinSizeRel are not honored as well if you look at runConfigureICU.

From what I see in runConfigureICU, it's just a naive wrapper of what conan does anyway in AutotoolsBuildEnvironment, but without honoring flags from profile.

SSE4 commented 3 years ago

So RelWithDebInfo and MinSizeRel are not honored as well if you look at runConfigureICU.

this is typical for many build systems. RelWithDebInfo/MinSizeRel only exist in CMake. for others (like MSBuild) we usually just fallback everything besides Debug to the regular Release. auto-tools predate CMake as well, and know nothing about these configurations. there are --enable-debug flag sometimes, but even not in all configure scripts I've seen.

SpaceIm commented 3 years ago

I'll submit a PR. It's not obvious: