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

CMakeLists.txt shouldn't use CMAKE_SYSTEM_PROCESSOR for asm #361

Closed
blueness opened this issue Nov 10, 2017 · 6 comments
Closed

CMakeLists.txt shouldn't use CMAKE_SYSTEM_PROCESSOR for asm #361

blueness opened this issue Nov 10, 2017 · 6 comments
Labels

Comments

@blueness
Copy link

The new cmake build system makes use of CMAKE_SYSTEM_PROCESSOR which looks at the processor's architecture to decide whether to build x86_64 or i386 assembly code. This is a very bad practice because you may want to build 32-bit asm on a 64-bit system, either in a chroot, or as part of cross compiling, or for multilib systems where one invokes gcc -m32. This leads to a downstream issue in Gentoo as reported in

https://bugs.gentoo.org/636836

The problem line is at

https://github.com/libressl-portable/portable/blob/master/CMakeLists.txt#L262

@blueness
Copy link
Author

A related question: I've reverted downstream to gnu autotools build. Is libressl-portable going to continue to support both build systems?

@kinichiro
Copy link
Contributor

kinichiro commented Nov 11, 2017 via email

@busterb
Copy link
Contributor

busterb commented Nov 13, 2017

What's the CMake solution then?

@kinichiro
Copy link
Contributor

I think we can use CMAKE_TOOLCHAIN_FILE,
as cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain_xxx.cmake .

And the toolchain file will be like this,

SET(CMAKE_SYSTEM_PROCESSOR xxx)
SET(CMAKE_SYSTEM_NAME yyy)
SET(CMAKE_C_COMPILER /usr/bin/cross-compiler-path)

Toolchain file should be written by library user since there are many platforms and targets.

@kinichiro
Copy link
Contributor

@blueness Can you close this issue ? Original ticket appears to be closed already.

@busterb busterb closed this as completed Jan 8, 2018
@busterb
Copy link
Contributor

busterb commented Jan 8, 2018

I think I'd like to avoid the extra complexity that comes with coaxing cmake into cross-compiling properly. It's unfortunate that it cannot be done easily as it is with autotools.

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

No branches or pull requests

3 participants