conan-io / conan-center-index

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

[bug] Can't cross-build openssl/3.1.3 #20637

Closed spakarl closed 10 months ago

spakarl commented 11 months ago

Environment details

Steps to reproduce

I try to cross-build openssl/3.1.3 on Ubuntu with the arm-linux-gnueabihf-gcc-9 package.

conan install openssl.txt --build=missing -pr:h=armv7hf-gcc9 -pr:b=gcc9

openssl.txt armv7hf-gcc9.txt gcc9.txt

I think the recipe trys to call "perl ./Configure" from the wrong place. It probably can't find the Configure file in this folder. The Configure file is available but in a different folder.

Logs

The build stops with the following error message.

ERROR: openssl/3.1.3: Error in build() method, line 520 self._make() while calling '_make', line 508 self.run("{perl} ./Configure {args}".format(perl=self.perl, args=args), env="conanbuild") ConanException: Error 127 while executing perl ./Configure "conan-Release-Linux-armv7hf-gcc-9" no-shared --prefix=/ --libdir=lib --openssldir="/etc/ssl" no-unit-test threads PERL=perl no-tests --release -fPIC enable-fips no-md2 zlib --with-zlib-include="/home/buildagent/.conan/data/zlib/1.2.13///package/79a936a2eb2adfcb385f34406a4eb2396b702027/include" --with-zlib-lib="/home/buildagent/.conan/data/zlib/1.2.13//_/package/79a936a2eb2adfcb385f34406a4eb2396b702027/lib"

build.log

franramirez688 commented 11 months ago

Hi @spakarl

Thanks for reporting the issue. Let me transfer this issue to CCI repository as it seems a problem with the recipe itself.

franramirez688 commented 11 months ago

Hi @spakarl

Thanks for reporting again.

I just tried it out in Docker image, and I got this:

openssl/3.1.3: using target: conan-Release-Linux-armv7hf-gcc-9 -> linux-armv4
openssl/3.1.3: my %targets = (
    "conan-Release-Linux-armv7hf-gcc-9" => {
        inherit_from => [ "linux-armv4" ],
        cflags => add("-fPIC -O3"),
        cxxflags => add("-fPIC -O3"),
        defines => add("NDEBUG"),
        lflags => add(""),

    },
);

openssl/3.1.3: Aggregating env generators
openssl/3.1.3: Calling build()
/bin/sh: 1: powershell.exe: not found
/bin/sh: 1: cmd: not found
openssl/3.1.3:
openssl/3.1.3: ERROR: Package 'fdb7d57cdb727fbb97b60abb8455d45940241ece' build failed
openssl/3.1.3: WARN: Build folder /root/.conan/data/openssl/3.1.3/_/_/build/fdb7d57cdb727fbb97b60abb8455d45940241ece/build-release
ERROR: openssl/3.1.3: Error in build() method, line 520
    self._make()
while calling '_make', line 508
    self.run("{perl} ./Configure {args}".format(perl=self._perl, args=args), env="conanbuild")
    ConanException: Error 127 while executing perl ./Configure "conan-Release-Linux-armv7hf-gcc-9" no-shared --prefix=/ --libdir=lib --openssldir="/etc/ssl" no-unit-test threads PERL=perl no-tests --release -fPIC enable-fips no-md2 zlib --with-zlib-include="/root/.conan/data/zlib/1.3/_/_/package/79a936a2eb2adfcb385f34406a4eb2396b702027/include" --with-zlib-lib="/root/.conan/data/zlib/1.3/_/_/package/79a936a2eb2adfcb385f34406a4eb2396b702027/lib"

After that, I tried it out using Conan 2.0.13 and the result is slightly different:

zlib/1.3: Apply patch (conan): separate static/shared builds, disable debug suffix, disable building examples
zlib/1.3: Running CMake.configure()
zlib/1.3: RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/root/.conan2/p/b/zlib0a42f240c49a5/b/build/Release/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/root/.conan2/p/b/zlib0a42f240c49a5/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/root/.conan2/p/b/zlib0a42f240c49a5/b/src"
/bin/sh: 1: powershell.exe: not found
/bin/sh: 1: cmd: not found

zlib/1.3: ERROR:
Package 'e2890d486dc9719db74041dfd0522f8ce131cc3d' build failed
zlib/1.3: WARN: Build folder /root/.conan2/p/b/zlib0a42f240c49a5/b/build/Release
*********************************************************
Recipe 'zlib/1.3' cannot build its binary
It is possible that this recipe is not Conan 2.0 ready
If the recipe comes from ConanCenter, report it at https://github.com/conan-io/conan-center-index/issues
If it is your recipe, check if it is updated to 2.0
*********************************************************

ERROR: zlib/1.3: Error in build() method, line 84
    cmake.configure()
    ConanException: Error 127 while executing

It's failing much earlier with zlib, but with the same error. I'll need a further investigation to know what's happening here. By the record, my resulting profiles are:

Profile host:
[settings]
arch=armv7hf
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
[conf]
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True
tools.env.virtualenv:powershell=True
[buildenv]
CC=arm-linux-gnueabihf-gcc-9
CXX=arm-linux-gnueabihf-g++-9
LD=arm-linux-gnueabihf-ld
CCLD=arm-linux-gnueabihf-ld

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux

UPDATED:

Sorry, but I just realized about this line in your profile tools.env.virtualenv:powershell=True, so this has to be removed. Doing that, and using Conan 1.x, I got:

In file included from crypto/armcap.c:26:
crypto/arm_arch.h:50:6: error: #error "unsupported ARM architecture"
   50 | #    error "unsupported ARM architecture"
      |      ^~~~~
make[1]: *** [Makefile:7962: crypto/libcrypto-lib-armcap.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/root/.conan/data/openssl/3.1.3/_/_/build/fdb7d57cdb727fbb97b60abb8455d45940241ece/src'
make: *** [Makefile:2341: build_sw] Error 2
openssl/3.1.3:
openssl/3.1.3: ERROR: Package 'fdb7d57cdb727fbb97b60abb8455d45940241ece' build failed
openssl/3.1.3: WARN: Build folder /root/.conan/data/openssl/3.1.3/_/_/build/fdb7d57cdb727fbb97b60abb8455d45940241ece/build-release
ERROR: openssl/3.1.3: Error in build() method, line 520
    self._make()
while calling '_make', line 513
    self._run_make()
while calling '_run_make', line 490
    self.run(" ".join(command), env="conanbuild")
    ConanException: Error 2 while executing make -j16

Otherwise, using Conan 2.0.13 is working like a charm:


$ conan install openssl.txt --build=missing -pr:h=armv7hf-gcc9

======== Input profiles ========
Profile host:
[settings]
arch=armv7hf
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
[conf]
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True
[buildenv]
CC=arm-linux-gnueabihf-gcc-9
CXX=arm-linux-gnueabihf-g++-9
LD=arm-linux-gnueabihf-ld
CCLD=arm-linux-gnueabihf-ld

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux

.....

openssl/3.1.3: Created package revision 534acda2d7f7d13ee5c1214ba33979c3
openssl/3.1.3: Package 'e067bc17136bfed0ce25a2ed726909622e5a5d2e' created
openssl/3.1.3: Full package reference: openssl/3.1.3#fff5e82eb893e0c6ab135df0e60b894f:e067bc17136bfed0ce25a2ed726909622e5a5d2e#534acda2d7f7d13ee5c1214ba33979c3
openssl/3.1.3: Package folder /root/.conan2/p/b/opense84528419bdb8/p
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated:     'cpp_info.names' used in: openssl/3.1.3, zlib/1.3
WARN: deprecated:     'cpp_info.build_modules' used in: openssl/3.1.3
WARN: deprecated:     'env_info' used in: openssl/3.1.3

======== Finalizing install (deploy, generators) ========
other.txt: Writing generators to /home/develop/linux/test2/build/Release/generators
other.txt: Generator 'CMakeDeps' calling 'generate()'
other.txt: Generator 'CMakeToolchain' calling 'generate()'
other.txt: CMakeToolchain generated: conan_toolchain.cmake
other.txt: Preset 'conan-release' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-release' if using CMake>=3.23
other.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake <path> -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/home/develop/linux/test2/build/Release/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release'
other.txt: CMakeToolchain generated: CMakePresets.json
other.txt: Generating aggregated env files
other.txt: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
Install finished successfully
spakarl commented 10 months ago

UPDATED:

Sorry, but I just realized about this line in your profile tools.env.virtualenv:powershell=True, so this has to be removed.

I need powershell generation on linux. Maybe this line is not needed for Conan v1

spakarl commented 10 months ago

@memsharded : My Perl version is v5.30.0. I just tried my test again and have the same error messages. Also @franramirez688 seems to be able to reproduce.

spakarl commented 10 months ago

I tried to build again with the profile created by @memsharded and it compiled. I'll try to find out what is different to my profiles.

conan install openssl.txt --build=missing -pr=armprofile.txt

armprofile.txt

I think the issue(s) can be closed now

franramirez688 commented 10 months ago

Great news! 👏

Let us know if you need anything else, or getting any other error.

Let's close both issues.

franramirez688 commented 10 months ago

@spakarl Anyway, I'm curious, because I'm still facing the same error as I put in my comment above:

In file included from crypto/armcap.c:26:
crypto/arm_arch.h:50:6: error: #error "unsupported ARM architecture"
   50 | #    error "unsupported ARM architecture"
      |      ^~~~~
make[1]: *** [Makefile:7967: crypto/libcrypto-lib-armcap.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/root/.conan/data/openssl/3.1.3/_/_/build/fdb7d57cdb727fbb97b60abb8455d45940241ece/src'
make: *** [Makefile:2346: build_sw] Error 2

You got a fully successful compilation, didn't you?

spakarl commented 10 months ago

@franramirez688: I got a successful compilation with the commandline and profile shown above:

https://github.com/conan-io/conan-center-index/issues/20637#issuecomment-1770289424

At the moment I compare the profile from @memsharded with my two profiles. I will write down my findings later here when I found the time to test again.

spakarl commented 10 months ago

@franramirez688: It seems that the problem stems from this line in my host profile:

[conf]
tools.env.virtualenv:powershell = True

If I change the setting to false, or if I remove the line, it compiles.

I think this is unexpected behaviour. Should this be considered as a bug?

spakarl commented 10 months ago

The same error seems to appear, when we leave out the [env] section in the profile.

franramirez688 commented 10 months ago

@spakarl That behavior is "normal" as that conf variable was only thought for Windows and not for Unix. In my case, I'm using this profile:

[settings]
arch=armv7hf
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
[buildenv]
CC=arm-linux-gnueabihf-gcc-9
CXX=arm-linux-gnueabihf-g++-9
LD=arm-linux-gnueabihf-ld
CCLD=arm-linux-gnueabihf-ld

I got the error that I showed above, that's the reason why I asked you if everything compiled well even pruning that variable and the env section.

Figuring out that message, I saw this issue related: https://github.com/conan-io/conan-center-index/issues/99 The good news is that using Conan 2.0.13 and the same profile and command is not happening anymore on my side:

conan install openssl.txt -pr arm --build missing

======== Input profiles ========
Profile host:
[settings]
arch=armv7hf
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
[buildenv]
CC=arm-linux-gnueabihf-gcc-9
CXX=arm-linux-gnueabihf-g++-9
LD=arm-linux-gnueabihf-ld
CCLD=arm-linux-gnueabihf-ld

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux

........

openssl/3.1.3: Created package revision 6f8e229e38419f390de4e1b3ad417a92
openssl/3.1.3: Package 'e067bc17136bfed0ce25a2ed726909622e5a5d2e' created
openssl/3.1.3: Full package reference: openssl/3.1.3#fff5e82eb893e0c6ab135df0e60b894f:e067bc17136bfed0ce25a2ed726909622e5a5d2e#6f8e229e38419f390de4e1b3ad417a92
openssl/3.1.3: Package folder /root/.conan2/p/b/opens9bce7bc4ee989/p
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated:     'cpp_info.names' used in: openssl/3.1.3, zlib/1.3
WARN: deprecated:     'cpp_info.build_modules' used in: openssl/3.1.3
WARN: deprecated:     'env_info' used in: openssl/3.1.3

======== Finalizing install (deploy, generators) ========
other.txt: Writing generators to /home/develop/linux/test2/build/Release/generators
other.txt: Generator 'CMakeToolchain' calling 'generate()'
other.txt: CMakeToolchain generated: conan_toolchain.cmake
other.txt: Preset 'conan-release' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-release' if using CMake>=3.23
other.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake <path> -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/home/develop/linux/test2/build/Release/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release'
other.txt: CMakeToolchain generated: CMakePresets.json
other.txt: Generator 'CMakeDeps' calling 'generate()'
other.txt: Generating aggregated env files
other.txt: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
Install finished successfully
spakarl commented 10 months ago

I would switch immediately to Conan v2, but the missing qmake generator is a blocker for me.

vineethabc commented 3 weeks ago

@franramirez688 , i am trying to cross compile openssl/3.1.3 for qnx i am getting the same issue mentioned in the starting.

LOG: _cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files Makefile:3177: recipe for target 'apps/lib/libapps-lib-app_rand.o' failed make[1]: [apps/lib/libapps-lib-app_rand.o] Error 1 make[1]: Waiting for unfinished jobs.... cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files Makefile:3185: recipe for target 'apps/lib/libapps-lib-app_x509.o' failed make[1]: [apps/lib/libapps-lib-app_x509.o] Error 1 cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files Makefile:3153: recipe for target 'apps/lib/libapps-lib-app_libctx.o' failed make[1]: [apps/lib/libapps-lib-app_libctx.o] Error 1 cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files Makefile:3161: recipe for target 'apps/lib/libapps-lib-app_params.o' failed make[1]: [apps/lib/libapps-lib-app_params.o] Error 1 cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files Makefile:3193: recipe for target 'apps/lib/libapps-lib-apps.o' failed make[1]: [apps/lib/libapps-lib-apps.o] Error 1 cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files Makefile:3169: recipe for target 'apps/lib/libapps-lib-app_provider.o' failed make[1]: [apps/lib/libapps-lib-app_provider.o] Error 1 make[1]: Leaving directory '/home/user/.conan2/p/b/opens390ce1e45f839/b/src' Makefile:2159: recipe for target 'build_sw' failed make: [build_sw] Error 2

openssl/3.1.3: ERROR: Package 'e334ef211f75fb83a80a4a82853ab4eb31937d6b' build failed openssl/3.1.3: WARN: Build folder /home/user/.conan2/p/b/opens390ce1e45f839/b/build-release ERROR: openssl/3.1.3: Error in build() method, line 533 self._make() while calling '_make', line 525 self._run_make() while calling '_runmake', line 502 self.run(" ".join(command), env="conanbuild") ConanException: Error 2 while executing ########################################## i am using conan 2.6.0 i have run the command " conan install openssl.txt --build=missing -pr:h=armv7.txt"

#############HoST profile: armv7.txt##################### [settings] arch=armv8.3 build_type=Release compiler=qcc compiler.cppstd=17 compiler.libcxx=cxx compiler.version=8.3 os=Neutrino os.version=7.1 [conf] tools.cmake.cmaketoolchain:user_toolchain+=/home/user/WKSpace/Sample/myvars.cmake [buildenv] CC=/home/user/WKSpace/qnx710/host/linux/x86_64/usr/bin/qcc CXX=/home/user/WKSpace/qnx710/host/linux/x86_64/usr/bin/q++ ############openssl.txt############# [requires] openssl/3.1.3 [generators] CMakeDeps CMakeToolchain [layout] cmake_layout ##############BUILD profile: ################## [settings] arch=x86_64 build_type=Debug compiler=gcc compiler.cppstd=gnu14 compiler.libcxx=libstdc++11 compiler.version=7 os=Linux