Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to cross compile openssl/3.x.x on develop2 #631

Closed
f-scholer opened this issue Mar 25, 2024 · 6 comments · Fixed by #632
Closed

Unable to cross compile openssl/3.x.x on develop2 #631

f-scholer opened this issue Mar 25, 2024 · 6 comments · Fixed by #632

Comments

@f-scholer
Copy link

I am unable to cross compile openssl/3.x.x on develop2.
I can cross compile openssl with the following command:
conan install . --build=force -pr:b=default -pr:h=./profiles/mingw
mingw.txt

But doing the same with conan_provider:
cmake -B build/win -S example -DCMAKE_TOOLCHAIN_FILE=toolchain/x86_64-mingw_linux_toolchain.cmake -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake/conan_provider.cmake -DCMAKE_BUILD_TYPE=Release
x86_64-mingw_linux_toolchain.txt

gives this
build.txt

the conan_provider generated profile appears to be incomplete:
[settings]
arch=x86_64
os=Windows
compiler=gcc
compiler.version=10
compiler.cppstd=20
compiler.libcxx=libstdc++11
build_type=Release
[conf]
tools.cmake.cmaketoolchain:generator=Unix Makefiles
tools.build:compiler_executables={"c":"/bin/x86_64-w64-mingw32-gcc-posix","cpp":"/bin/x86_64-w64-mingw32-g++-posix"}

I tried appending updating the profile without luck:
tools.build:compiler_executables={"c":"/bin/x86_64-w64-mingw32-gcc-posix","cpp":"/bin/x86_64-w64-mingw32-g++-posix","rc":"/bin/x86_64-w64-mingw32-windres","RC":"/bin/x86_64-w64-mingw32-windres","windres":"/bin/x86_64-w64-mingw32-windres"}

@memsharded
Copy link
Member

Hi @f-scholer

Thanks for your report.
It seems that the missing bit in cmake-conan would be the definition of rc compiler, but I am confused that you tried to specify it, and it didn't work. Was the output error exactly the same when adding rc to compiler_executables?

@memsharded
Copy link
Member

Ok, I just realized. The openssl recipe uses the AutotoolsToolchain that defines the compiler mapping as: compilers_mapping = {"c": "CC", "cpp": "CXX", "cuda": "NVCC", "fortran": "FC"}

In other words, it is not prepared for cross-compiling from Linux -> Windows and defining the RC compiler.

So the issue needs to be addressed in both places, opening another ticket in the Conan client

@memsharded
Copy link
Member

In the meantime, you can define a profile with just the [buildenv] section, and pass it to your build as defined in the readme -DCONAN_HOST_PROFILE="default;custom"

@f-scholer
Copy link
Author

Thanks for the quick action and suggestion. That works.

I had modified conan_provider.cmake to write the buildenv entries:
macro(append_buildenv_configuration)
if(CMAKE_C_COMPILER)
string(APPEND PROFILE "CC=${CMAKE_C_COMPILER}\n")
endif()
if(CMAKE_CXX_COMPILER)
string(APPEND PROFILE "CXX=${CMAKE_CXX_COMPILER}\n")
endif()
if(CMAKE_RC_COMPILER)
string(APPEND PROFILE "RC=${CMAKE_RC_COMPILER}\n")
endif()
endmacro()
...
string(APPEND PROFILE "[buildenv]\n")

propagate compilers

append_buildenv_configuration()

@memsharded
Copy link
Member

conan-io/conan#15946 has been merged it will be in the next Conan 2.3 release

@memsharded
Copy link
Member

This ticket was closed by #632

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants