Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
help wih cross compiling setup?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
reesm
n00b
n00b


Joined: 02 Mar 2003
Posts: 39
Location: AB, Canada

PostPosted: Thu Nov 16, 2017 9:29 am    Post subject: help wih cross compiling setup? Reply with quote

I am trying to get crossdev to build a target powerpc (32bit) toolchain on an x86 (32 bit) build host.

I have built GCC 5 on my powerpc system with the altivec USE flag enabled, because I want that.
Now I am trying to get the crossdev script to build GCC on the build host with USE=altivec enabled.

The only thing in the wiki that I can find regarding this is an obscure tip saying:
Quote:
At the moment it is not possible to set PORTAGE_CONFIGROOT before calling crossdev to a folder set to the architecture for the target. You have to use your own config. If you want to use arch specific USE flags, like altivec in a non-PowerPC architecture, you need to unmask the use flag in /usr/portage/base/use.mask, or temporarily change the system profile.

Notwithstanding the above, I have tried several command lines like:
Code:
USE="altivec threads" crossdev --stable --target powerpc-unknown-linux-gnu --getenv 'EXTRA_CONF="--disable-libstdc++-v3"'
and also
Code:
crossdev --stable --target powerpc-unknown-linux-gnu --getenv 'EXTRA_CONF="--disable-libstdc++-v3" USE="altivec threads"'

but they don't change anything!

How do I do this? I looked into the use.mask and the idea of changing the system profile on my build host, but I have no idea how to do that or what that means. Do I even need to care about the altivec use flag on my build host?
Back to top
View user's profile Send private message
reesm
n00b
n00b


Joined: 02 Mar 2003
Posts: 39
Location: AB, Canada

PostPosted: Sat Nov 18, 2017 7:45 am    Post subject: Reply with quote

Nobody has done this recently?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54638
Location: 56N 3W

PostPosted: Sat Nov 18, 2017 12:14 pm    Post subject: Reply with quote

reesm,

I seem to have one of those
Code:
 $ emerge -pv cross-powerpc-unknown-linux-gnu/gcc

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] cross-powerpc-unknown-linux-gnu/gcc-6.4.0:6.4.0::gentoo_static  USE="cxx fortran graphite nls nptl openmp pch pie sanitize ssp (-altivec) -awt -cilk -debug -doc (-fixed-point) -gcj -go -hardened -jit -libssp -mpx -multilib -objc -objc++ -objc-gc -pgo% -regression-test -vanilla -vtv" 0 KiB


but it was built on an amd64 no-multilib install.

The cross compiler cannot be built with USE=altivec as it runs on the host and may contain altivec instructions if that USE flag was enabled.
However, the cross compiler should still be able to emit altivec instructions, which is what you want.

If you really really want to enable USE=altivec, its a two step process.
First, you unmask the USE flag.
Make a directory /etc/portage/profile/ This will contain local changes to your selected profile.
Make a file called package.use.mask in your new directory

Add a line
Code:
cross/powerpc-unknown-linux-gnu-gcc -altivec
to allow altivec only on cross/powerpc-unknown-linux-gnu-gcc

Then you can enable it in the normal way.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
reesm
n00b
n00b


Joined: 02 Mar 2003
Posts: 39
Location: AB, Canada

PostPosted: Sat Nov 18, 2017 6:07 pm    Post subject: Reply with quote

Thanks for this! I don't think you do powerpc development, but the tips you gave me led me in the right direction!

The guide on this was missing information about creating an overlay for crossdev scripts, which seems now to be a requirement. I can't build it without doing so. Someone should really update the wiki! There's crossdev info scattered all over the place, some of it dating back a decade.

Quote:
The cross compiler cannot be built with USE=altivec as it runs on the host and may contain altivec instructions if that USE flag was enabled.
However, the cross compiler should still be able to emit altivec instructions, which is what you want.


I should be clear that my purpose for building this toolchain is for speeding up my compilation using distcc with my powerpc host. Altivec support is very important to me so I can enable it in packages that need it and so that I can experiment with optimizing other software. I was under the impression that this *should* work as it's all about generating, but not gcc using, altivec instructions while running on the host.

Quote:
Add a line
Code:
cross/powerpc-unknown-linux-gnu-gcc -altivec   

to allow altivec only on cross/powerpc-unknown-linux-gnu-gcc


This is exactly what I was looking for, but there is a slight mistake in your package naming. On my system, with the overlay I created for crossdev, it is:
Code:
cross-powerpc-unknown-linux-gnu/gcc


Poking around my system, I noticed that in my case /etc/portage/profile/package.use.mask/cross-powerpc-unknown-linux-gnu is the file I want to edit. Since only gcc has a use flag for altivec, I made the change as you suggested by editing the line to append "-altivec":

Code:
user@build1 /etc/portage/profile/package.use.mask $ cat cross-powerpc-unknown-linux-gnu
cross-powerpc-unknown-linux-gnu/binutils -multilib
cross-powerpc-unknown-linux-gnu/gcc -multilib -altivec
cross-powerpc-unknown-linux-gnu/linux-headers -multilib
cross-powerpc-unknown-linux-gnu/glibc -multilib
cross-powerpc-unknown-linux-gnu/gdb -multilib


and then rebuilt gcc with altivec!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54638
Location: 56N 3W

PostPosted: Sat Nov 18, 2017 6:33 pm    Post subject: Reply with quote

reesm,

Correct, I don't do ppc. I built that toolchain to reproduce a problem someone reported on IRC.
It was adapted (poorly) from arm64, 64 bit Gentoo on RAspberry Pi 3.

Sorry about the errors and thank you for correcting me here. That will help others that follow this thread later.

The wiki is a community resource. If you sign up, you can fix it.

As you report, setting up portage to work with crossdev is a two step process.
a) make an overlay, if you don't already have one
b) tell portage about the overlay, so it can can find the ebuilds.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC 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