Notices


Reply
Thread Tools
Posts: 347 | Thanked: 1,543 times | Joined on Aug 2016 @ Estonia
#11
For those interested in an example on how to use gcc 6 for their projects could look into https://github.com/rinigus/mapbox-demo-sfos. Its a working solution that allowed me to port C++14 library and build a simple application around it.

Some notes:

* In YAML (https://github.com/rinigus/mapbox-de...pbox-sfos.yaml), add opt-gcc6 as PkgBR

* Project file (https://github.com/rinigus/mapbox-de...apbox-sfos.pro) has compilers and linkers defined to /opt/gcc6/bin/g++ .

* For C++14, add c++14 in CONFIG of the project file.

* In project file, you could either opt for static or shared linking with stdc++. Static linking (as in the current version of pro file, see LIBS var) makes it easier to distribute, may have some side effects. Sometimes, as when developing QML plugin, static is the only way to go.

* Desktop file (https://github.com/rinigus/mapbox-de...x-sfos.desktop) has an application switched to "generic" to avoid silica boosters getting confused with the wrong stdc++ library version (dynamic link to stdc++) or inability to send signals (static link to stdc++).

* If you went for shared stdc++ build, add

Code:
%define __provides_exclude_from ^%{_datadir}/.*$
%define __requires_exclude ^libstdc.*$
in SPEC file (https://github.com/rinigus/mapbox-de...pbox-sfos.spec, in macros section) and

Code:
# ship all shared libraries not allowed in Harbour with the app
mkdir -p %{buildroot}%{_datadir}/%{name}/lib

cp /opt/gcc6/lib/libstdc++.so.6.0.22 %{buildroot}%{_datadir}/%{name}/lib/libstdc++.so.6
cp /opt/gcc6/lib/libgcc_s.so.1 %{buildroot}%{_datadir}/%{name}/lib/libgcc_s.so.1
cp /opt/gcc6/lib/libgcc_s.so %{buildroot}%{_datadir}/%{name}/lib/libgcc_s.so
in install post section.

* See https://github.com/rinigus/mapbox-de...sfos-rpmlintrc if you get into trouble with OBS.

For me, it all worked and I could compile and distribute program with gcc 6.4.0 as well as QML plugin compiled using similar approach. I believe that this is a viable solution and should allow to port the software that requires recent gcc version.
 

The Following 10 Users Say Thank You to rinigus For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 04:30.