Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
build of dev-libs/boost needs instruction-set=i486 parameter
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
mwhitehe
n00b
n00b


Joined: 17 Jul 2017
Posts: 3

PostPosted: Mon Jul 17, 2017 3:26 pm    Post subject: build of dev-libs/boost needs instruction-set=i486 parameter Reply with quote

I am trying to build dev-libs/boost for i486. I set my CFLAGS="-march=i486 -mtune=i486", but the b2 config is hard-coded to default to i686 (see the later "-march=i686")

Code:
"i486-pc-linux-gnu-g++"  -ftemplate-depth-128 -O2 -march=i486 -mtune=i486 -pipe -std=c++14 -finline-functions -Wno-inline -Wall -march=i686 -pthread -fPIC -m32  -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_DYN_LINK=1 -DBOOST_ATOMIC_SOURCE -DNDEBUG  -I"." -c -o "bin.v2/libs/atomic/build/gcc-4.9/gentoorelease/boost.locale.icu-off/pch-off/threading-multi/lockpool.o" "libs/atomic/src/lockpool.cpp"


I have figured out that I need to invoke the 'b2' utility with the parameter "instruction-set=i486" :

Code:
b2 instruction-set=i486


However, I cannot find a clean way to pass this into the emerge environment. I'm looking for a clean solution, not hacking the config files mid-way through a build.

Can anybody suggest an elegant solution?

[Moderator edit: added [code] tags to preserve output layout. -Hu]
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Mon Jul 17, 2017 3:56 pm    Post subject: Reply with quote

The cleanest way I can think of is to create a new ebuild in overlay that is a modified form of the original ebuild.

Why would a build specify "i696"? It needs some instruction missing from earlier chips?

More power to you keeping the i486 alive!

EDIT:

Or a user patch to the portage ebuild.
Back to top
View user's profile Send private message
mwhitehe
n00b
n00b


Joined: 17 Jul 2017
Posts: 3

PostPosted: Mon Jul 17, 2017 4:22 pm    Post subject: Reply with quote

Can you post a link on how to create a new ebuild? I am new to Gentoo and am still learning.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Mon Jul 17, 2017 4:32 pm    Post subject: Reply with quote

Here you go.

Tip: you can search the net by yourself, too.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Mon Jul 17, 2017 5:17 pm    Post subject: Reply with quote

mwhitehe,

If you really mean pass in the environment, portage can do that on a per package basis.

Make a directory /etc/portage/env inside, create a file that does what you want. I have MAKEOPTS-j1, MAKEOPTS-j2 and a few others.
My MAKEOPTS-j1 contains
Code:
# use this for things that fail with any parallel make at all
MAKEOPTS="-j1"

These files define what you want to do. They don't do anything yet.

Make a file /etc/portage/package.env
and list packages that you wan the files in /etc/portage/env to apply to.
Code:
 # *** list things that need MAKEOPTS-j1 ... maybe ***
net-libs/webkit-gtk MAKEOPTS-j1
www-client/firefox MAKEOPTS-j1
mail-client/thunderbird MAKEOPTS-j1
app-office/libreoffice  MAKEOPTS-j1


The file names in /etc/portage/env are reminders for you.

The above is a real example from a 64 bit Raspberry Pi 3 install.
Code:
man portage
should explain this.
_________________
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
mwhitehe
n00b
n00b


Joined: 17 Jul 2017
Posts: 3

PostPosted: Mon Jul 17, 2017 6:21 pm    Post subject: Reply with quote

This worked for me.

The /usr/portage directory tree is populated when you first install the system, typically with "emerge --sync".

Edit /usr/portage/dev-libs/boost/boost-1.62.0-r1.ebuild. The version will vary over time, so you have to decide which version you want to edit.

I added "instruction-set=i486" to the OPTIONS variable in the src_configure() function. Here is a diff of my change:

Code:
--- boost-1.62.0-r1.ebuild.orig 2017-07-17 16:42:30.623493308 +0000
+++ boost-1.62.0-r1.ebuild      2017-07-17 17:26:33.272971870 +0000
@@ -141,10 +141,11 @@
        OPTIONS=(
                $(usex debug gentoodebug gentoorelease)
                "-j$(makeopts_jobs)"
      -q
                -d+2
+               instruction-set=i486
        )

   if [[ ${CHOST} == *-darwin* ]]; then
                # We need to add the prefix, and in two cases this exceeds, so prepare
        # for the largest possible space allocation.

Then I did "ebuild boost-1.62.0-r1.ebuild manifest clean merge". It built for i486 successfully.

Next I need a more general purpose way to pass in the desired cpu architecture (i486, i586, x86_64, etc). Perhaps a USE statement or similar would be a better way?

[Moderator edit: added [code] tags to preserve output layout. -Hu]
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Mon Jul 17, 2017 9:03 pm    Post subject: Reply with quote

mwhitehe,

What you have done is fine but you really need to do it in your own overlay as your next --sync will wipe out your change
_________________
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
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21635

PostPosted: Tue Jul 18, 2017 1:12 am    Post subject: Reply with quote

There are three ways to get the result you want:
  1. Modify the ebuild (preferably in an overlay). This is what you did.
  2. Use a Portage environment override to change the options passed to the upstream build. This only works in some cases, but by my reading of the dev-libs/boost ebuild, should work for what you need.
  3. Patch the upstream build to produce an equivalent effect, such as by adding the desired option as a new leftmost "hardcoded" argument.
Personally, I dislike modifying the ebuild (even in an overlay) if I can avoid it, since it means that I become responsible for applying an equivalent modification to every subsequent version bump for as long as I use that package. This constraint only matters for changes I expect no one else will accept. When it applies, I prefer to use one of the other methods, so that new versions automatically pick up my modification (unless the Gentoo ebuild or upstream build system has changed too much, but that is always a peril of maintaining private changes). Due to the way that the current ebuild is implemented, a Portage environment override should (disclaimer: not fully tested) do what you need and should automatically persist across Boost updates (unless the Gentoo ebuild changes in a particular way that I do not expect the maintainer would do).

To do this, create a file /etc/portage/env/dev-libs/boost and give it this content:
/etc/portage/env/dev-libs/boost:
post_src_configure() {
   OPTIONS+=( instruction-set=i486 )
   echo "OPTIONS updated to: ${OPTIONS[@]}"
}
To reiterate the above disclaimer: I tested this as far as passing the option to b2, but did not allow the build to complete. If you want the change merged to Gentoo Portage, you would need to guard it with a test that the user is on i486, not a later CPU that can accept the default option.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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