Crosscompilation woes

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Crosscompilation woes

Robert Bielik-4
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
Reply | Threaded
Open this post in threaded view
|

Re: Crosscompilation woes

Craig Scott-3
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):


An alternative is a superbuild arrangement which would require a top level project to drive two sub-builds brought in via ExternalProject, 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 <[hidden email]> 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

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Crosscompilation woes

Robert Bielik-4

Thanks Craig,

 

Your solution will work for me I think.

 

Regards

/R

 

From: Craig Scott [mailto:[hidden email]]
Sent: den 10 oktober 2016 10:47
To: Robert Bielik <[hidden email]>
Cc: [hidden email]
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):

 

 

An alternative is a superbuild arrangement which would require a top level project to drive two sub-builds brought in via ExternalProject, 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 <[hidden email]> 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


--

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
Reply | Threaded
Open this post in threaded view
|

Re: Crosscompilation woes

portolan

In my project I build on Linux i686 and I use a Toolchain file to specify the ARM cross-compiler

https://cmake.org/cmake/help/v3.6/manual/cmake-toolchains.7.html

The nice thing is that if you mark some files as "generated" CMAKE will automatically use the build rather than the target toolchains. For instance, I have a Flex/Byson compiler that is generated locally on i686 , but then compiled for ARM.

Regards,

Michele

Le 10/10/2016 à 11:10, Robert Bielik a écrit :

Thanks Craig,

 

Your solution will work for me I think.

 

Regards

/R

 

From: Craig Scott [[hidden email]]
Sent: den 10 oktober 2016 10:47
To: Robert Bielik [hidden email]
Cc: [hidden email]
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):

 

 

An alternative is a superbuild arrangement which would require a top level project to drive two sub-builds brought in via ExternalProject, 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 <[hidden email]> 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





--

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
Reply | Threaded
Open this post in threaded view
|

Re: Crosscompilation woes

Robert Bielik-4

Thank you Michele,

 

This is exactly what I’m after. You specify cmake v3.6 docs ? Is it only working from 3.6.x ? I have 3.5.2 on my build system.

 

Regards

/Robert

 

From: portolan [mailto:[hidden email]]
Sent: den 10 oktober 2016 11:27
To: Robert Bielik <[hidden email]>; Craig Scott <[hidden email]>
Cc: [hidden email]
Subject: Re: [CMake] Crosscompilation woes

 

In my project I build on Linux i686 and I use a Toolchain file to specify the ARM cross-compiler

https://cmake.org/cmake/help/v3.6/manual/cmake-toolchains.7.html

The nice thing is that if you mark some files as "generated" CMAKE will automatically use the build rather than the target toolchains. For instance, I have a Flex/Byson compiler that is generated locally on i686 , but then compiled for ARM.

Regards,

Michele

Le 10/10/2016 à 11:10, Robert Bielik a écrit :

Thanks Craig,

 

Your solution will work for me I think.

 

Regards

/R

 

From: Craig Scott [[hidden email]]
Sent: den 10 oktober 2016 10:47
To: Robert Bielik [hidden email]
Cc: [hidden email]
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):

 

 

An alternative is a superbuild arrangement which would require a top level project to drive two sub-builds brought in via ExternalProject, 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 <[hidden email]> 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



 


--

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
Reply | Threaded
Open this post in threaded view
|

Re: Crosscompilation woes

portolan

I cannot answer your question: I am a newcomer to Cmake (I have been using it for less than 6 months) and on my build system I have 3.6, so I never really looked at the previous versions.

Sorry,


Michele


Le 10/10/2016 à 11:30, Robert Bielik a écrit :

Thank you Michele,

 

This is exactly what I’m after. You specify cmake v3.6 docs ? Is it only working from 3.6.x ? I have 3.5.2 on my build system.

 

Regards

/Robert

 

From: portolan [[hidden email]]
Sent: den 10 oktober 2016 11:27
To: Robert Bielik [hidden email]; Craig Scott [hidden email]
Cc: [hidden email]
Subject: Re: [CMake] Crosscompilation woes

 

In my project I build on Linux i686 and I use a Toolchain file to specify the ARM cross-compiler

https://cmake.org/cmake/help/v3.6/manual/cmake-toolchains.7.html

The nice thing is that if you mark some files as "generated" CMAKE will automatically use the build rather than the target toolchains. For instance, I have a Flex/Byson compiler that is generated locally on i686 , but then compiled for ARM.

Regards,

Michele

Le 10/10/2016 à 11:10, Robert Bielik a écrit :

Thanks Craig,

 

Your solution will work for me I think.

 

Regards

/R

 

From: Craig Scott [[hidden email]]
Sent: den 10 oktober 2016 10:47
To: Robert Bielik [hidden email]
Cc: [hidden email]
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):

 

 

An alternative is a superbuild arrangement which would require a top level project to drive two sub-builds brought in via ExternalProject, 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 <[hidden email]> 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



 



--

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
Reply | Threaded
Open this post in threaded view
|

Re: Crosscompilation woes

Robert Bielik-4

Ok, I cannot get this to work. The source files to be generated with add_custom_command have property GENERATED set to ON, but cmake does not adhere, and tries to use the tool binaries of the target system.

 

Michele, would you be ok with sharing your cmake code for this particular bit ?

 

Regards

/R

 

From: portolan [mailto:[hidden email]]
Sent: den 10 oktober 2016 11:33
To: Robert Bielik <[hidden email]>; Craig Scott <[hidden email]>
Cc: [hidden email]
Subject: Re: [CMake] Crosscompilation woes

 

I cannot answer your question: I am a newcomer to Cmake (I have been using it for less than 6 months) and on my build system I have 3.6, so I never really looked at the previous versions.

Sorry,

 

Michele

 

Le 10/10/2016 à 11:30, Robert Bielik a écrit :

Thank you Michele,

 

This is exactly what I’m after. You specify cmake v3.6 docs ? Is it only working from 3.6.x ? I have 3.5.2 on my build system.

 

Regards

/Robert

 

From: portolan [[hidden email]]
Sent: den 10 oktober 2016 11:27
To: Robert Bielik [hidden email]; Craig Scott [hidden email]
Cc: [hidden email]
Subject: Re: [CMake] Crosscompilation woes

 

In my project I build on Linux i686 and I use a Toolchain file to specify the ARM cross-compiler

https://cmake.org/cmake/help/v3.6/manual/cmake-toolchains.7.html

The nice thing is that if you mark some files as "generated" CMAKE will automatically use the build rather than the target toolchains. For instance, I have a Flex/Byson compiler that is generated locally on i686 , but then compiled for ARM.

Regards,

Michele

Le 10/10/2016 à 11:10, Robert Bielik a écrit :

Thanks Craig,

 

Your solution will work for me I think.

 

Regards

/R

 

From: Craig Scott [[hidden email]]
Sent: den 10 oktober 2016 10:47
To: Robert Bielik [hidden email]
Cc: [hidden email]
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):

 

 

An alternative is a superbuild arrangement which would require a top level project to drive two sub-builds brought in via ExternalProject, 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 <[hidden email]> 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




 

 


--

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
Reply | Threaded
Open this post in threaded view
|

Re: Crosscompilation woes

portolan

It is pretty much standard. I wrote the toolchain file adapting different examples.

the Cmakelist is for the subdirectory of my parser (called SIT_parser). The trick si that I use a custom command for Lex/Yacc, so even when cross-compiling it is still correctly called.


Michele



Le 10/10/2016 à 12:48, Robert Bielik a écrit :

Ok, I cannot get this to work. The source files to be generated with add_custom_command have property GENERATED set to ON, but cmake does not adhere, and tries to use the tool binaries of the target system.

 

Michele, would you be ok with sharing your cmake code for this particular bit ?

 

Regards

/R

 

From: portolan [[hidden email]]
Sent: den 10 oktober 2016 11:33
To: Robert Bielik [hidden email]; Craig Scott [hidden email]
Cc: [hidden email]
Subject: Re: [CMake] Crosscompilation woes

 

I cannot answer your question: I am a newcomer to Cmake (I have been using it for less than 6 months) and on my build system I have 3.6, so I never really looked at the previous versions.

Sorry,

 

Michele

 

Le 10/10/2016 à 11:30, Robert Bielik a écrit :

Thank you Michele,

 

This is exactly what I’m after. You specify cmake v3.6 docs ? Is it only working from 3.6.x ? I have 3.5.2 on my build system.

 

Regards

/Robert

 

From: portolan [[hidden email]]
Sent: den 10 oktober 2016 11:27
To: Robert Bielik [hidden email]; Craig Scott [hidden email]
Cc: [hidden email]
Subject: Re: [CMake] Crosscompilation woes

 

In my project I build on Linux i686 and I use a Toolchain file to specify the ARM cross-compiler

https://cmake.org/cmake/help/v3.6/manual/cmake-toolchains.7.html

The nice thing is that if you mark some files as "generated" CMAKE will automatically use the build rather than the target toolchains. For instance, I have a Flex/Byson compiler that is generated locally on i686 , but then compiled for ARM.

Regards,

Michele

Le 10/10/2016 à 11:10, Robert Bielik a écrit :

Thanks Craig,

 

Your solution will work for me I think.

 

Regards

/R

 

From: Craig Scott [[hidden email]]
Sent: den 10 oktober 2016 10:47
To: Robert Bielik [hidden email]
Cc: [hidden email]
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):

 

 

An alternative is a superbuild arrangement which would require a top level project to drive two sub-builds brought in via ExternalProject, 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 <[hidden email]> 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




 

 





--

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

Toolchain-arm.cmake (1K) Download Attachment
CMakeLists_example.txt (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Crosscompilation woes

Robert Bielik-4

Aha, I see. You’re using find_package. That will automatically get you the binaries for your host system.

 

My problem is different, I need to build my binaries with CMake before using them, and I need to build them with i686 (instead of arm).

 

Regards

/R

 

From: portolan [mailto:[hidden email]]
Sent: den 10 oktober 2016 13:14
To: Robert Bielik <[hidden email]>; [hidden email]
Subject: Re: [CMake] Crosscompilation woes

 

It is pretty much standard. I wrote the toolchain file adapting different examples.

the Cmakelist is for the subdirectory of my parser (called SIT_parser). The trick si that I use a custom command for Lex/Yacc, so even when cross-compiling it is still correctly called.

 

Michele

 

 

Le 10/10/2016 à 12:48, Robert Bielik a écrit :

Ok, I cannot get this to work. The source files to be generated with add_custom_command have property GENERATED set to ON, but cmake does not adhere, and tries to use the tool binaries of the target system.

 

Michele, would you be ok with sharing your cmake code for this particular bit ?

 

Regards

/R

 

From: portolan [[hidden email]]
Sent: den 10 oktober 2016 11:33
To: Robert Bielik [hidden email]; Craig Scott [hidden email]
Cc: [hidden email]
Subject: Re: [CMake] Crosscompilation woes

 

I cannot answer your question: I am a newcomer to Cmake (I have been using it for less than 6 months) and on my build system I have 3.6, so I never really looked at the previous versions.

Sorry,

 

Michele

 

Le 10/10/2016 à 11:30, Robert Bielik a écrit :

Thank you Michele,

 

This is exactly what I’m after. You specify cmake v3.6 docs ? Is it only working from 3.6.x ? I have 3.5.2 on my build system.

 

Regards

/Robert

 

From: portolan [[hidden email]]
Sent: den 10 oktober 2016 11:27
To: Robert Bielik [hidden email]; Craig Scott [hidden email]
Cc: [hidden email]
Subject: Re: [CMake] Crosscompilation woes

 

In my project I build on Linux i686 and I use a Toolchain file to specify the ARM cross-compiler

https://cmake.org/cmake/help/v3.6/manual/cmake-toolchains.7.html

The nice thing is that if you mark some files as "generated" CMAKE will automatically use the build rather than the target toolchains. For instance, I have a Flex/Byson compiler that is generated locally on i686 , but then compiled for ARM.

Regards,

Michele

Le 10/10/2016 à 11:10, Robert Bielik a écrit :

Thanks Craig,

 

Your solution will work for me I think.

 

Regards

/R

 

From: Craig Scott [[hidden email]]
Sent: den 10 oktober 2016 10:47
To: Robert Bielik [hidden email]
Cc: [hidden email]
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):

 

 

An alternative is a superbuild arrangement which would require a top level project to drive two sub-builds brought in via ExternalProject, 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 <[hidden email]> 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





 

 



 


--

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
Reply | Threaded
Open this post in threaded view
|

Re: Crosscompilation woes

Robert Bielik-4
In reply to this post by Craig Scott-3

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:[hidden email]]
Sent: den 10 oktober 2016 10:47
To: Robert Bielik <[hidden email]>
Cc: [hidden email]
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):

 

 

An alternative is a superbuild arrangement which would require a top level project to drive two sub-builds brought in via ExternalProject, 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 <[hidden email]> 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


--

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
Reply | Threaded
Open this post in threaded view
|

Re: Crosscompilation woes

Craig Scott-3
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 <[hidden email]> 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:[hidden email]]
Sent: den 10 oktober 2016 10:47
To: Robert Bielik <[hidden email]>
Cc: [hidden email]
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):

 

 

An alternative is a superbuild arrangement which would require a top level project to drive two sub-builds brought in via ExternalProject, 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 <[hidden email]> 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




--
Craig Scott
Melbourne, Australia

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Crosscompilation woes

Robert Bielik-4

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:[hidden email]]
Sent: den 10 oktober 2016 13:56
To: Robert Bielik <[hidden email]>
Cc: [hidden email]
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 <[hidden email]> 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:[hidden email]]
Sent: den 10 oktober 2016 10:47
To: Robert Bielik <[hidden email]>
Cc: [hidden email]
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):

 

 

An alternative is a superbuild arrangement which would require a top level project to drive two sub-builds brought in via ExternalProject, 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 <[hidden email]> 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



 

--

Craig Scott

Melbourne, Australia


--

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