conan-io / conan-center-index

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

[package] openssl/3.2.1: cross compile error when host is armv8 #23641

Open renjiangithub opened 5 months ago

renjiangithub commented 5 months ago

Description

something wrong when cross compile openssl/3.2.1

Package and Environment Details

Conan profile

Profile host:

[settings] arch=armv8 build_type=Release compiler=gcc compiler.cppstd=gnu14 compiler.libcxx=libstdc++11 compiler.version=9 os=Linux [buildenv] CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ LD=aarch64-linux-gnu-g++

Profile build:

[settings] arch=x86_64 build_type=Release compiler=gcc compiler.cppstd=gnu14 compiler.libcxx=libstdc++11 compiler.version=9 os=Linux

Steps to reproduce

conan install . -pr:h ./conan_profile_armv8 --output-folder=build/ --build=missing

my ./conan_profile_armv8


[settings]
arch=armv8
build_type=Release
compiler=gcc
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux

[buildenv] CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ LD=aarch64-linux-gnu-g++


### Logs

<details><summary>Click to expand log</summary>

collect2: error: ld returned 1 exit status make[1]: [Makefile:16783: util/quicserver] Error 1 make[1]: Waiting for unfinished jobs.... make[1]: Leaving directory '/home/rj/.conan2/p/b/opensb47f52b2ef06b/b/src' make: *** [Makefile:2528: build_sw] Error 2

openssl/3.2.1: ERROR: Package '0ce40603a51fa36ffbb7ef57313eb02f09e72249' build failed openssl/3.2.1: WARN: Build folder /home/rj/.conan2/p/b/opensb47f52b2ef06b/b/build-release ERROR: openssl/3.2.1: Error in build() method, line 533 self._make() while calling '_make', line 525 self._run_make() while calling '_run_make', line 502 self.run(" ".join(command), env="conanbuild") ConanException: Error 2 while executing



</details>
renjiangithub commented 5 months ago

local cross compile: example openssl version: 1.1.1b

(1) failed

  1. wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1b.tar.gz
  2. tar zxvf OpenSSL_1_1_1b.tar.gz
  3. ./config no-asm shared --prefix=/data/armlib/mqtt/openlib --cross-compile-prefix=aarch64-linux-gnu-
  4. make error log:
    ...
    aarch64-linux-gnu-gcc: error: unrecognized command line option '-m64'
    make[1]: *** [Makefile:706: apps/app_rand.o] Error 1
    ...

    (2) modify, success

    before make, modify Makefile:

  5. vim ./Makefile, and delete all "-m64", in row 124, 125
  6. make
  7. make install

success!

the question is: how could I modify "-m64" config in my conanfile.py

from conan import ConanFile
from conan.tools.cmake import cmake_layout

class ExampleRecipe(ConanFile):
    settings = "os", "compiler", "build_type", "arch"
    generators = "CMakeDeps", "CMakeToolchain"

    def requirements(self):
        self.requires("openssl/3.2.1")

    def layout(self):
        cmake_layout(self)
renjiangithub commented 5 months ago

notice:

-m64 is only valid for x86_64 processors, not arm64 processors.
Ahajha commented 3 months ago

For a workaround, see what @jakubablenski did here: https://github.com/conan-io/conan-center-index/issues/24122

Essentially: sudo apt install g++-[DESIRED_VERSION]-aarch64-linux-gnu, then edit CC/CXX/LD in your [buildenv]. Not sure if it works using only tools.build:compiler_executables.

jcar87 commented 1 month ago

Hi @renjiangithub thanks for reporting this.

Could you paste the full build log rather than just the last bit?

Thanks!