Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
gcc-5.4.0 doesn't compile (inside and outside of chroot)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3333
Location: de

PostPosted: Sun Aug 21, 2016 3:19 pm    Post subject: gcc-5.4.0 doesn't compile (inside and outside of chroot) Reply with quote

Grml, always new problems appear on my hard way to get the arm stuff running. Now gcc won't compile.

First of all my make.conf of the cross environment:
/usr/armv7a-hardfloat-linux-gnueabi/etc/portage/make.conf:

CFLAGS="-Ofast -march=armv7-a -mtune=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
ACCEPT_KEYWORDS="arm ~arm"
FEATURES="-collision-protect sandbox buildpkg noman noinfo nodoc"
USE="${ARCH} -pam -acl -avahi -consolekit -cracklib -cron -dso -dv -emboss -fam -firefox -gdbm -gnome -ipv6 -ldap -libav -libcanberra -modemmanager -pm-utils -pulseaudio -qt-static -vlc -kde"

CBUILD=x86_64-pc-linux-gnu
ARCH="arm"
HOSTCC=x86_64-pc-linux-gnu-gcc
ROOT=/usr/armv7a-hardfloat-linux-gnueabi/
CC=/usr/x86_64-pc-linux-gnu/armv7a-hardfloat-linux-gnueabi/gcc-bin/5.4.0/armv7a-hardfloat-linux-gnueabi-gcc
CXX=/usr/x86_64-pc-linux-gnu/armv7a-hardfloat-linux-gnueabi/gcc-bin/5.4.0/armv7a-hardfloat-linux-gnueabi-g++


If I start compiling gcc fails:
armv7a-hardfloat-linux-gnueabi-emerge -1u gcc (from outside chroot):
g++  -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp -I. -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/../include -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/include  -march=armv7-a -mtune=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -pipe -O2 -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -pedantic -Wno-long-long  -fno-exceptions -fno-rtti -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp -I. -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/../include -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/include   -c -o expr.o -MT expr.o -MMD -MP -MF .deps/expr.Tpo /var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/expr.c
g++  -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp -I. -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/../include -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/include  -march=armv7-a -mtune=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -pipe -O2 -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -pedantic -Wno-long-long  -fno-exceptions -fno-rtti -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp -I. -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/../include -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/include   -c -o files.o -MT files.o -MMD -MP -MF .deps/files.Tpo /var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/files.c
g++: error: unrecognized command line option ‘-mfpu=neon-fp16’
g++: error: unrecognized command line option ‘-mfloat-abi=hard’
make[2]: *** [Makefile:224: charset.o] Error 1
make[2]: *** Waiting for unfinished jobs....


Do I drop both flags, gcc complains about the next options:
armv7a-hardfloat-linux-gnueabi-emerge -1u gcc:
g++  -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp -I. -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/../include -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/include  -march=armv7-a -mtune=cortex-a9 -pipe -O2 -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -pedantic -Wno-long-long  -fno-exceptions -fno-rtti -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp -I. -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/../include -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/include   -c -o files.o -MT files.o -MMD -MP -MF .deps/files.Tpo /var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/files.c
gcc -c  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wno-overlength-strings -pedantic -Wno-long-long   -DHAVE_CONFIG_H -I. -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/fixincludes -I../include -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/fixincludes/../include /var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/fixincludes/procopen.c
checking for times... /var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/charset.c:1:0: error: bad value (armv7-a) for -march= switch
 /* CPP Library - charsets
 ^
/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/charset.c:1:0: error: bad value (cortex-a9) for -mtune= switch
make[2]: *** [Makefile:224: charset.o] Error 1
make[2]: *** Waiting for unfinished jobs....
gcc -c  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wno-overlength-strings -pedantic -Wno-long-long   -DHAVE_CONFIG_H -I. -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/fixincludes -I../include -I/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/fixincludes/../include /var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/fixincludes/fixlib.c
/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libcpp/directives.c:1:0: error: bad value (armv7-a) for -march= switch
 /* CPP Library. (Directive handling.)

Obviously the cross-compiler doesn't know the arm parameters, when compiling gcc. Other packages (ncurses, db, iptables) worked for some strange reason.

This sounds strange for me, because building the cross-compiler did recognize the options:
emerge -1 cross-armv7a-hardfloat-linux-gnueabi/gcc (building cross-compiler on host):
 * CFLAGS="-O2 -pipe"
 * CXXFLAGS=""
 * LDFLAGS="-Wl,-O1 -Wl,--as-needed"

 * PREFIX:          /usr
 * BINPATH:         /usr/x86_64-pc-linux-gnu/armv7a-hardfloat-linux-gnueabi/gcc-bin/5.4.0
 * LIBPATH:         /usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/5.4.0
 * DATAPATH:        /usr/share/gcc-data/armv7a-hardfloat-linux-gnueabi/5.4.0
 * STDCXX_INCDIR:   /usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/5.4.0/include/g++-v5

 * Languages:       c,c++,fortran
* Configuring GCC with:
 *    --host=x86_64-pc-linux-gnu
 *    --target=armv7a-hardfloat-linux-gnueabi
 *    --build=x86_64-pc-linux-gnu
 *    --prefix=/usr
 *    --bindir=/usr/x86_64-pc-linux-gnu/armv7a-hardfloat-linux-gnueabi/gcc-bin/5.4.0
 *    --includedir=/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/5.4.0/include
 *    --datadir=/usr/share/gcc-data/armv7a-hardfloat-linux-gnueabi/5.4.0
 *    --mandir=/usr/share/gcc-data/armv7a-hardfloat-linux-gnueabi/5.4.0/man
 *    --infodir=/usr/share/gcc-data/armv7a-hardfloat-linux-gnueabi/5.4.0/info
 *    --with-gxx-include-dir=/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/5.4.0/include/g++-v5
 *    --with-python-dir=/share/gcc-data/armv7a-hardfloat-linux-gnueabi/5.4.0/python
 *    --enable-languages=c,c++,fortran
 *    --enable-obsolete
 *    --enable-secureplt
 *    --disable-werror
 *    --with-system-zlib
 *    --enable-nls
 *    --without-included-gettext
 *    --enable-checking=release
 *    --with-bugurl=https://bugs.gentoo.org/
 *    --with-pkgversion=Gentoo 5.4.0 p1.0, pie-0.6.5
 *    --enable-libstdcxx-time
 *    --enable-poison-system-directories
 *    --with-sysroot=/usr/armv7a-hardfloat-linux-gnueabi
 *    --disable-bootstrap
 *    --enable-__cxa_atexit
 *    --enable-clocale=gnu
 *    --disable-multilib
 *    --disable-altivec
 *    --disable-fixed-point
 *    --with-float=hard
 *    --with-arch=armv7-a
 *    --with-float=hard
 *    --with-fpu=vfpv3-d16
 *    --disable-libgcj
 *    --enable-libgomp
 *    --disable-libmudflap
 *    --disable-libssp
 *    --disable-libcilkrts
 *    --disable-libmpx
 *    --enable-vtable-verify
 *    --enable-libvtv
 *    --enable-lto
 *    --without-isl
 *    --enable-libsanitizer
 *    --with-fpu=neon-fp16


Ok, then let's try compiling gcc inside the arm chroot:
emerge -1u gcc (inside chroot):
In file included from /var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libgcc/libgcc2.c:56:0:
/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libgcc/libgcc2.h:209:20: error: ‘__fixsfdi’ undeclared here (not in a function)
 #define __NDW(a,b) __ ## a ## di ## b
                    ^
/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libgcc/libgcc2.h:282:19: note: in expansion of macro ‘__NDW’
 #define __fixsfdi __NDW(fixsf,)
                   ^
/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libgcc/config/arm/bpabi-lib.h:28:11: note: in expansion of macro ‘__fixsfdi’
   typeof (__##GCC_NAME) __aeabi_##AEABI_NAME \
           ^
/var/tmp/portage/sys-devel/gcc-5.4.0/work/gcc-5.4.0/libgcc/config/arm/bpabi-lib.h:48:33: note: in expansion of macro ‘RENAME_LIBRARY’
 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixsfdi, f2lz) \


Did anyone get this thing compiled?
Back to top
View user's profile Send private message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3333
Location: de

PostPosted: Tue Aug 23, 2016 6:09 am    Post subject: Reply with quote

Got it compiled.

I compiled the whole system already with gcc-5.4.0 from outside the chroot via cross-compiler. And then I compiled gcc-5.4.0 inside the qemu-arm chroot, which took several hours. But finally it worked.
Back to top
View user's profile Send private message
apyh
n00b
n00b


Joined: 17 Mar 2003
Posts: 70
Location: Texas

PostPosted: Wed Sep 14, 2016 12:58 pm    Post subject: Reply with quote

musv,

What wiki or guide are you using for setting up your cross-environment? I've been stuck following this guide: https://wiki.gentoo.org/wiki/Cross_build_environment at the arm-bla-blah-emerge @system --keep-going for a while, it fails to compile about 16 packages including sys-apps/file and dev-lang/python, which make emerge useless once i try and chroot. =(
Back to top
View user's profile Send private message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3333
Location: de

PostPosted: Sat Sep 17, 2016 6:04 am    Post subject: Reply with quote

apyh:

Cross-Compiling on Gentoo is very frustrating. I used also the guide you posted.

I'm at the point to configure and compile the kernel, so the base system has been finished. Some points:

  • I started with gcc-4.xx as the cross-compiler and built the environment to the point to be able to compile gcc-5.x inside the chroot. Building gcc-5.x on the host didn't work for me. As soon as finished building gcc I switched to gcc-5.x outside (cross) and inside (native) the chroot.
  • The main problem is that some packages fail to compile with complaining no to find some gcc parameters (armv7-a, neon, abifloat=hard). In this case you have to compile those packages inside the chroot.
  • With stable arm I failed to build the base system very early. Switching to ~arm some problems are gone.
  • If a package fail, you should look into the configure log files. Many times the actual error is different to the shown error in the console.
  • If you look into my USE flags, you'll find a lot of deactivated flags. To get a complete base system, deactivate some of the default flags to reduce the dependencies. If you have managed to compile the base system and have a working chroot, activate the flags one by one and re-compile the affected packages.
  • If you have problems to switch into the chroot, check my other thread. I don't use the binmft service anymore. Instead I write the "magical byte code" directly to the proc system. So I can specify the path to the qemu-wrapper. If you use the binmft-service, it point's to qemu-arm. Hence the cpu architecture is only set to arm and not to armv7-a.


Hope it helps.
Back to top
View user's profile Send private message
apyh
n00b
n00b


Joined: 17 Mar 2003
Posts: 70
Location: Texas

PostPosted: Thu Sep 22, 2016 2:43 am    Post subject: welp, i thought I was almost there Reply with quote

I got gcc compiled out of chroot (4.9.3), which gave me some hope. But after entering the chroot and trying to run env-update, i get this error =(

Code:

# env-update
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/env-update", line 31, in <module>
    import portage
ImportError: No module named portage


eselect python lists 2.7 as being active (3.x wouldn't arm-emerge) and that's what I also have active on my CHOST. Did I go too minimal with my use flags?

I also get a very similar error message when attempting to call emerge
Code:

# emerge --info
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/emerge", line 41, in <module>
    import portage
ImportError: No module named portage


I'm guessing I don't have a working portage install, before going into chroot the list of packages from profile/default/linux that failed were:

Code:

 *  (sys-kernel/linux-headers-4.3:0/0::gentoo, ebuild scheduled for merge to '/usr/armv6j-hardfloat-linux-gnueabi/'), Log file:
 *   '/usr/armv6j-hardfloat-linux-gnueabi/tmp/portage/sys-kernel/linux-headers-4.3/temp/build.log'
 *  (dev-lang/perl-5.22.2:0/5.22::gentoo, ebuild scheduled for merge to '/usr/armv6j-hardfloat-linux-gnueabi/'), Log file:
 *   '/usr/armv6j-hardfloat-linux-gnueabi/tmp/portage/dev-lang/perl-5.22.2/temp/build.log'
 *  (virtual/perl-Test-Harness-3.350.0:0/0::gentoo, ebuild scheduled for merge to '/usr/armv6j-hardfloat-linux-gnueabi/')
 *  (sys-devel/autoconf-2.69:2.5/2.5::gentoo, ebuild scheduled for merge to '/usr/armv6j-hardfloat-linux-gnueabi/')
 *  (virtual/perl-Data-Dumper-2.158.0:0/0::gentoo, ebuild scheduled for merge to '/usr/armv6j-hardfloat-linux-gnueabi/')
 *  (virtual/perl-File-Temp-0.230.400-r4:0/0::gentoo, ebuild scheduled for merge to '/usr/armv6j-hardfloat-linux-gnueabi/')
 *  (sys-devel/libtool-2.4.6:2/2::gentoo, ebuild scheduled for merge to '/usr/armv6j-hardfloat-linux-gnueabi/')
 *  (perl-core/File-Temp-0.230.400-r1:0/0::gentoo, ebuild scheduled for merge to '/usr/armv6j-hardfloat-linux-gnueabi/')
 *  (app-admin/perl-cleaner-2.20:0/0::gentoo, ebuild scheduled for merge to '/usr/armv6j-hardfloat-linux-gnueabi/')
 *  (sys-devel/automake-1.15:1.15/1.15::gentoo, ebuild scheduled for merge to '/usr/armv6j-hardfloat-linux-gnueabi/')
 *  (dev-libs/glib-2.46.2-r3:2/2::gentoo, ebuild scheduled for merge to '/usr/armv6j-hardfloat-linux-gnueabi/'), Log file:
 *   '/usr/armv6j-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.46.2-r3/temp/build.log'
 


I did add -xattr to sys-apps portage b/c armv6j-hardfloat-linux-gnueabi-emerge failed to get portage in with it on. Any ideas what I did wrong?

Portage is currently built in /usr/armv6j... as:

Code:

sys-apps/portage-2.3.0::gentoo to /usr/armv6j-hardfloat-linux-gnueabi/ USE="build doc (ipc) -epydoc (-selinux) -xattr" LINGUAS="-ru" PYTHON_TARGETS="python2_7 (-pypy) (-python3_3) -python3_4 (-python3_5)" 0 KiB


here's my current make.conf

Code:

ACCEPT_KEYWORDS="arm"
CHOST=armv6j-hardfloat-linux-gnueabi
CBUILD=x86_64-pc-linux-gnu
ARCH=arm
HOSTCC=x86_64-pc-linux-gnu-gcc
ROOT=/usr/${CHOST}/

USE="${ARCH} minimal -pam -nls"
MAKEOPTS="-j22"
FEATURES="-collision-protect -protect-owned sandbox noinfo"
PYTHON_TARGETS="python2_7"

CFLAGS="-O2 -pipe -march=armv6j -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard"
CXXFLAGS="${CFLAGS}"

# Be sure we dont overwrite pkgs from another repo..                                                                                                                                                       
PKGDIR=${ROOT}packages/
PORTAGE_TMPDIR=${ROOT}tmp/

ELIBC="glibc"

PKG_CONFIG_PATH="${ROOT}usr/lib/pkgconfig/"
Back to top
View user's profile Send private message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3333
Location: de

PostPosted: Fri Sep 23, 2016 11:07 am    Post subject: Reply with quote

I stumbled into the same problem and created this bug-report:

https://bugs.gentoo.org/show_bug.cgi?id=591878

Portage installs the files into:
/usr/armv7a-hardfloat-linux-gnueabi/usr/lib64/python3.4/site-packages/portage

So copy the contents from
/usr/armv7a-hardfloat-linux-gnueabi/usr/lib64
to
/usr/armv7a-hardfloat-linux-gnueabi/usr/lib

and set afterwards a symlink from the lib64 to the lib directory. But use a relative path not an absolute, so it can work from inside and outside of chroot.
Back to top
View user's profile Send private message
apyh
n00b
n00b


Joined: 17 Mar 2003
Posts: 70
Location: Texas

PostPosted: Fri Sep 23, 2016 3:08 pm    Post subject: Reply with quote

ack, i thought i created that symlink! but that must've been a earlier try. looks like chroot is working now, thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum