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

cmake: enable crosscompilation of boost #14881

Merged
merged 2 commits into from May 2, 2017

Conversation

Projects
None yet
2 participants
@tchaikov
Contributor

tchaikov commented Apr 29, 2017

and various changes for enabling cross-compiling on armhf.

see also: http://tracker.ceph.com/issues/18938

i guess downstream maintainers would be happier at seeing this.

cmake: enable crosscompile of boost
Signed-off-by: Kefu Chai <kchai@redhat.com>

@tchaikov tchaikov added the cleanup label Apr 29, 2017

@tchaikov tchaikov requested review from , cbodley and dillaman Apr 29, 2017

@tchaikov

This comment has been minimized.

Show comment
Hide comment
@tchaikov

tchaikov Apr 29, 2017

Contributor

copying @smithfarm , in case you are interested =)

Contributor

tchaikov commented Apr 29, 2017

copying @smithfarm , in case you are interested =)

cmake: pass compiler and linker down to zstd
so it can respect the setting specfied by user.

Signed-off-by: Kefu Chai <kchai@redhat.com>

@tchaikov tchaikov changed the title from cmake: enable crosscompile of boost to cmake: enable crosscompilation of boost May 1, 2017

@tchaikov tchaikov removed request for and dillaman May 1, 2017

@tchaikov

This comment has been minimized.

Show comment
Hide comment
@tchaikov

tchaikov May 1, 2017

Contributor

fwiw, i am using following cmake toolchain file for the cross-compilation

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(TOOLCHAIN_PREFIX arm-linux-gnueabihf)

set(CMAKE_C_COMPILER   /usr/bin/${TOOLCHAIN_PREFIX}-gcc CACHE FILEPATH "C compiler")
set(CMAKE_CXX_COMPILER /usr/bin/${TOOLCHAIN_PREFIX}-g++ CACHE FILEPATH "CXX compiler")
set(CMAKE_AR /usr/bin/arm-linux-gnueabihf-ar CACHE FILEPATH "Archiver")
set(CMAKE_STRIP /usr/bin/arm-linux-gnueabihf-strip FILEPATH "Diet Cola")

set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX} /lib/${TOOLCHAIN_PREFIX} /usr/lib/${TOOLCHAIN_PREFIX})
set(ENV{PKG_CONFIG_PATH} "/usr/lib/${TOOLCHAIN_PREFIX}/pkgconfig/")
Contributor

tchaikov commented May 1, 2017

fwiw, i am using following cmake toolchain file for the cross-compilation

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(TOOLCHAIN_PREFIX arm-linux-gnueabihf)

set(CMAKE_C_COMPILER   /usr/bin/${TOOLCHAIN_PREFIX}-gcc CACHE FILEPATH "C compiler")
set(CMAKE_CXX_COMPILER /usr/bin/${TOOLCHAIN_PREFIX}-g++ CACHE FILEPATH "CXX compiler")
set(CMAKE_AR /usr/bin/arm-linux-gnueabihf-ar CACHE FILEPATH "Archiver")
set(CMAKE_STRIP /usr/bin/arm-linux-gnueabihf-strip FILEPATH "Diet Cola")

set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX} /lib/${TOOLCHAIN_PREFIX} /usr/lib/${TOOLCHAIN_PREFIX})
set(ENV{PKG_CONFIG_PATH} "/usr/lib/${TOOLCHAIN_PREFIX}/pkgconfig/")
COMMAND
sed -i
"s|using ${b2_cc} ;|using ${b2_cc} : ${CMAKE_SYSTEM_PROCESSOR} : ${CMAKE_CXX_COMPILER} ;|"
${PROJECT_SOURCE_DIR}/src/boost/project-config.jam)

This comment has been minimized.

@cbodley

cbodley May 1, 2017

Contributor

any way to avoid editing this src file? this has some side effects:

  • once set, you can't change target architecture unless you revert project-config.jam changes
  • can't run multiple cross-compiles in parallel
@cbodley

cbodley May 1, 2017

Contributor

any way to avoid editing this src file? this has some side effects:

  • once set, you can't change target architecture unless you revert project-config.jam changes
  • can't run multiple cross-compiles in parallel

This comment has been minimized.

@tchaikov

tchaikov May 1, 2017

Contributor

@cbodley our boost building process is not friendly to the use case you mentioned above: it creates b2/bjam, settings files and other asserts in source directory. for example, the executable of "b2", "bjam", and the header directory of "boost" are all created right in the source tree of boost. please check its .gitignore for more details. in other words, the boost building process(es) will inherently interfere with each other with existing approach.

maybe i could find a way to fix this so we can have a true out-of-source build. but maybe not today. as ExternalProject's building process is run on demand, and we can hardly ready boost's header directories without building it. and cmake does check for the existence of header directories at seeing include_directories(). so we might need to run cmake in a tricky way to address this issue, for example, by instructing cmake to launch itself again just for building boost. but again, we probably should address this in another PR.

@tchaikov

tchaikov May 1, 2017

Contributor

@cbodley our boost building process is not friendly to the use case you mentioned above: it creates b2/bjam, settings files and other asserts in source directory. for example, the executable of "b2", "bjam", and the header directory of "boost" are all created right in the source tree of boost. please check its .gitignore for more details. in other words, the boost building process(es) will inherently interfere with each other with existing approach.

maybe i could find a way to fix this so we can have a true out-of-source build. but maybe not today. as ExternalProject's building process is run on demand, and we can hardly ready boost's header directories without building it. and cmake does check for the existence of header directories at seeing include_directories(). so we might need to run cmake in a tricky way to address this issue, for example, by instructing cmake to launch itself again just for building boost. but again, we probably should address this in another PR.

@tchaikov tchaikov added the build/ops label May 1, 2017

@cbodley

cbodley approved these changes May 1, 2017

thanks for the explanation 👍 stuff to keep in mind for the future (should also consider moving this boost logic into a cmake module at some point)

@tchaikov tchaikov merged commit 6ce6acf into ceph:master May 2, 2017

3 checks passed

Signed-off-by all commits in this PR are signed
Details
Unmodifed Submodules submodules for project are unmodified
Details
default Build finished.
Details

@tchaikov tchaikov deleted the tchaikov:wip-crosscompiling-armhf branch May 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment