Results 1 to 7 of 7

Thread: GCC minimal version requirement

  1. #1

    Question GCC minimal version requirement

    Hello,
    To build the latest version of Qt Creator (4.3), GCC 4.9 is a minimal requirement. This is what I tried to ensure I have it built in Leap 42.2, 42.3 and Tumbleweed:

    • Adding to spec file
      Code:
      BuildRequires: gcc >= 4.9
      does not work (nothing defines gcc >= 4.9), since in Leap distribution the latest version you can get for gcc is GCC 4.8.5.


    • I required gcc-5 with
      Code:
      BuildRequires: gcc5
      but this breaks Tumbleweed (gcc5 does not exists in Tumbleweed where default compiler is newer).


    • I tried detecting Thumbleweed as explained here (section Theory, added also quotes around the suse_version macro), but again it did not work.
    • I tried also to get gcc version with shell expansion, but it does not work either, since shell expansion is deactivated when build requirements are parsed.

    I hope this is clear enough. Anyway, all the tries should be visible in my OBS repository.

    Notice there would be a solution with newer versions of RPM with boolean dependencies:
    Code:
    BuildRequires: (gcc >= 4.9 or gcc-5)
    I would thus want to know if there is a cross distribution (or at least a cross SUSE) way to add a build requirement for gcc >= 4.9 or an accurate way to detect Tumbleweed. Any hints would be greatly appreciated. Thanks in advance.

    Best regards,
    Pascom

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    23,353
    Blog Entries
    15

    Default Re: GCC minimal version requirement

    On Thu 13 Jul 2017 11:36:01 AM CDT, pascom wrote:

    Hello,
    To build the latest version of Qt Creator (4.3), GCC 4.9 is a minimal
    requirement. This is what I tried to ensure I have it built in Leap
    42.2, 42.3 and Tumbleweed:


    - Adding to spec file

    Code:
    --------------------
    BuildRequires: gcc >= 4.9
    --------------------

    does not work (nothing defines gcc >= 4.9), since in Leap distribution
    the latest version you can get for gcc is GCC 4.8.5.



    - I required gcc-5 with

    Code:
    --------------------
    BuildRequires: gcc5
    --------------------

    but this breaks Tumbleweed (gcc5 does not exists in Tumbleweed where
    default compiler is newer).



    - I tried detecting Thumbleweed as explained 'here'
    (https://en.opensuse.org/Archive:How_...ect_Tumbleweed) (section
    Theory, added also quotes around the suse_version macro), but again it
    did not work.
    - I tried also to get gcc version with shell expansion, but it does
    not work either, since shell expansion is deactivated when build
    requirements are parsed.

    I hope this is clear enough. Anyway, all the tries should be visible in
    'my OBS repository'
    (https://build.opensuse.org/package/s...scom/qtcreator).

    Notice there would be a solution with newer versions of RPM with
    'boolean dependencies' (http://rpm.org/user_doc/more_dependencies.html):

    Code:
    --------------------
    BuildRequires: (gcc >= 4.9 or gcc-5)
    --------------------


    I would thus want to know if there is a cross distribution (or at least
    a cross SUSE) way to add a build requirement for gcc >= 4.9 or an
    accurate way to detect Tumbleweed. Any hints would be greatly
    appreciated. Thanks in advance.

    Best regards,
    Pascom


    Hi
    So look at using an if statement...?

    Code:
    %if 0%{?suse_version} > 1320
    BuildRequires: gcc
    %else
    BuildRequires: gcc5
    %endif
    https://en.opensuse.org/openSUSE:Bui...ribution_howto

    --
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    openSUSE Leap 42.2|GNOME 3.20.2|4.4.74-18.20-default
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!


  3. #3
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    8,140

    Default Re: GCC minimal version requirement

    When "nothing provides" appears,
    To me that means the requirement isn't fulfilled.

    GCC6 is available
    https://software.opensuse.org/package/gcc6

    GCC7 is available
    https://software.opensuse.org/package/gcc7

    If you are unable to modify your spec file to point to these alternative GCC installed side by side with the default installed,
    I've posted how to create an update-alternatives so you can switch your entire system to whatever you wish
    https://en.opensuse.org/User:Tsu2/gc...e-alternatives

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  4. #4
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    23,353
    Blog Entries
    15

    Default Re: GCC minimal version requirement

    On Thu 13 Jul 2017 01:46:01 PM CDT, tsu2 wrote:

    When "nothing provides" appears,
    To me that means the requirement isn't fulfilled.

    GCC6 is available
    https://software.opensuse.org/package/gcc6

    GCC7 is available
    https://software.opensuse.org/package/gcc7

    If you are unable to modify your spec file to point to these alternative
    GCC installed side by side with the default installed,
    I've posted how to create an update-alternatives so you can switch your
    entire system to whatever you wish
    https://en.opensuse.org/User:Tsu2/gc...e-alternatives

    TSU


    Hi
    That's not applicable to building rpm's with OBS (or locally with osc),
    it works in a standalone build environment and doesn't touch the local
    system....

    --
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    openSUSE Leap 42.2|GNOME 3.20.2|4.4.74-18.20-default
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!


  5. #5

    Default Re: GCC minimal version requirement

    Hello,
    @tsu2: The main problem is that tumbleweed does not include the packages gcc5 gcc6 and gcc7 (afaik it uses GCC > 7 by default). I preferred changing QMAKE_CC and QMAKE_CXX (C and C++ compilers for qMake) directly over using alternative. I have a robust solution to find the right compiler.
    @malcolmlewis: Yes, I tried using %if in point 3 (see the link). But I did not have the value of %{suse_version} in tumbleweed. You think the code you gave me should be able to work Leap and Tumbleweed? What is %{suse_version} there? I will try it when I come back to home.
    Thanks for the answers. Best regards,
    Pascom.

  6. #6
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    23,353
    Blog Entries
    15

    Default Re: GCC minimal version requirement

    Quote Originally Posted by pascom View Post
    @malcolmlewis: Yes, I tried using %if in point 3 (see the link). But I did not have the value of %{suse_version} in tumbleweed. You think the code you gave me should be able to work Leap and Tumbleweed? What is %{suse_version} there? I will try it when I come back to home.
    Thanks for the answers. Best regards,
    Pascom.
    Hi
    See the link I posted has all the info on what to use etc for cross-distribution...

    You can also set things up in the project configuration as well.....

    See: https://en.opensuse.org/openSUSE:Package_dependencies
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    openSUSE Leap 42.2 (x86_64) GNOME 3.20.2
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  7. #7

    Lightbulb Re: GCC minimal version requirement

    Hello,
    problem solved! I finally used a variation on your proposal:

    Quote Originally Posted by malcolmlewis View Post
    Hi
    So look at using an if statement...?

    Code:
    %if 0%{?suse_version} > 1320
    BuildRequires: gcc
    %else
    BuildRequires: gcc5
    %endif
    I preferred getting the Tumbleweed %{suse_version}

    Code:
    # Test if distribution is SUSE but not Thumbleweed (where %%suse_version = 1330)
    %if ((0%{?suse_version} != 0) && (0%{?suse_version} != 1330))
    BuildRequires:  gcc5
    BuildRequires:  gcc5-c++
    %endif
    While investigating I found out that there is a %{gcc_version} macro which is defined when gcc%{gcc_version} is used. It is 7 on Tumbleweed.
    Thank you very much for you help! and enjoy the latest version of Qt Creator split in independent plugins, if you want.
    Best regards,
    Pascom

    EDIT: Is there any way to mark the thread as solved?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •