[CMake] [SOLVED] RE: Crosscompilation woes

Chuck Atkins chuck.atkins at kitware.com
Tue Oct 11 11:10:22 EDT 2016


In VTK and ParaView we use a manual two-step build.  The first pass
configures a host build of the cross-compile utilities and the second pass
configures a target build with a toolchain file, which requires you tell it
where the host tools are.  So the build process looks like this:

mkdir build_host
cd build_host
cmake -DBUILD_CROSSTOOLS=ON /path/to/source
make
cd ..
mkdir build_target
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/tolchain.cmake
-DFOO_CROSSTOOLS_DIR=/path/to/build_host
make

You should be able to adapt this to a superbuild scenario with two external
projects and it seems like that's exactly what you've done.  Just
confirming that yes that's a sane approach and that's how we do it to.


----------
Chuck Atkins
Staff R&D Engineer, Scientific Computing
Kitware, Inc.


On Mon, Oct 10, 2016 at 9:56 AM, Robert Bielik <Robert.Bielik at dirac.com>
wrote:

> For reference: I went with Brads suggestion: https://gitlab.kitware.com/
> cmake/cmake/issues/16356
>
>
>
> which seems to be working fine.
>
>
>
> Regards
>
> /R
>
>
>
> *From:* CMake [mailto:cmake-bounces at cmake.org] *On Behalf Of *Robert
> Bielik
> *Sent:* den 10 oktober 2016 14:00
> *To:* Craig Scott <craig.scott at crascit.com>
>
> *Cc:* Cmake at cmake.org
> *Subject:* Re: [CMake] Crosscompilation woes
>
>
>
> I am using a toolchain file! The CC and CXX environment variables are set
> by CMake (I assume, because I haven’t touched them).
>
>
>
> I’ll disect the link to see what I’ve missed.
>
>
>
> Regards
>
> /R
>
>
>
> *From:* Craig Scott [mailto:craig.scott at crascit.com
> <craig.scott at crascit.com>]
> *Sent:* den 10 oktober 2016 13:56
> *To:* Robert Bielik <Robert.Bielik at dirac.com>
> *Cc:* Cmake at cmake.org
> *Subject:* Re: [CMake] Crosscompilation woes
>
>
>
> Don't use environment variables to set the ARM compilers in your
> situation, use a toolchain file to specify them instead. Your CMake
> experience will generally be smoother if you specify cross-compile details
> via toolchain files. If you are following the method in the stackoverflow
> link I mentioned last time, the host part of the build will then pick up
> the host compilers and the ARM part of the build will use the compilers
> from the toolchain file.
>
>
>
>
>
> On Mon, Oct 10, 2016 at 10:50 PM, Robert Bielik <Robert.Bielik at dirac.com>
> wrote:
>
> I’m trying to do this, but since I setup a cross compiling env. by setting
> C&C++ compiler, these settings get used when I run execute_process to setup
> the host build !! Thus I get the ARM version of the build tools anyway! :(
>
>
>
> It seems that when execute_process is executed, the CC and CXX environment
> variables are set, which makes cmake use those when generating the
> makefiles.
>
>
>
> Ideas are most welcome!
>
>
>
> Regards
>
> /R
>
>
>
> *From:* Craig Scott [mailto:craig.scott at crascit.com]
> *Sent:* den 10 oktober 2016 10:47
> *To:* Robert Bielik <Robert.Bielik at dirac.com>
> *Cc:* Cmake at cmake.org
> *Subject:* Re: [CMake] Crosscompilation woes
>
>
>
> Here's one possible solution (not perfect, but has been working in
> production for us for a while now for a similar scenario to what you
> describe):
>
>
>
> http://stackoverflow.com/q/36084785/1938798
>
>
>
> An alternative is a superbuild arrangement which would require a top level
> project to drive two sub-builds brought in via ExternalProject
> <https://cmake.org/cmake/help/latest/module/ExternalProject.html>, one
> for the host and the other for arm. This is both better and worse,
> depending on your point of view, so you may need to do some
> research/experimenting to see which is a better fit for your situation.
>
>
>
>
>
> On Mon, Oct 10, 2016 at 7:29 PM, Robert Bielik <Robert.Bielik at dirac.com>
> wrote:
>
> Hi all,
>
> I am crosscompiling a project for arm (on linux i686), and use
> codegeneration tools within the project (together with add_custom_command).
> Of course, this will fail, since the tools are compiled for arm also and
> thus won't execute on my host system. So the tools need to be compiled for
> i686 whilst the rest for arm. I'm sure this can be handled by CMake
> although haven't done it before so would appreciate pointers :)
>
> Regards
> /Robert
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
>
>
>
>
> --
>
> Craig Scott
>
> Melbourne, Australia
>
> https://crascit.com
>
>
>
>
>
> --
>
> Craig Scott
>
> Melbourne, Australia
>
> https://crascit.com
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161011/6bc1500d/attachment-0001.html>


More information about the CMake mailing list