Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] pkg-cmake: add CMAKE_SYSTEM_VERSION to toolchainfile.cmake
Date: Sat, 12 Jan 2019 16:23:43 +0100	[thread overview]
Message-ID: <20190112152343.GG2428@scaer> (raw)
In-Reply-To: <20190112160629.5a85748b@windsurf.home>

Thomas, Arnout, All,

On 2019-01-12 16:06 +0100, Thomas Petazzoni spake thusly:
> On Fri, 11 Jan 2019 22:16:26 +0100, Yann E. MORIN wrote:
> 
> > > the
> > > value of BR2_TOOLCHAIN_HEADERS_AT_LEAST contains the (minimum) version
> > > of the kernel it will run on,  
> > 
> > That is not true.
> > 
> > glibc for example will by default carry fallback mechanisms to emulate
> > some features when it is running on a kernel older than the headers it
> > was compiled against. In Buildroot we explictly disable that feature by
> > passing --enable-kernel=$(BR2_TOOLCHAIN_HEADERS_AT_LEAST).
> > 
> > But for external toolchains, we don't know (and can't know) iw they did
> > pass that option or not, and if they did, what version they requested,
> > and if they did not, what version glibc uses.
> > 
> > This backward compatibility of glibc can extend quite a bit in the past,
> > so kernels we would consider pretty old might still be usable with such
> > toolchains. For example, on glibc-2.24, the minimum required headers
> > were 3.2, but the runtime could be 2.6.32 on x86_64.
> > 
> > So, we could very well end up building a Buildroot system that runs on a
> > kernel older than the headers of the toolchain.
> 
> While this is true, what can we do in practice ? We have no way to know
> what will be the version of the kernel running on the target when we're
> not building it, and still we have to provide this CMAKE_SYSTEM_VERSION
> value. I am not really sure what packages are doing with
> CMAKE_SYSTEM_VERSION. For example, azure-iot-sdk was simply testing
> whether it was empty or not.
> 
> So for the time being, it seems like using the kernel headers version
> is a good enough solution, even if not perfect.

Well, random lookups on the internet for CMAKE_SYSTEM_VERSION mostly
tuen up windows- or mac-related questions, so irrelevant to us. The
only seemingly-relevant ones are dealing with android.

There are various pieces of crap here and there that just set the thing
to 1., or some variants of 1, like 1.0 or 1.0.0.

Even the official cmake wiki [0] states:

    CMAKE_SYSTEM_VERSION : optional, version of your target system, not
    used very much.

    [...]

    * CMAKE_TOOLCHAIN_FILE : absolute or relative path to a cmake script
    which sets up all the toolchain related variables mentioned above

    For instance for crosscompiling from Linux to Embedded Linux on
    PowerPC this file could look like this:

        # this one is important
        SET(CMAKE_SYSTEM_NAME Linux)
        #this one not so much
        SET(CMAKE_SYSTEM_VERSION 1)
        [...]

So my opinion would be that we do exactly what is done in the wiki: set
it to 1 (and add a pointer to the wiki) and be done with it.

Then, if/when there are issues we can re-assess the situation.

[0] https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/CrossCompiling

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2019-01-12 15:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10 23:05 [Buildroot] [PATCH 1/2] pkg-cmake: add CMAKE_SYSTEM_VERSION to toolchainfile.cmake Arnout Vandecappelle
2019-01-10 23:05 ` [Buildroot] [PATCH 2/2] azure-iot-sdk-c: remove dummy value of CMAKE_SYSTEM_VERSION Arnout Vandecappelle
2019-01-11 21:16 ` [Buildroot] [PATCH 1/2] pkg-cmake: add CMAKE_SYSTEM_VERSION to toolchainfile.cmake Yann E. MORIN
2019-01-12 15:06   ` Thomas Petazzoni
2019-01-12 15:23     ` Yann E. MORIN [this message]
2019-01-12 16:07       ` Thomas Petazzoni
2019-01-12 15:07 ` Thomas Petazzoni
2019-01-12 15:26   ` Yann E. MORIN
2019-01-24 15:50   ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190112152343.GG2428@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox