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
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
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:
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.
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 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 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.
–
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!
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/gcc_update-alternatives
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/gcc_update-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!
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.
Hello,
problem solved! I finally used a variation on your proposal:
I preferred getting the Tumbleweed %{suse_version}
# 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?