All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Make C and CXX compiler cache in toolchainfile.cmake.in
@ 2018-03-25 10:36 Michael Dick
  2018-03-25 10:42 ` daggs
  2018-03-30 19:57 ` Arnout Vandecappelle
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Dick @ 2018-03-25 10:36 UTC (permalink / raw)
  To: buildroot

Hello,

I am using buildroot to create my custom gcc toolchain and sysroot for a
raspberry pi. 

 

Therefore, I call cmake with a script to configure my project. After that, I
import the project into qtcreator.

The problem is, that C and CXX compiler variables are not cached into cmake
cache, so when importing the project, qtcreator calling cmake is not aware
oft he configured compiler.

 

My suggestion ist o use this patch. Is there any reason why the compilers
are not cached?

 

 

Best regards

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180325/9f6edfa3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: toolchainfile.patch
Type: application/octet-stream
Size: 800 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180325/9f6edfa3/attachment.obj>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] Make C and CXX compiler cache in toolchainfile.cmake.in
  2018-03-25 10:36 [Buildroot] Make C and CXX compiler cache in toolchainfile.cmake.in Michael Dick
@ 2018-03-25 10:42 ` daggs
  2018-03-25 18:58   ` Thomas Petazzoni
  2018-03-30 19:57 ` Arnout Vandecappelle
  1 sibling, 1 reply; 7+ messages in thread
From: daggs @ 2018-03-25 10:42 UTC (permalink / raw)
  To: buildroot

Greetings Michael,
?

>Sent:?Sunday, March 25, 2018 at 1:36 PM
>From:?"Michael Dick" <mi-dick@gmx.de>
>To:?buildroot at busybox.net
>Subject:?[Buildroot] Make C and CXX compiler cache in toolchainfile.cmake.in
>
>Hello,
>I am using buildroot to create my custom gcc toolchain and sysroot for a raspberry pi.
>?
>Therefore, I call cmake with a script to configure my project. After that, I import the project into qtcreator.
>The problem is, that C and CXX compiler variables are not cached into cmake cache, so when importing the project, qtcreator calling cmake is not aware oft he >configured compiler.
>?
>My suggestion ist o use this patch. Is there any reason why the compilers are not cached?
>?
>?
>Best regards
>
>_______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot

if you are trying to use Buildroot to generate a cross compiler, than you are using the wrong too, look for crosstool-ng

Dagg.
?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] Make C and CXX compiler cache in toolchainfile.cmake.in
  2018-03-25 10:42 ` daggs
@ 2018-03-25 18:58   ` Thomas Petazzoni
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2018-03-25 18:58 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 25 Mar 2018 12:42:53 +0200, daggs wrote:

> if you are trying to use Buildroot to generate a cross compiler, than
> you are using the wrong too, look for crosstool-ng

That's not quite correct at all:

 1. Crosstool-NG generates just a toolchain, with no additional
    libraries (besides the C library). So if what you're looking for is
    to build application linked against a number of libraries, you need
    more than a "pure" toolchain, and Crosstool-NG will not help you
    with this, while Buildroot will.

 2. Buildroot can perfectly be used to generate toolchains. See
    http://toolchains.bootlin.com for an illustration.

Best regards,

Thomas Petazzoni
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] Make C and CXX compiler cache in toolchainfile.cmake.in
  2018-03-25 10:36 [Buildroot] Make C and CXX compiler cache in toolchainfile.cmake.in Michael Dick
  2018-03-25 10:42 ` daggs
@ 2018-03-30 19:57 ` Arnout Vandecappelle
  2018-03-30 21:05   ` Yann E. MORIN
  2018-04-02  7:12   ` Luca Ceresoli
  1 sibling, 2 replies; 7+ messages in thread
From: Arnout Vandecappelle @ 2018-03-30 19:57 UTC (permalink / raw)
  To: buildroot



On 25-03-18 12:36, Michael Dick wrote:
> Hello,
> 
> I am using buildroot to create my custom gcc toolchain and sysroot for a
> raspberry pi.
> 
> ?
> 
> Therefore, I call cmake with a script to configure my project. After that, I
> import the project into qtcreator.
> 
> The problem is, that C and CXX compiler variables are not cached into cmake
> cache, so when importing the project, qtcreator calling cmake is not aware oft
> he configured compiler.
> 
> ?
> 
> My suggestion ist o use this patch. Is there any reason why the compilers are
> not cached?

 Sounds to me like a good idea.

 Let's add Yann, Samuel and Luca in Cc as CMake experts :-P For their
convenience, here is the patch inline:

> --- /tmp/toolchainfile.cmake.in.orig    2018-03-25 12:32:03.353000419 +0200
> +++ /tmp/toolchainfile.cmake.in 2018-03-25 12:32:52.647000419 +0200
> @@ -58,8 +58,8 @@
>  set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
>  
>  # This toolchain file can be used both inside and outside Buildroot.
> -set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
> -set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
> +set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@" CACHE STRING "C Compiler")
> +set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@" CACHE STRING "CXX Compiler")
>  if(@@TOOLCHAIN_HAS_FORTRAN@@)
>    set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS")
>    set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS")


 Michael, could you resubmit as a proper patch with commit log and
Signed-off-by? See [1].

 Regards,
 Arnout

[1] https://buildroot.org/downloads/manual/manual.html#submitting-patches

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] Make C and CXX compiler cache in toolchainfile.cmake.in
  2018-03-30 19:57 ` Arnout Vandecappelle
@ 2018-03-30 21:05   ` Yann E. MORIN
  2018-04-02  7:12   ` Luca Ceresoli
  1 sibling, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2018-03-30 21:05 UTC (permalink / raw)
  To: buildroot

Arnout, All,

On 2018-03-30 21:57 +0200, Arnout Vandecappelle spake thusly:
> On 25-03-18 12:36, Michael Dick wrote:
> > My suggestion ist o use this patch. Is there any reason why the compilers are
> > not cached?
> 
>  Sounds to me like a good idea.
> 
>  Let's add Yann, Samuel and Luca in Cc as CMake experts :-P

I wonder at what time I gained this expertise level in a tool I rarely
use... ;-)

> For their
> convenience, here is the patch inline:
> 
> > --- /tmp/toolchainfile.cmake.in.orig    2018-03-25 12:32:03.353000419 +0200
> > +++ /tmp/toolchainfile.cmake.in 2018-03-25 12:32:52.647000419 +0200
> > @@ -58,8 +58,8 @@
> >  set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> >  
> >  # This toolchain file can be used both inside and outside Buildroot.
> > -set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
> > -set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
> > +set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@" CACHE STRING "C Compiler")
> > +set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@" CACHE STRING "CXX Compiler")

I have absolutely no clue what this means...

Regards,
Yann E. MORIN.

> >  if(@@TOOLCHAIN_HAS_FORTRAN@@)
> >    set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS")
> >    set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS")
> 
> 
>  Michael, could you resubmit as a proper patch with commit log and
> Signed-off-by? See [1].
> 
>  Regards,
>  Arnout
> 
> [1] https://buildroot.org/downloads/manual/manual.html#submitting-patches
> 
> -- 
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> Essensium/Mind                                http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] Make C and CXX compiler cache in toolchainfile.cmake.in
  2018-03-30 19:57 ` Arnout Vandecappelle
  2018-03-30 21:05   ` Yann E. MORIN
@ 2018-04-02  7:12   ` Luca Ceresoli
  2018-04-08 19:53     ` Samuel Martin
  1 sibling, 1 reply; 7+ messages in thread
From: Luca Ceresoli @ 2018-04-02  7:12 UTC (permalink / raw)
  To: buildroot

Hi,

On 30/03/2018 21:57, Arnout Vandecappelle wrote:
> 
> 
> On 25-03-18 12:36, Michael Dick wrote:
>> Hello,
>>
>> I am using buildroot to create my custom gcc toolchain and sysroot for a
>> raspberry pi.
>>
>> ?
>>
>> Therefore, I call cmake with a script to configure my project. After that, I
>> import the project into qtcreator.
>>
>> The problem is, that C and CXX compiler variables are not cached into cmake
>> cache, so when importing the project, qtcreator calling cmake is not aware oft
>> he configured compiler.
>>
>> ?
>>
>> My suggestion ist o use this patch. Is there any reason why the compilers are
>> not cached?
> 
>  Sounds to me like a good idea.
> 
>  Let's add Yann, Samuel and Luca in Cc as CMake experts :-P For their
> convenience, here is the patch inline:
> 
>> --- /tmp/toolchainfile.cmake.in.orig    2018-03-25 12:32:03.353000419 +0200
>> +++ /tmp/toolchainfile.cmake.in 2018-03-25 12:32:52.647000419 +0200
>> @@ -58,8 +58,8 @@
>>  set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
>>  
>>  # This toolchain file can be used both inside and outside Buildroot.
>> -set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
>> -set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
>> +set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@" CACHE STRING "C Compiler")
>> +set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@" CACHE STRING "CXX Compiler")

Although my cmake wisdom is definitely overrated here, I *do* have a
kind of clue of what this means! :-)

I think this change makes sense, and this is confirmed by the fact that
CMake does it as well by default. I tested with a minimal project:

$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(hello)
add_executable(hello hello.c utils.c)
$ cmake .
[...]
$ grep COMPILER CMakeCache.txt
CMAKE_CXX_COMPILER:FILEPATH=/usr/lib/ccache/c++
CMAKE_C_COMPILER:FILEPATH=/usr/lib/ccache/cc
[...]
$

>>  if(@@TOOLCHAIN_HAS_FORTRAN@@)
>>    set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS")
>>    set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS")
> 
> 
>  Michael, could you resubmit as a proper patch with commit log and
> Signed-off-by? See [1].

And keep me Cc:.

Bye,
-- 
Luca

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] Make C and CXX compiler cache in toolchainfile.cmake.in
  2018-04-02  7:12   ` Luca Ceresoli
@ 2018-04-08 19:53     ` Samuel Martin
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Martin @ 2018-04-08 19:53 UTC (permalink / raw)
  To: buildroot

Hi all,

Apologies for the late response.

On Mon, Apr 2, 2018 at 9:12 AM, Luca Ceresoli <luca@lucaceresoli.net> wrote:
> Hi,
>
> On 30/03/2018 21:57, Arnout Vandecappelle wrote:
>>
>>
>> On 25-03-18 12:36, Michael Dick wrote:
>>> Hello,
>>>
>>> I am using buildroot to create my custom gcc toolchain and sysroot for a
>>> raspberry pi.
>>>
>>>
>>>
>>> Therefore, I call cmake with a script to configure my project. After that, I
>>> import the project into qtcreator.
>>>
>>> The problem is, that C and CXX compiler variables are not cached into cmake
>>> cache, so when importing the project, qtcreator calling cmake is not aware oft
>>> he configured compiler.
>>>
>>>
>>>
>>> My suggestion ist o use this patch. Is there any reason why the compilers are
>>> not cached?
>>
>>  Sounds to me like a good idea.
>>
>>  Let's add Yann, Samuel and Luca in Cc as CMake experts :-P For their
>> convenience, here is the patch inline:
>>
>>> --- /tmp/toolchainfile.cmake.in.orig    2018-03-25 12:32:03.353000419 +0200
>>> +++ /tmp/toolchainfile.cmake.in 2018-03-25 12:32:52.647000419 +0200
>>> @@ -58,8 +58,8 @@
>>>  set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
>>>
>>>  # This toolchain file can be used both inside and outside Buildroot.
>>> -set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
>>> -set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
>>> +set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@" CACHE STRING "C Compiler")
>>> +set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@" CACHE STRING "CXX Compiler")
>
> Although my cmake wisdom is definitely overrated here, I *do* have a
> kind of clue of what this means! :-)
>
> I think this change makes sense, and this is confirmed by the fact that
> CMake does it as well by default. I tested with a minimal project:

I second, I even wonder why I did not add it for the complers paths in
the first place whereas I did add it to the various compiler flags
variables... :-/

>
> $ cat CMakeLists.txt
> cmake_minimum_required(VERSION 2.6)
> project(hello)
> add_executable(hello hello.c utils.c)
> $ cmake .
> [...]
> $ grep COMPILER CMakeCache.txt
> CMAKE_CXX_COMPILER:FILEPATH=/usr/lib/ccache/c++
> CMAKE_C_COMPILER:FILEPATH=/usr/lib/ccache/cc
> [...]
> $
>
>>>  if(@@TOOLCHAIN_HAS_FORTRAN@@)
>>>    set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS")
>>>    set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS")
>>
>>
>>  Michael, could you resubmit as a proper patch with commit log and
>> Signed-off-by? See [1].
>
> And keep me Cc:.
>
> Bye,
> --
> Luca
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

Regards,

-- 
Samuel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-04-08 19:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-25 10:36 [Buildroot] Make C and CXX compiler cache in toolchainfile.cmake.in Michael Dick
2018-03-25 10:42 ` daggs
2018-03-25 18:58   ` Thomas Petazzoni
2018-03-30 19:57 ` Arnout Vandecappelle
2018-03-30 21:05   ` Yann E. MORIN
2018-04-02  7:12   ` Luca Ceresoli
2018-04-08 19:53     ` Samuel Martin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.