maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   gcc >= 6 ? (https://talk.maemo.org/showthread.php?t=99699)

yurib 2017-08-13 18:35

gcc >= 6 ?
 
Hi :)
I need gcc >= 6 for sailfish os in order to try to port a program to sailfish os.

I've searched it but I've not found it, so I've compiled sources with the latest SDK (1707), but:

Code:

/opt/cross/bin/armv7hl-meego-linux-gnueabi-ld: /home/src1/gcc-6.4.0/host-armv7l-unknown-linux-gnueabihf/gcc/liblto_plugin.so: error loading plugin: re/locale-langpack/en_US/LC_MESSAGES/armv7hl-meego-linux-gnueabi-ld.mo
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: Leaving directory `/home/src1/gcc-6.4.0/armv7l-unknown-linux-gnueabihf/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/home/src1/gcc-6.4.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/src1/gcc-6.4.0'
make: *** [all] Error 2

Code:

/opt/cross/bin/armv7hl-meego-linux-gnueabi-ld: /home/src1/gcc-7.1.0/host-armv7l-unknown-linux-gnueabihf/gcc/liblto_plugin.so: error loading plugin: /locale/en_US/LC_MESSAGES/armv7hl-meego-linux-gnueabi-ld.mo
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: Leaving directory `/home/src1/gcc-7.1.0/armv7l-unknown-linux-gnueabihf/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/home/src1/gcc-7.1.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/src1/gcc-7.1.0'
make: *** [all] Error 2


Then I've tried to compiled it on jolla1, but after 30 hours:

Code:

libtool: link: (cd ".libs" && rm -f "libgcj_bc.so.1" && ln -s "libgcj_bc.so.1.0.0" "libgcj_bc.so.1")
libtool: link: (cd ".libs" && rm -f "libgcj_bc.so" && ln -s "libgcj_bc.so.1.0.0" "libgcj_bc.so")
libtool: link: ( cd ".libs" && rm -f "libgcj_bc.la" && ln -s "../libgcj_bc.la" "libgcj_bc.la" )
/dev/null:1:3: error: invalid preprocessing directive ###
 # ### BEGIN LIBTOOL TAG CONFIG: CXX
  ^~
make[3]: *** [libgcj_bc.la] Error 1
make[3]: Leaving directory `/home/nemo/gcc-6.4.0/armv7l-unknown-linux-gnueabihf/libjava'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/nemo/gcc-6.4.0/armv7l-unknown-linux-gnueabihf/libjava'
make[1]: *** [all-target-libjava] Error 2
make[1]: Leaving directory `/home/nemo/gcc-6.4.0'
make: *** [all] Error 2

(compilation of version 7.1 has begun 10 minutes ago, but I think it'll fail)

Any suggestions? Thanks


EDIT: for your information, compilation of version 7.1 has failed.
Code:

libcpp.a  ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a
(echo "@set version-GCC 7.1.0"; \
        if [ "" = "experimental" ]; \
        then echo "@set DEVELOPMENT"; \
        else echo "@clear DEVELOPMENT"; \
        fi) > gcc-vers.texiT
echo @set srcdir /home/nemo/gcc-7.1.0/host-armv7l-unknown-linux-gnueabihf/gcc/../.././gcc >> gcc-vers.texiT
if [ -n "(GCC) " ]; then \
          echo "@set VERSION_PACKAGE (GCC) " >> gcc-vers.texiT; \
        fi
echo "@set BUGURL @uref{https://gcc.gnu.org/bugs/}" >> gcc-vers.texiT; \
        mv -f gcc-vers.texiT gcc-vers.texi
echo timestamp > gcc.pod
perl ../.././gcc/../contrib/texi2pod.pl ../.././gcc/doc/invoke.texi > gcc.pod
echo timestamp > doc/gcc.1
(pod2man --center="GNU" --release="gcc-7.1.0" --date=2017-05-02 --section=1 gcc.pod > doc/gcc.1.T$$ && \
                mv -f doc/gcc.1.T$$ doc/gcc.1) || \
                (rm -f doc/gcc.1.T$$ && exit 1)
cp doc/gcc.1 doc/g++.1
perl ../.././gcc/../contrib/texi2pod.pl -DBUGURL="@uref{https://gcc.gnu.org/bugs/}" \
          < ../.././gcc/fortran/invoke.texi > gfortran.pod
echo timestamp > doc/gfortran.1
(pod2man --center="GNU" --release="gcc-7.1.0" --date=2017-05-02 --section=1 gfortran.pod > doc/gfortran.1.T$$ && \
                mv -f doc/gfortran.1.T$$ doc/gfortran.1) || \
                (rm -f doc/gfortran.1.T$$ && exit 1)
/home/nemo/gcc-7.1.0/host-armv7l-unknown-linux-gnueabihf/gcc/xgcc -B/home/nemo/gcc-7.1.0/host-armv7l-unknown-linux-gnueabihf/gcc/ -nostdinc -x c /dev/null -S -o /dev/null -fself-test=../.././gcc/testsuite/selftests
/dev/null:1:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
cc1: note: self-tests are not enabled in this build
make[3]: *** [s-selftest] Error 1
rm gfortran.pod gcc.pod
make[3]: Leaving directory `/home/nemo/gcc-7.1.0/host-armv7l-unknown-linux-gnueabihf/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/home/nemo/gcc-7.1.0'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/nemo/gcc-7.1.0'
make: *** [all] Error 2


tortoisedoc 2017-08-15 06:57

Re: gcc >= 6 ?
 
Quote:

Originally Posted by yurib (Post 1532571)
Hi :)
I need gcc >= 6 for sailfish os in order to try to port a program to sailfish os.

I've searched it but I've not found it, so I've compiled sources with the latest SDK (1707), but:

Code:

/opt/cross/bin/armv7hl-meego-linux-gnueabi-ld: /home/src1/gcc-6.4.0/host-armv7l-unknown-linux-gnueabihf/gcc/liblto_plugin.so: error loading plugin: re/locale-langpack/en_US/LC_MESSAGES/armv7hl-meego-linux-gnueabi-ld.mo
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: Leaving directory `/home/src1/gcc-6.4.0/armv7l-unknown-linux-gnueabihf/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/home/src1/gcc-6.4.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/src1/gcc-6.4.0'
make: *** [all] Error 2

Code:

/opt/cross/bin/armv7hl-meego-linux-gnueabi-ld: /home/src1/gcc-7.1.0/host-armv7l-unknown-linux-gnueabihf/gcc/liblto_plugin.so: error loading plugin: /locale/en_US/LC_MESSAGES/armv7hl-meego-linux-gnueabi-ld.mo
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: Leaving directory `/home/src1/gcc-7.1.0/armv7l-unknown-linux-gnueabihf/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/home/src1/gcc-7.1.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/src1/gcc-7.1.0'
make: *** [all] Error 2


Then I've tried to compiled it on jolla1, but after 30 hours:

Code:

libtool: link: (cd ".libs" && rm -f "libgcj_bc.so.1" && ln -s "libgcj_bc.so.1.0.0" "libgcj_bc.so.1")
libtool: link: (cd ".libs" && rm -f "libgcj_bc.so" && ln -s "libgcj_bc.so.1.0.0" "libgcj_bc.so")
libtool: link: ( cd ".libs" && rm -f "libgcj_bc.la" && ln -s "../libgcj_bc.la" "libgcj_bc.la" )
/dev/null:1:3: error: invalid preprocessing directive ###
 # ### BEGIN LIBTOOL TAG CONFIG: CXX
  ^~
make[3]: *** [libgcj_bc.la] Error 1
make[3]: Leaving directory `/home/nemo/gcc-6.4.0/armv7l-unknown-linux-gnueabihf/libjava'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/nemo/gcc-6.4.0/armv7l-unknown-linux-gnueabihf/libjava'
make[1]: *** [all-target-libjava] Error 2
make[1]: Leaving directory `/home/nemo/gcc-6.4.0'
make: *** [all] Error 2

(compilation of version 7.1 has begun 10 minutes ago, but I think it'll fail)

Any suggestions? Thanks


EDIT: for your information, compilation of version 7.1 has failed.
Code:

libcpp.a  ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a
(echo "@set version-GCC 7.1.0"; \
        if [ "" = "experimental" ]; \
        then echo "@set DEVELOPMENT"; \
        else echo "@clear DEVELOPMENT"; \
        fi) > gcc-vers.texiT
echo @set srcdir /home/nemo/gcc-7.1.0/host-armv7l-unknown-linux-gnueabihf/gcc/../.././gcc >> gcc-vers.texiT
if [ -n "(GCC) " ]; then \
          echo "@set VERSION_PACKAGE (GCC) " >> gcc-vers.texiT; \
        fi
echo "@set BUGURL @uref{https://gcc.gnu.org/bugs/}" >> gcc-vers.texiT; \
        mv -f gcc-vers.texiT gcc-vers.texi
echo timestamp > gcc.pod
perl ../.././gcc/../contrib/texi2pod.pl ../.././gcc/doc/invoke.texi > gcc.pod
echo timestamp > doc/gcc.1
(pod2man --center="GNU" --release="gcc-7.1.0" --date=2017-05-02 --section=1 gcc.pod > doc/gcc.1.T$$ && \
                mv -f doc/gcc.1.T$$ doc/gcc.1) || \
                (rm -f doc/gcc.1.T$$ && exit 1)
cp doc/gcc.1 doc/g++.1
perl ../.././gcc/../contrib/texi2pod.pl -DBUGURL="@uref{https://gcc.gnu.org/bugs/}" \
          < ../.././gcc/fortran/invoke.texi > gfortran.pod
echo timestamp > doc/gfortran.1
(pod2man --center="GNU" --release="gcc-7.1.0" --date=2017-05-02 --section=1 gfortran.pod > doc/gfortran.1.T$$ && \
                mv -f doc/gfortran.1.T$$ doc/gfortran.1) || \
                (rm -f doc/gfortran.1.T$$ && exit 1)
/home/nemo/gcc-7.1.0/host-armv7l-unknown-linux-gnueabihf/gcc/xgcc -B/home/nemo/gcc-7.1.0/host-armv7l-unknown-linux-gnueabihf/gcc/ -nostdinc -x c /dev/null -S -o /dev/null -fself-test=../.././gcc/testsuite/selftests
/dev/null:1:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
cc1: note: self-tests are not enabled in this build
make[3]: *** [s-selftest] Error 1
rm gfortran.pod gcc.pod
make[3]: Leaving directory `/home/nemo/gcc-7.1.0/host-armv7l-unknown-linux-gnueabihf/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/home/nemo/gcc-7.1.0'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/nemo/gcc-7.1.0'
make: *** [all] Error 2


On Jolla1? Please use the MER platform SDK instead! It'll make your life alot easier.

nieldk 2017-08-15 07:31

Re: gcc >= 6 ?
 
Probably configure options that are not good.
Take a look at a success for 5.10 here
https://talk.maemo.org/showthread.php?p=1478195

marmistrz 2017-08-15 14:48

Re: gcc >= 6 ?
 
I asked about upgrading GCC during the last community meeting and the answer was:

For reference, minutes from relevant community meetings:

http://merproject.org/meetings/mer-m...-04-14.33.html
http://merproject.org/meetings/mer-m...-26-08.02.html

tl;dr: Jolla has its own patches, it's unknown whether they're needed at all and are kinda shifting this all onto community (that was my impression, after all).

Btw. GCC 4.x is now end of life, even in Linaro ;)

yurib 2017-08-15 18:05

Re: gcc >= 6 ?
 
Quote:

Originally Posted by marmistrz (Post 1532653)
I asked about upgrading GCC during the last community meeting and the answer was:

Many thanks! :)

Sadly, they want to switch on gcc5 :eek: I'm going to cry...




Quote:

Originally Posted by nieldk (Post 1532625)
Probably configure options that are not good.
Take a look at a success for 5.10 here
https://talk.maemo.org/showthread.php?p=1478195

Thanks :)
I've tried your configure options but on sailfish SDK there are the same errors as before. :( I have to try on mer SDK (see below).

For your information, my configure options came from gcc4 spec file. I've downloaded source file on jolla1:
Code:

pkcon download . gcc
then I've looked in it.




Quote:

Originally Posted by tortoisedoc (Post 1532623)
On Jolla1? Please use the MER platform SDK instead! It'll make your life alot easier.

Thanks :)
but now I'm tired... I think I need holidays!

tortoisedoc 2017-08-16 09:58

Re: gcc >= 6 ?
 
Quote:

Originally Posted by marmistrz (Post 1532653)
I asked about upgrading GCC during the last community meeting and the answer was:

For reference, minutes from relevant community meetings:

http://merproject.org/meetings/mer-m...-04-14.33.html
http://merproject.org/meetings/mer-m...-26-08.02.html

tl;dr: Jolla has its own patches, it's unknown whether they're needed at all and are kinda shifting this all onto community (that was my impression, after all).

Btw. GCC 4.x is now end of life, even in Linaro ;)


are those patches available somewhere?

yurib 2017-08-17 14:58

Re: gcc >= 6 ?
 
Quote:

Originally Posted by tortoisedoc (Post 1532711)
are those patches available somewhere?

According to the chat log, here they are.

yurib 2017-08-18 21:17

Re: gcc >= 6 ?
 
Quote:

Originally Posted by nieldk (Post 1532625)
Probably configure options that are not good.
Take a look at a success for 5.10 here
https://talk.maemo.org/showthread.php?p=1478195

On Sailfish SDK, compilation has always failed, I've tried with every version of gcc. :(

rinigus 2017-09-08 17:07

Re: gcc >= 6 ?
 
For those interested in getting gcc 6x working, I have compiled gcc 6.4.0 at OBS. Its available at https://build.merproject.org/package...oolbox/opt-gcc . Compiler is build with options that should allow, in theory, to mix it with the current compiler on SFOS. Compiler is installed at /opt/gcc6, making it possible to have platform gcc and opt-gcc installed at the same time.

Please note that this compiler is not tested. Its early days...

I have seen issues with linking, such as absence of correct libstdc++ and glibc. For simpler programs, that was resolved either by setting LD_LIBRARY_PATH to include /opt/gcc6/lib or linking with /usr/bin/g++

Note that such packaging is not "proper", as done by system packages. It installs whole c & c++ as a one package together with all libs under /opt/gcc6

Finally, as with @yurib, I had issues with getting ARM version compiled with LTO. So, ARM version is compiled with LTO disabled. The error message was (from OBS build log)
Code:

[ 4478s] ranlib libgcc_eh.a
[ 4478s] # @multilib_dir@ is not really necessary, but sometimes it has
[ 4478s] # more uses than just a directory name.
[ 4478s] /bin/sh /home/abuild/rpmbuild/BUILD/gcc-6.4.0/obj/../libgcc/../mkinstalldirs .
[ 4478s] /home/abuild/rpmbuild/BUILD/gcc-6.4.0/obj/./gcc/xgcc -B/home/abuild/rpmbuild/BUILD/gcc-6.4.0/obj/./gcc/
... unordsf2_s.o fixsfsi_s.o floatsisf_s.o floatunsisf_s.o adddf3_s.o divdf3_s.o eqdf2_s.o gedf2_s.o ledf2_s.o muldf3_s.o negdf2_s.o subdf3_s.o unorddf2_s.o fixdfsi_s.o floatsidf_s.o floatunsidf_s.o extendsfdf2_s.o truncdfsf2_s.o enable-execute-stack_s.o unwind-arm_s.o libunwind_s.o pr-support_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && (echo "/* GNU ld script"; echo "  Use the shared library, but some functions are only in"; echo "  the static library.  */"; echo "GROUP ( libgcc_s.so.1 -lgcc )" ) > ./libgcc_s.so
[ 4479s] /opt/cross/bin/armv7hl-meego-linux-gnueabi-ld: /home/abuild/rpmbuild/BUILD/gcc-6.4.0/obj/./gcc/liblto_plugin.so: error loading plugin: PTmPTm
[ 4479s] collect2: error: ld returned 1 exit status
[ 4479s] make[3]: *** [libgcc_s.so] Error 1
[ 4479s] make[3]: Leaving directory `/home/abuild/rpmbuild/BUILD/gcc-6.4.0/obj/armv7l-unknown-linux-gnueabihf/libgcc'
[ 4479s] make[2]: *** [all-stage1-target-libgcc] Error 2
[ 4479s] make[2]: Leaving directory `/home/abuild/rpmbuild/BUILD/gcc-6.4.0/obj'
[ 4479s] make[1]: *** [stage1-bubble] Error 2
[ 4479s] make[1]: Leaving directory `/home/abuild/rpmbuild/BUILD/gcc-6.4.0/obj'
[ 4479s] make: *** [all] Error 2
[ 4479s] error: Bad exit status from /var/tmp/rpm-tmp.jFkB2P (%build)
[ 4479s]
[ 4479s]
[ 4479s] RPM build errors:
[ 4479s]    Bad exit status from /var/tmp/rpm-tmp.jFkB2P (%build)
[ 4482s] [ 4465.323263] SysRq : Power Off
[ 4482s] [ 4465.327031] reboot: Power down

So, there is surely room for improvement

rinigus 2017-09-10 11:02

Re: gcc >= 6 ?
 
Just to let you know - I have been using this compiler to port a rather complicated C++14 project and it seems to work nicely. There current issues are filed at https://github.com/rinigus/pkg-gcc/issues .

We are also missing README and example projects to show how can it be used.

All in all, I would suggest to try to use it and everyone is welcome to chip in by fixing the problems with gcc packaging at OBS.

rinigus 2017-09-29 08:32

Re: gcc >= 6 ?
 
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.

marmistrz 2018-01-21 14:24

Re: gcc >= 6 ?
 
If you want to use it from within the OBS, see how to add the repo to your project: https://build.merproject.org/project...e:rinigus:maps

neochapay 2018-02-13 08:06

Re: gcc >= 6 ?
 
http://repo.merproject.org/obs/home:...mv7hl/armv7hl/ ready ^_^

rinigus 2018-02-13 08:14

Re: gcc >= 6 ?
 
Quote:

Originally Posted by neochapay (Post 1541095)

Great job! This looks to be a proper packaging of gcc (in contrast of my approach where I stuffed all to /opt)

@neochapay, have you tried to compile anything demanding with it?

How does libstdc++ versioning go? In particular, I expect to have the same problems as with opt-gcc6 packaging - either

* libstdc++ has to be updated on device
* provided with an app
* linked statically

Note that SFOS boosters may not like your app-provided dynamically linked libstdc++

Looking forward to use it. Thank you again!

neochapay 2018-02-13 08:35

Re: gcc >= 6 ?
 
Quote:

Originally Posted by rinigus (Post 1541096)
Great job! This looks to be a proper packaging of gcc (in contrast of my approach where I stuffed all to /opt)

@neochapay, have you tried to compile anything demanding with it?

Now i got self complited gcc 6 :) next steep - try to compile glibc

marmistrz 2018-02-14 08:01

Re: gcc >= 6 ?
 
Quote:

Originally Posted by neochapay (Post 1541097)
Now i got self complited gcc 6 :) next steep - try to compile glibc

Are you using the legacy or the new ABI? Do you want it to be a drop-in replacement or do you want to rebuild the whole Mer?

neochapay 2018-02-14 15:55

Re: gcc >= 6 ?
 
Quote:

Originally Posted by marmistrz (Post 1541124)
Are you using the legacy or the new ABI? Do you want it to be a drop-in replacement or do you want to rebuild the whole Mer?

yes and yes

tortoisedoc 2018-09-22 21:48

Re: gcc >= 6 ?
 
Quote:

Originally Posted by neochapay (Post 1541140)
yes and yes

Pretty obvious question, did you succeed?


All times are GMT. The time now is 18:50.

vBulletin® Version 3.8.8