Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED!] HOWTO gentoo-prefix on yosemite
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures
View previous topic :: View next topic  
Author Message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Tue Nov 11, 2014 3:47 am    Post subject: [SOLVED!] HOWTO gentoo-prefix on yosemite Reply with quote

Hi All,
I will not be explaining what gentoo-prefix is for in this document, but you can find some info at: https://www.gentoo.org/proj/en/gentoo-alt/prefix/ I am on a MacBook Pro 17-inch, (Early 2008). I will assume for now that this should work on all intel macs running yosemite, If somebody finds otherwise, please let us know.

First things first, prepare your system by installing the xcode command line utilities. The bootstrap-script for prefix will prompt you to do this if you haven't already. It will also tell you how. I don't believe you need the full version of xcode from the app store, but I happen to have it installed. Xcode includes a compiler that will be used for the bootstrap process. I am running xcode version 6.1.

You must open Xcode and accept the license with your admin password or else it will not function and you will fail while configuring the "make" package during stage 1.

Next you want to download the bootstrap script for gentoo-prefix. Basic install instructions are here: https://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap.xml The script can be downloaded directly from: http://rsync.prefix.bitzolder.nl/scripts/bootstrap-prefix.sh

Let's say you download it to your home directory, great lets just run it right? Thats how it works now! Thanks to some hard work by the gentoo-prefix devs this thing works flawlessly right now!

With the script in the home directory I do the following:
Code:

#make it executable (I'm assuming we are in $HOME and our script is there too)
$ chmod 755 bootstrap-prefix.sh
 
#go!
$ ./bootstrap-prefix.sh

NOTE: you do not need to do this as root, and the script will complain if you do. One of the major features of prefix is that it lives in user space.

The script will interact with you through a series of hilarious prompts. At any of these prompts you can hit enter for the bracketed default value, or type in your own and press enter. I am using all the default values for this attempt so I blow by and hit enter for everything. The script is incredibly intelligent, it will attempt to figure out what type of system you are running. because I am using defaults my gentoo prefix lives at /Users/uglyman/Gentoo/ I will assume you are doing the same.

After you wish the script luck, it will start downloading source code and bootstrapping your prefix system for you. As of yesterday this started to work just fine without all the workarounds. I have moved the old howto down to the replies of this post, just in case any of these changes get reverted, or if any of those problems come back in the next version or whatever.

Thanks to Amadio, RedLizard, Grobian, and all the people who have done such great work on Gentoo-prefix!

Thanks for the help everybody. I can go do the next part of my project now! 8)


Last edited by uglyman on Mon Dec 01, 2014 1:56 pm; edited 12 times in total
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Tue Nov 11, 2014 5:57 am    Post subject: Reply with quote

BTW, sorry if this thread should be in a different place, I have been away from the forums for a while, but somebody in the IRC channel for prefix linked me directly to here as a suggested place for this post. Mods feel free to move it if this should be in the OSX subforum or whatever.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Tue Nov 11, 2014 6:31 am    Post subject: Reply with quote

uglyman wrote:
BTW, sorry if this thread should be in a different place, I have been away from the forums for a while, but somebody in the IRC channel for prefix linked me directly to here as a suggested place for this post. Mods feel free to move it if this should be in the OSX subforum or whatever.

Yeah that was me; and I checked that the OS-X forum is locked before I recommended here, so it's not an issue.

Keep banging away ;-)
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Tue Nov 11, 2014 3:25 pm    Post subject: Reply with quote

Cool! It is looking like I have some time later today to work on the python problem, if anybody has this solved speak up, and I can move on to the next issue! If not prepare for filthy hacks... :mrgreen:
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Wed Nov 12, 2014 1:15 am    Post subject: Reply with quote

testing a workaround for the python issue. Will post after I have run it a couple of times without burning the house down.
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Mon Nov 17, 2014 3:31 pm    Post subject: Reply with quote

I am going to start fresh and test all the way through and post some updates to this today. I have a workaround for python but I am hung up on glib now, if somebody has a workaround for getting glib built let me know... otherwise I will work on that this afternoon

thanks
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Mon Nov 17, 2014 6:29 pm    Post subject: Reply with quote

Edited OP with my python build failure workaround. Working on glib next and hopefully we are about done here. 8O
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Tue Nov 18, 2014 3:32 am    Post subject: Reply with quote

Good work on python; what did #gentoo-prefix say about it? It sounds like it's going to be an ongoing situation, and gcc 4.8/9 are going to be interesting.
Back to top
View user's profile Send private message
craxyz
n00b
n00b


Joined: 18 Nov 2014
Posts: 1

PostPosted: Tue Nov 18, 2014 5:41 pm    Post subject: Reply with quote

There is a workaround for glib problem here: https://bugs.gentoo.org/show_bug.cgi?id=527656
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Tue Nov 18, 2014 7:15 pm    Post subject: Reply with quote

Hellos.
I have a working prefix now on yosemite! Or at least I did... I decided to blow it away and test my steps all the way through before I write it up. I don't want to lead any lemmings off my cliff... The glib workaround craxyz linked didn't work for me in the previous attempt, but it did work fine this time. I made a simple mistake before trying to set up a local overlay (I have been around too long, those settings keep moving and changing don't they?... but then I still type emerge sync all the time without "--" :D ).

Obviously pretty much all of these problems already had workarounds listed in the bugs, but "here is an ebuild and a patch, now go apply it during your bootstrap attempt" is not accessible for everybody. Not saying the bugs should be any different, those discussions are written well, but I was hoping I could help get some people running until those are resolved... since I needed to figure it out for my project anyway. Also hopefully this will help with confirming those bugs and the workarounds, maybe that will help things along at some point.

Amadio helped a lot in #gentoo-prefix thanks to him and the others. You are right steveL, this is an ongoing disaster. If I had to guess we would be moving to clang instead of gcc-apple, according to what I heard in the channel... sounds like the gcc-apple guys don't have the bandwidth for new features. I am not sure how much work and/or time that is to switch... but I am not sure there is ultimately any choice either.

I got hung up for a while on emerge system because it would fail on the last few packages and the script would do the entire 101 package world over again. Normally I would have hacked around that but I wanted to keep my instructions sane, so I was doing it the hard way, and testing the entire build again.

Anyway I should be able to get the workarounds for glib and the other failures written up this afternoon. I managed to build xfreecell and get it running with the official quartz, so I know my bootstrap was solid.

Stay tuned! :mrgreen:
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Wed Nov 19, 2014 12:16 am    Post subject: Reply with quote

I have updated again, hopefully it gets people running, lemme know when you find my mistakes!

:roll:
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Wed Nov 19, 2014 2:02 am    Post subject: Reply with quote

My test run has finished. I think we have it right for now. :wink:
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Fri Nov 21, 2014 8:59 am    Post subject: Reply with quote

just fixed a pathname I typoed. I have a friend testing tonight, he is almost done.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Fri Nov 21, 2014 4:48 pm    Post subject: Reply with quote

Good work uglyman :-)
uglyman wrote:
Obviously pretty much all of these problems already had workarounds listed in the bugs, but "here is an ebuild and a patch, now go apply it during your bootstrap attempt" is not accessible for everybody. Not saying the bugs should be any different, those discussions are written well, but I was hoping I could help get some people running until those are resolved... since I needed to figure it out for my project anyway. Also hopefully this will help with confirming those bugs and the workarounds, maybe that will help things along at some point.

Oh definitely: just thinking would be good to have your stuff in an overlay others can download from. This would be useful for you since you'd have somewhere defined to push to, which separates out the process when you're working. And ofc useful for others since they can simply add your git repo to layman, instead of applying several patches.

It's useful for Gentoo, imo, too, as it means you can collaborate more closely with users in the same situation as you, and feed back fixes to the main tree. That was pretty much the general idea of overlays when they came in.

You've been around since 02 so I don't think I have to explain how to do any of that ;) But let me know if you need help with a repo/trac; we run one for update and a couple of other (very) low-volume projects.
Quote:
If I had to guess we would be moving to clang instead of gcc-apple, according to what I heard in the channel... sounds like the gcc-apple guys don't have the bandwidth for new features. I am not sure how much work and/or time that is to switch... but I am not sure there is ultimately any choice either.

Yeah it does sound like prefix needs to change to clang from what you wrote above. If you can get it working for yourself, which you appear to be doing, at least for python, then I'd like to encourage you to simply experiment and see what you come up with. After all you're best-placed to judge whether the end-result is usable, and have the motivation to make it work. Especially since your bootstrap was stable.
Quote:
I got hung up for a while on emerge system because it would fail on the last few packages and the script would do the entire 101 package world over again. Normally I would have hacked around that but I wanted to keep my instructions sane, so I was doing it the hard way, and testing the entire build again.

Well I've looked at bootstrap-prefix.sh before a few times; so I don't mind helping with bash patching if you need it (and can be specific;)

Tell me, do you still find the prompts hilarious, btw? When I looked at the script I thought I'd find them incredibly annoying, especially during chroot setup when things go wrong, as they often do and will, such that resuming is very commonplace, ime.

Anyhow, keep it up, whatever path you decide to follow. :-)
Back to top
View user's profile Send private message
Ottre
Tux's lil' helper
Tux's lil' helper


Joined: 23 Dec 2012
Posts: 129

PostPosted: Fri Nov 21, 2014 9:24 pm    Post subject: Reply with quote

This seems like a good place to ask.

What's the procedure for getting packages keyworded ~ppc-macos and ~x86-macos? There are 6 versions of OS X for PowerPC and 5 versions for x86, do you have to test them all or just the most recent version for that architecture, or perhaps the two most recent versions?
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Sat Nov 22, 2014 7:28 am    Post subject: Reply with quote

I'd ask in #gentoo-dev-help or #gentoo-prefix Ottre, as it sounds more complex than a simple stabilisation request.

edit: oops keyworded unstable. ignore last link. You can take a look at the amd64 AT guide for general process; can't find a ppc project.

I'm sure they'd love the help though, if you wanted to become an AT for them.
Back to top
View user's profile Send private message
ghedamat
n00b
n00b


Joined: 22 Nov 2014
Posts: 1

PostPosted: Sat Nov 22, 2014 6:28 pm    Post subject: Thanks! Reply with quote

I just wanted to thank you uglyman and also all the gentoo-prefix team.

with your suggestions I was able to get it working in no time!

thanks again!
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Sun Nov 23, 2014 9:21 am    Post subject: Reply with quote

I have added a step after gcc-apple failed. After emerge --sync we are now masking the -r2 version of that ebuild. It popped into the tree in the last day or two and it doesn't build. I am working on figuring out why, but if we mask it and drop back to -r1 things seem to build fine.
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Sun Nov 23, 2014 10:05 am    Post subject: Re: Thanks! Reply with quote

ghedamat wrote:
I just wanted to thank you uglyman and also all the gentoo-prefix team.

with your suggestions I was able to get it working in no time!

thanks again!


You are welcome ghedamat! Glad to hear it was useful! :D
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Sun Nov 23, 2014 10:54 am    Post subject: Reply with quote

steveL wrote:
Good work uglyman :-)


Thanks! :D

Quote:
Oh definitely: just thinking would be good to have your stuff in an overlay others can download from. This would be useful for you since you'd have somewhere defined to push to, which separates out the process when you're working. And ofc useful for others since they can simply add your git repo to layman, instead of applying several patches.

It's useful for Gentoo, imo, too, as it means you can collaborate more closely with users in the same situation as you, and feed back fixes to the main tree. That was pretty much the general idea of overlays when they came in.

You've been around since 02 so I don't think I have to explain how to do any of that ;) But let me know if you need help with a repo/trac; we run one for update and a couple of other (very) low-volume projects.


This is a very interesting idea... I was kind of thinking about something along those lines. I am working on a larger project that might involve that kind of thing anyway, but getting prefix working on yosemite became a prerequisite for the next thing. I have been contacted by a few people who are using this howto successfully, so I know it is useful for others out there. I wouldn't mind trying to maintain something like you are talking about. I will start thinking in that direction a little more in the next couple of days, and see how it fits in my plans. I might need to do two separate overlays because the next phase of my project will be diverging in a weird direction from most prefix users. I also have some career drama going on right now that is complicating my time... that situation is not likely to resolve itself totally before April, but the general trend is sort of back toward sanity I think.

I have been away for a while, the last few years have been focused on my business. Overall it is good to be back, and I feel good about the feedback I am getting on this, so I will likely continue one way or another. It is nice to be recognized as an old timer! :P I think I was using gentoo for a while before I created this account. I spent a fair amount of time back then supporting other users and wrangling bugs. I learned a lot in those days doing daily automated test builds of my entire desktop system on all experimental packages... then I would come home from work excited to see how broken my computer was. I would sit there and chat on freenode and fix my machine every night. I suppose life was simpler back then, :roll: but it gave me some skills I use everyday now.

Don't assume I know how to do all that stuff, :lol: part of the curse of being a gentoo geezer is that things have changed a lot. I still catch myself typing emerge sync without the -- and then beat my head on the desk because that isn't supported anymore :(. I haven't had to use layman... all this new fangled stuff around here! But I always had local overlays manually configured, at least after that was invented :wink:

As for a place to host it, that would be really helpful. I have limited access to hardware these days (another thing that should be trending toward getting better next spring...). I have some time the next few days, let me poke around a little bit on my end and see if I can come up with anything useful that should be pushed.

Quote:
Yeah it does sound like prefix needs to change to clang from what you wrote above. If you can get it working for yourself, which you appear to be doing, at least for python, then I'd like to encourage you to simply experiment and see what you come up with. After all you're best-placed to judge whether the end-result is usable, and have the motivation to make it work. Especially since your bootstrap was stable.


You are right, my bootstrap seems to be very stable... with the exception of new problems getting pushed into the tree this week. Of course that is expected with this sort of thing. I am using the system clang that comes with xcode to build python and a couple of other packages on my system. I haven't tried building my own clang yet. Bootstrapping with clang is a very interesting puzzle. I see out there between the bugs and IRC, that there is some work going on where they are exploring that possibility. These guys seem to be quite a bit smarter than me, so I am assuming there are some gotchas or they would have already done it.

I feel like me trying to build entire prefixes with clang is a little bit out of scope for my current project, basically the prefix I currently have working seems to have everything I need. Then again, I would like to see it happen. I guess I will put that on the drawing board and see what it looks like over the next week or so. If I can automate certain parts of my other project I could probably leverage that automation to test using clang more. If I can fit that in and have the spare cycles I will take a stab at it.

Quote:
Well I've looked at bootstrap-prefix.sh before a few times; so I don't mind helping with bash patching if you need it (and can be specific;)


Sounds good! I have been looking at it too. I am knocking the dust off a dusty filing cabinet in the back of my head this week. I am quite ashamed at having to look up syntax for awk one liners to jog my memory last night. :cry: Most of the stuff I need to do with bootstrap can be in an external wrapper, but some of it would probably be useful to others. I will keep your offer in mind if I come up with ideas for that script.

Quote:
Tell me, do you still find the prompts hilarious, btw? When I looked at the script I thought I'd find them incredibly annoying, especially during chroot setup when things go wrong, as they often do and will, such that resuming is very commonplace, ime.

Anyhow, keep it up, whatever path you decide to follow. :-)


Yes, the prompts are still hilarious... I have seen most of them a few times now. I didn't expect any of that when I started this :lol:

I think it would be useful if the echos on failure could let you know where the script would pick up if run again... That would have saved me a little bit of screwing around. For example when it fails on gcc-apple it tells you that, but the first time through you aren't sure if running the script again will pick up from there, or from some earlier step. I realize now how intelligent that script is about those things (except during emerge system, which starts over at the beginning everytime AFAIK), but before I knew how that worked I had to spend some time to figure it out. If it could exit with a line that says what the next command would be if we re-run it would be a good hint for beginners what package needs to be fixed too.

Thanks for the words of encouragement, this has been a fun week. Also thanks to all those who have given me feedback about this so far. It has really been cool :D
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Mon Nov 24, 2014 9:48 pm    Post subject: Reply with quote

uglyman wrote:
I wouldn't mind trying to maintain something like you are talking about. I will start thinking in that direction a little more in the next couple of days, and see how it fits in my plans. I might need to do two separate overlays because the next phase of my project will be diverging in a weird direction from most prefix users.

Yeah makes sense; have one out there as a base people collaborate on, and use that as prereq for the other.
Quote:
As for a place to host it, that would be really helpful. I have limited access to hardware these days (another thing that should be trending toward getting better next spring...). I have some time the next few days, let me poke around a little bit on my end and see if I can come up with anything useful that should be pushed.

Cool; if you want to sort that out, let me know either via pm or on IRC (/msg memoserv send igli ... if I'm not around in #friendly-coders) although it looks like amadio is on the case with clang, from convi today in #-prefix and #-portage; see bug 530382. ATM they're hacking in bashrc.
Quote:
I am quite ashamed at having to look up syntax for awk one liners to jog my memory last night.

Heh #awk on IRC: chat.freenode.net will soon bring you back up to speed ;)
Back to top
View user's profile Send private message
Gurn
n00b
n00b


Joined: 21 Nov 2014
Posts: 3
Location: Seattle, WA USA

PostPosted: Tue Nov 25, 2014 5:27 am    Post subject: Reply with quote

Thank you uglyman!

I was worried about making mistakes even while following your excellent HOWTO, so I put the steps in a script:

Code:
#!/bin/bash
set -o xtrace
if [[ -z "$EPREFIX" ]]
then
   export EPREFIX="${HOME}/Gentoo"
fi
cd
curl -o bootstrap-prefix.sh http://rsync.prefix.bitzolder.nl/scripts/bootstrap-prefix.sh
chmod +x bootstrap-prefix.sh
printf '\n\n\n\n\n' | ./bootstrap-prefix.sh &> bootstrap_1.log
export PATH="${EPREFIX}/usr/bin:${EPREFIX}/bin:${EPREFIX}/tmp/usr/bin:${EPREFIX}/tmp/bin:/usr/bin:/bin"
emerge --sync &> bootstrap_2.log
echo "=sys-devel/gcc-apple-4.2.1_p5666-r2" >> "${EPREFIX}/etc/portage/package.mask"
printf '\n\n\n\n\n' | ./bootstrap-prefix.sh &> bootstrap_3.log
emerge bash &> bootstrap_4.log
printf '\n\n\n\n\n' | ./bootstrap-prefix.sh &> bootstrap_5.log
mkdir "${EPREFIX}/etc/portage/env"
echo "CC=clang" >> "${EPREFIX}/etc/portage/env/clang"
echo "CXX=clang++" >> "${EPREFIX}/etc/portage/env/clang"
echo "dev-lang/python clang" >> "${EPREFIX}/etc/portage/package.env"
emerge --nodeps python &> bootstrap_6.log
printf '\n\n\n\n\n' | ./bootstrap-prefix.sh &> bootstrap_7.log
curl -o "${HOME}/Downloads/glib-2.40.2-osx.patch" "https://527656.bugs.gentoo.org/attachment.cgi?id=387908"
curl -o "${HOME}/Downloads/glib-2.40.2-r1.ebuild" "https://527656.bugs.gentoo.org/attachment.cgi?id=387910"
mkdir -p "${EPREFIX}/usr/local/portage/"{metadata,profiles}
echo "local" > "${EPREFIX}/usr/local/portage/profiles/repo_name"
echo "masters = gentoo_prefix" > "${EPREFIX}/usr/local/portage/metadata/layout.conf"
echo PORTDIR_OVERLAY="${EPREFIX}/usr/local/portage ${PORTDIR_OVERLAY}" >> "${EPREFIX}/etc/portage/make.conf"
mkdir -p "${EPREFIX}/usr/local/portage/dev-libs/glib"
cp "${HOME}/Downloads/glib-2.40.2-r1.ebuild" "${EPREFIX}/usr/local/portage/dev-libs/glib/"
cp -r "${EPREFIX}/usr/portage/dev-libs/glib/files" "${EPREFIX}/usr/local/portage/dev-libs/glib"
cp "${HOME}/Downloads/glib-2.40.2-osx.patch" "${EPREFIX}/usr/local/portage/dev-libs/glib/files/"
pushd "${EPREFIX}/usr/local/portage/dev-libs/glib"
repoman manifest
popd
echo "dev-libs/glib -aqua" >> "${EPREFIX}/etc/portage/package.use"
echo "sys-devel/binutils-apple clang" >> "${EPREFIX}/etc/portage/package.env"
printf '\n\n\n\n\n' | ./bootstrap-prefix.sh &> bootstrap_8.log

I decided to DVR the gentoo movie, but if anybody wants to watch it live, just comment or delete the "&> bootstrap_?.log" parts.

If you set EPREFIX to something before running this, then that something will become your prefix directory. If it's unset (and all goes well) then prefix will be installed in ~/Gentoo and can be started with ~/Gentoo/startprefix. Unfortunately it won't stop trying to bootstrap if something unexpected goes wrong--but it will all be there in the logs. xfreecell is installed and running smoothly now thanks to master uglyman!
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Tue Nov 25, 2014 3:46 pm    Post subject: Reply with quote

I know they are pushing some changes that will probably break this script, but I did witness it working, first hand the other night. The most comprehensive automated installation of xfreecell I have ever seen. I will try and find time today to edit the howto for the new bootstrap they just pushed. I suspect a few of the build breaks have been fixed. For the ones that haven't, my workarounds might still work.
Back to top
View user's profile Send private message
Gurn
n00b
n00b


Joined: 21 Nov 2014
Posts: 3
Location: Seattle, WA USA

PostPosted: Wed Nov 26, 2014 9:05 am    Post subject: Reply with quote

You're right, changes today made things much simpler. Nuked my prefix folder and bootstrapped successfully again with these steps:

Code:
#!/bin/bash
set -o xtrace
cd
curl -o bootstrap-prefix.sh http://rsync.prefix.bitzolder.nl/scripts/bootstrap-prefix.sh
chmod +x bootstrap-prefix.sh
export LATEST_TREE_YES=1
printf '\n\n\n\n\n' | ./bootstrap-prefix.sh
Back to top
View user's profile Send private message
uglyman
Apprentice
Apprentice


Joined: 21 Apr 2002
Posts: 216
Location: Seattle, WA USA

PostPosted: Wed Nov 26, 2014 12:39 pm    Post subject: Reply with quote

Ok, I am moving the original howto here for posterity, and in case any of the changes get reverted we have a place to look at it. I will edit the top post in a couple of minutes.

This is the old way, look to the OP for the current method:

Hi All,
Working on a little project here and need to get gentoo-prefix installed in OSX Yosemite. I see that a lot of people are having problems as the bootstrap process breaks on the newest OSX. I am putting together what workarounds I can. Most of the stuff in here is taken straight from the bugs. Amadio, Grobian, and the other guys from the project have done the hard part. I am just trying to document my steps to actually implement those changes, and hack together a working prefix. It is my understanding that these fixes will be committed somewhat soon, so some of these workarounds will not be needed as that happens.

Hopefully some people around here can either help with, or benefit from this effort. Thanks to Amadio and the other guys in #gentoo-prefix on freenode for the help! You can find all the bugs as either dependancies or duplicates of this one: https://bugs.gentoo.org/show_bug.cgi?id=527514

This isn't quite supported yet as I understand it. I will not be explaining what gentoo-prefix is for in this document, but you can find some info at: https://www.gentoo.org/proj/en/gentoo-alt/prefix/ I am on a MacBook Pro 17-inch, (Early 2008). I will assume for now that the problems I am running into happen on all intel macs running yosemite, If somebody finds otherwise, please let us know.

NOTE: This method is not ready for prime time, don't use it for anything important because we will be pushing our luck a little here. I am not writing this for a totally inexperienced audience, if you have questions feel free to ask. I also am new to the modern gentoo-prefix so my methods may not be the preferred way. If anybody has suggestions, feel free.

First things first, prepare your system by installing the xcode command line utilities. The bootstrap-script for prefix will prompt you to do this if you haven't already. It will also tell you how. I don't believe you need the full version of xcode from the app store, but I happen to have it installed. Xcode includes a compiler that will be used for the bootstrap process. I am running xcode version 6.1.

You must open Xcode and accept the license with your admin password or else it will not function and you will fail while configuring the "make" package during stage 1.

Next you want to download the bootstrap script for gentoo-prefix. Basic install instructions are here: https://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap.xml The script can be downloaded directly from: http://rsync.prefix.bitzolder.nl/scripts/bootstrap-prefix.sh

I moved mine from the Downloads directory into my home directory, you can run it from wherever. It doesn't seem to crud up whatever directory you store it in, it will use whatever location you want for the install. You will need to make it executable. For the purpose of this document I am going to assume you are using the same locations I am for both the script, and your gentoo prefix location. If you want to change these, it is easy, but you may need to edit my commands a little bit with absolute pathnames or whatever.

With the script in the home directory I do the following:
Code:

#move to $HOME and bring the script to us
$ cd
$ mv Downloads/bootstrap-prefix.sh ./

#make it executable
$ chmod 755 bootstrap-prefix.sh

#go!
$ ./bootstrap-prefix.sh

NOTE: you do not need to do this as root, and the script will complain if you do. One of the major features of prefix is that it lives in user space.

The script will interact with you through a series of hilarious prompts. At any of these prompts you can hit enter for the bracketed default value, or type in your own and press enter. I am using all the default values for this attempt so I blow by and hit enter for everything. The script is incredibly intelligent, it will attempt to figure out what type of system you are running. because I am using defaults my gentoo prefix lives at /Users/uglyman/Gentoo/ I will assume you are doing the same.

After you wish the script luck, it will start downloading source code and bootstrapping your prefix system for you. This is super smooth until it tries to compile the sys-devel/gcc-apple package. This fails for me. The script fails gracefully with a funny message about how sad the whole situation is.

I have discovered by poking around for a couple of days that you can get a newer snapshot and get a lot further. This is referenced if you poke around in this bugs. Oldfrog has suggested a method to avoid this failure altogether, I have not tested it yet. I will try this next time around... The way that I have tested is after this next code block. Keep in mind if you don't sync at some point you will be on different versions and may have different problems... I am using this first failure as a chance to sync, so YMMV
Code:

#untested! my method is in the next code block.
#Thanks Oldfrog in the irc for suggesting this!
$ export MACOSX_DEPLOYMENT_TARGET=10.9


OK, so gcc-apple failed, you have decided to stick with my method for now (you didn't do the thing above), here we go:

First you need to set your path so that it looks in prefix for the stuff you are about to do. I just do it like the script does it:
Code:

#fixing our environment variables
$ export EPREFIX="$HOME/Gentoo"
$ export PATH="$EPREFIX/usr/bin:$EPREFIX/bin:$EPREFIX/tmp/usr/bin:$EPREFIX/tmp/bin:/usr/bin:/bin"

Then we will sync up and get all the latest and greatest and mask the gcc-apple -r2 ebuild which seems broken right now

Code:

#update our portage tree
$ emerge --sync
$ echo "=sys-devel/gcc-apple-4.2.1_p5666-r2" >> Gentoo/etc/portage/package.mask

IGNORE WARNINGS ABOUT PORTAGE BEING OUT OF DATE... I am not sure if updating it will break things in the bootstrap process, but it might.

For a while I was trying to get cute and execute parts of the script, or add some arguments while calling the script, in order to make it skip the stuff I had already done. Now I see the script has some magic to just know what has already been done and pick up pretty close to where it left off. So we just run it again, and set our settings the same (which in my case is defaults, so bang on enter key until it does stuff).
Code:

#GO!
$ ./bootstrap-prefix.sh

At this point the script chugs along and fails again on app-shells/bash-4.1_p17 I have found that emerge bash will get you past here. It pulls in a couple of other packages
Code:

#install bash using the normal method
$ emerge bash

This installs 3 packages for me: sys-libs/readline-6.2_p1-r1::gentoo_prefix, virtual/yacc-0::gentoo_prefix and app-shells/bash-4.2_p53::gentoo_prefix SWEET, lets go back to the script then:

Code:

#booost!
$ ./bootstrap-prefix.sh

Set your options the same again, I just blow by everything with enter again for the defaults. Now we are chugging along watching the gentoo movie again. Eagerly awaiting our next failure... which is: dev-lang/python-2.7.8 Here things get a little sticky... I see threads like this floating around: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63651 it appears that apple has changed what is legal in objective C. AFAIK gcc-apple does not support these changes... So when python tries to build against NSObject.h in the xcode framework it fails hard....

Ok, so we need to hack our way around this to get a working prefix. The method I have found works fine is to use clang instead of gcc-apple. Clang doesn't choke on the "modern" objective C syntax in that header file. There is a good chance other packages are broken with clang, I haven't tried to set it globally. I wanted to just set only python to build with clang and get past here. Luckily portage has a simple way to do this. We define a build environment that uses clang and then tell portage to build dev-lang/python using this environment. Note, I am issuing these commands from my home directory, and my prefix lives at a relative path of Gentoo/

Code:

#setup portage for env
$ mkdir Gentoo/etc/portage/env

#add an env for clang
$ echo "CC=clang" >> Gentoo/etc/portage/env/clang
$ echo "CXX=clang++" >> Gentoo/etc/portage/env/clang

#set python to use our new clang env
$ echo "dev-lang/python clang" >> Gentoo/etc/portage/package.env
$ emerge --nodeps python


NOTE: If you call emerge as I have done here your settings for the python package should be used. If you skip that and go straight back to the script I believe it will ignore your wishes to use clang and you will fail as before. Somebody correct me if this is not true!

Python builds just fine with clang without messing with removing aqua or anything fancy. Now we will go back to the bootstrap script and continue until the next failure

Code:

#I'm tired.
$ ./bootstrap-prefix.sh


I blow by the prompts with enter since I am all defaults again. Keep in mind everything else we are still building with gcc-apple, which is going to be broken anytime we try and use those headers from xcode framework. More drama ahead I am sure... For me this fails on glib. Fortunately a solution lives in one of the bugs: https://bugs.gentoo.org/show_bug.cgi?id=527656 Amadio has provided an ebuild and a patch in comments 2 and 3. Go ahead and download those (I assume they are going to your ~/Downloads directory). The problem is how do we actually apply those to the bootstrap process? Well I need a local overlay for the project I am working on, so I will just go ahead and set up one of those. That way I can lay whatever ebuilds and patches I want into it... but this should be the only one we need for bootstrapping.

I do this the manual way. Forgive me if I make a mistake here, the ways that I have memorized to do this were deprecated years ago. I am modifying the commands from http://wiki.gentoo.org/wiki/Overlay/Local_overlay to get this working. Be careful if you are copy/pasting my commands, I will use some absolute pathnames here that include my user directory. You will need to modify those unless you are also uglyman... I am assuming we are still in the home directory with our exports from above.

Code:

#create a local overlay in $EPREFIX/usr/local/
$ mkdir -p Gentoo/usr/local/portage/{metadata,profiles}
$ echo 'local' > Gentoo/usr/local/portage/profiles/repo_name
$ echo 'masters = gentoo_prefix' > Gentoo/usr/local/portage/metadata/layout.conf

#Tell portage about it with ONE big awkward command that will probably wrap badly here
$ echo 'PORTDIR_OVERLAY="/Users/uglyman/Gentoo/usr/local/portage ${PORTDIR_OVERLAY}"' >> Gentoo/etc/portage/make.conf

#create glib overlay and put Amadio's ebuild in it:
$ mkdir -p Gentoo/usr/local/portage/dev-libs/glib
$ cp Downloads/glib-2.40.2-r1.ebuild Gentoo/usr/local/portage/dev-libs/glib/

#copy entire glib files directory from main portage tree because I don't know what I need
$ cp -r Gentoo/usr/portage/dev-libs/glib/files Gentoo/usr/local/portage/dev-libs/glib

#put Amadio's patch in our new files overlay for glib
$ cp Downloads/glib-2.40.2-osx.patch Gentoo/usr/local/portage/dev-libs/glib/files/

#build a manifest for the overlayed ebuild:
$ pushd Gentoo/usr/local/portage/dev-libs/glib
$ repoman manifest # <-- takes time, be patient
$ popd

#set use=-aqua for glib as per Amadio's comment in the bug
#this package gets built again at the end of emerge system so...
#you need to record this as a permanent change to finish bootstrapping
$ echo "dev-libs/glib -aqua" >> Gentoo/etc/portage/package.use


At this point, if I didn't make any mistakes, and you didn't make any mistakes you should be able to restart the script and it will use your nice overlay of Amadio's fixes. NOT SO FAST. In my experience this will chug away for a long time and fail near the end of emerge system as per this bug: https://bugs.gentoo.org/show_bug.cgi?id=527676 I think it builds fine with clang, I am testing that now and will hustle back in here and edit if I am wrong. You will waste a lot of time if we don't fix this one before we start the script again:
Code:

#this only works if you have set up clang env as we did to beat the python bug above!
$ echo "sys-devel/binutils-apple clang" >> Gentoo/etc/portage/package.env

#HERE WE GO! (wish me and the script luck this time!)
$ ./bootstrap-prefix.sh

Last time through the prompts! (I hope)

Hopefully we have done it, I had it working this morning. I managed to build xfreecell and play a game under the official quartz distribution. Then I deleted it all to test my steps again. My current test just finished, we have arrived at our destination for now.

Thanks for the help everybody. I can go do the next part of my project now! 8)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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