conan-io / conan-center-index

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

[package] hdf5/1.14.3: "Recipe doesn't support cross-building" #23803

Open li-dl opened 4 months ago

li-dl commented 4 months ago

Description

Using an Apple Silicon Mac to cross-compile hdf5 to x86_64 gives:

ERROR: There are invalid packages (packages that cannot exist for this configuration):
hdf5/1.14.3: Invalid ID: Current recipe doesn't support cross-building (yet)

Related to #14018.

Package and Environment Details

Conan profile

profile-build:

[settings]
arch=armv8
build_type=Release
compiler=apple-clang
compiler.version=15
compiler.libcxx=libc++
os=Macos

profile-host:

[settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.version=15
compiler.libcxx=libc++
os=Macos

Steps to reproduce

% cat conanfile.txt 
[requires]
hdf5/1.14.3
[generators]
make

% mkdir build

% cd build

% conan install -pr:b ../profile-build -pr:h ../profile-host -b missing ..

Logs

Click to expand log ``` Configuration (profile_host): [settings] arch=x86_64 build_type=Release compiler=apple-clang compiler.libcxx=libc++ compiler.version=15 os=Macos [options] [build_requires] [env] Configuration (profile_build): [settings] arch=armv8 build_type=Release compiler=apple-clang compiler.libcxx=libc++ compiler.version=15 os=Macos [options] [build_requires] [env] hdf5/1.14.3: Not found in local cache, looking in remotes... hdf5/1.14.3: Trying with 'conancenter'... Downloading conanmanifest.txt completed [0.10k] Downloading conanfile.py completed [14.37k] Downloading conan_export.tgz completed [0.32k] Decompressing conan_export.tgz completed [0.00k] hdf5/1.14.3: Downloaded recipe revision 31ccd8d4de83844f5db48471df1944a1 Version ranges solved Version range '>=1.2.11 <2' required by 'hdf5/1.14.3' resolved to 'zlib/1.2.12' in local cache conanfile.txt: Installing package Requirements hdf5/1.14.3 from 'conancenter' - Downloaded zlib/1.2.12 from 'conancenter' - Cache Packages hdf5/1.14.3:INVALID - Invalid zlib/1.2.12:da30db767be49786b38801a5ea2c89bc58b35168 - Build Cross-build from 'Macos:armv8' to 'Macos:x86_64' Installing (downloading, building) binaries... ERROR: There are invalid packages (packages that cannot exist for this configuration): hdf5/1.14.3: Invalid ID: Current recipe doesn't support cross-building (yet) ```
uilianries commented 4 months ago

The HDF5 recipe runs some executable when cross-building, which is not using the architecture as same as from the build context: https://github.com/conan-io/conan-center-index/blob/master/recipes/hdf5/all/conanfile.py#L89

It's possible to fix it, but need further investigation.

li-dl commented 4 months ago

The HDF5 recipe runs some executable when cross-building

Looks like that may no longer be true.

According to upstream HDF v1.14.3 release notes:

  • Running H5make_libsettings is no longer required for cross-compiling.
  • Running H5detect is no longer required for cross-compiling.

[Edit] See also upstream issue 1203, Cross-compilation support, where derobins said on 2023-06-14:

Cross compiling should basically just work now

jcar87 commented 4 months ago

Hi @li-dl , thank you for reporting this.

I've tried cross-compiling the most recent version (by relaxing the condition in the recipe), and still get errors:

CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
   H5_LDOUBLE_TO_LONG_SPECIAL_RUN (advanced)
   H5_LDOUBLE_TO_LONG_SPECIAL_RUN__TRYRUN_OUTPUT (advanced)
For details see /Users/luisc/.conan2/p/b/hdf5c8c52f0f185ab/b/build/Release/TryRunResults.cmake
CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
   H5_LONG_TO_LDOUBLE_SPECIAL_RUN (advanced)
   H5_LONG_TO_LDOUBLE_SPECIAL_RUN__TRYRUN_OUTPUT (advanced)
For details see /Users/luisc/.conan2/p/b/hdf5c8c52f0f185ab/b/build/Release/TryRunResults.cmake
CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
   H5_LDOUBLE_TO_LLONG_ACCURATE_RUN (advanced)
   H5_LDOUBLE_TO_LLONG_ACCURATE_RUN__TRYRUN_OUTPUT (advanced)
For details see /Users/luisc/.conan2/p/b/hdf5c8c52f0f185ab/b/build/Release/TryRunResults.cmake
CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
   H5_LLONG_TO_LDOUBLE_CORRECT_RUN (advanced)
   H5_LLONG_TO_LDOUBLE_CORRECT_RUN__TRYRUN_OUTPUT (advanced)
For details see /Users/luisc/.conan2/p/b/hdf5c8c52f0f185ab/b/build/Release/TryRunResults.cmake
CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
   H5_DISABLE_SOME_LDOUBLE_CONV_RUN (advanced)
   H5_DISABLE_SOME_LDOUBLE_CONV_RUN__TRYRUN_OUTPUT (advanced)
For details see /Users/luisc/.conan2/p/b/hdf5c8c52f0f185ab/b/build/Release/TryRunResults.cmake
-- Found Perl: /usr/bin/perl (found version "5.34.1")

So it looks like support may not be fully there yet. I'll try to troubleshoot and report this unstream.

on the other hand, if you have Rosetta installed, the following works for me:

conan install --require=hdf5/1.14.3 --settings:host arch=x86_64 --settings:build arch=x86_64

This tells Conan that we are running natively on x86_64, which "can" be true if Rosetta is installed. However please note that this approach may not work with all recipes, if build systems perform auto-detections. But I can confirm it works for building hdf5

li-dl commented 4 months ago

on the other hand, if you have Rosetta installed, the following works for me:

conan install --require=hdf5/1.14.3 --settings:host arch=x86_64 --settings:build arch=x86_64

[...] However please note that this approach may not work with all recipes [...]

Yeah, that's what we've been doing, but one of our other dependencies (capnproto) is one of the recipes that doesn't work with that approach, as discussed in #23765.

li-dl commented 3 months ago

So it looks like support may not be fully there yet [in v1.14.3]. I'll try to troubleshoot and report this unstream.

Upstream HDF5 v1.14.4-3 was released on 2024-05-22. The release notes include the line:

Further improvements to cross-compiling