Mac Forums

Mac Forums (
-   OS X - Development and Darwin (
-   -   X fails to build on Darwin (

prushik 06-14-2009 01:34 AM

X fails to build on Darwin
I have installed Darwin 8.01 on my computer on an HFS+ partition. I have downloaded X from the website (curl > X11.tar.gz) and extracted it (gzip -dc X11.tar.gz > X11.tar ; tar -xf X11.tar ; cd xc). That works fine, I then try to build it (make World install). It builds with many errors and then installs to /usr/X11R6/. I add /usr/X11R6/bin/ to my path and try to start it (xinit or startx), however, it gives me an error telling me that X does not exist (the executable) it says it could be a simlink to XDarwin or XQuartz. So I checked the bin folder (ls /usr/X11R6/bin) and I do not see either of those files in there. It seems they do not build for some reason, but everything else does. I tried using gcc-3.3 gcc-3.5 and gcc-4.0 which all came installed with darwin, I also tried gcc-4.1 which I compiled myself. All resulted the same way. I looked online for instructions and they were almost identical to what I did, except they told me to get the source from via cvs. What should I do?

vansmith 06-14-2009 01:05 PM


Originally Posted by prushik (Post 859515)
It builds with many errors and then installs to /usr/X11R6/.

Either those "errors" were warnings or it didn't install.

Compiling source is always tricky and a hard endeavour unless you are willing to track down deps all day long. Your best bet would be to use something that takes this away from you. Now, the only thing I can think of working might be pkgsrc. You can bootstrap this for your platform and install xorg that way. This way, all the deps are handled for you and all you have to do is wait for it to build.

While that doesn't really answer your question, what kind of errors are you getting?

prushik 06-14-2009 01:36 PM

Nope. There are many warnings too, but there are many errors, namely while its compiling the xserver, drivers, and the fonts (fonts aren't so important). But it continues building through the errors, I know its unusual, but believe me, it does.
I redirected the errors to a file so I could read them, but it ended up being a huge file and as I am working in a Darwin, all I have is the terminal so looking through the file is difficult, its filled mostly with warnings. Heres a few I remember:
dereferencing pointer error (This is the error that keeps xserver and drivers from building)
exports/bin/bdftopcf - file or directory does not exist (One of these occurs with every font, its probably because something failed to build before)

So now that that is all said, I looked at my installation instructions again, and they say to use Xfree86 from their cvs repository, I had been using instead, from the web site. So I tried downloading Xfree86 instead, from the cvs repository, and the result was almost the same, except Xfree86 stops building after the 1st error. (dri_driver - dereferencing pointer error)

So I'm back to the drawing board. I'll try getting Xfree86 sources from the web instead, see if that makes a difference.

vansmith 06-14-2009 01:47 PM

You might have better luck with xfree86 because it isn't modular which I imagine would complicate building. cvs checkouts are always a crapshoot as the code could likely be broken, especially if Darwin isn't a supported platform (I don't know if it is or not). Have you considered bootstrapping NetBSDs pkgsrc (Darwin/OSX is a supported platform)? I've used pkgsrc and it worked well. It will save you a lot of headaches. Mind you, I didn't build something like X but I did build KDE4.

I commend you for trying to undertake this project but I think without some expert knowledge of compiling X, you're going to run into trouble.

prushik 06-14-2009 07:54 PM

Well I downloaded the current build and the dev snapshot of XFree86 and tried to build those, but they both failed. I really thought this would be easier... I have compiled X for linux before and I have cross-compiled the Xlib part of X for my armeb-xscale processor before. It compiled pretty easily. X has special config files for Darwin, but they just don't work, and from what I've read, XFree86 should just compile... Well I guess I will look into pkgsrc, I will definitely need some kind of package management software, I was looking into DarwinPorts and MacPorts, but they both need X to build and run.
I'll look into it and tell you what I come up with, any more advise would be welcome.

prushik 06-14-2009 11:01 PM

Well it seems that pkgsrc requires a case specific file system. HFS+ is not... I had a hard enough time setting it up in the first place, I'm not going to reformat in UFS and start over. I tried using it anyway, but it complained about bad checksums and then when I set the variable NO_CHECKSUMS to yes, it failed for other reasons.
So now I need to either manually compile X/XFree86 or find another package management system.... or reinstall on a UFS partition....
Portage is interesting to me, I wonder if that could work in Darwin.
Darwin seems to have a very small user base, I feel as if I am in uncharted waters.

vansmith 06-14-2009 11:10 PM

I don't know if Portage works on Darwin - it seems pretty Gentoo specific.

I'm sorry you had such bad luck with pkgsrc, it worked well for me (sort of). As for MacPorts, I'm not sure if it will work for Darwin. At this point, it might be worth a shot.

Mount DMG and Installer from the CLI.

I just thought of this now - Darwin 8.0.1 is old. This could likely be causing problems with libraries and such. Perhaps you should try a newer version of Darwin.

prushik 06-15-2009 12:57 AM

it certainly could be my problem. But Darwin 8.01 was the last Darwin that was distributed as an iso, anything newer was only distributed as source. I will look into it. I kind of fear that apple no long distributes source at all for Darwin. I actually got my Darwin 8.01 iso from another non-apple ftp site. But Ill look into getting the source.
As for portage, it is pretty gentoo specific, but there is a project called Gentoo/Alt I think that is dedicated to porting Gentoo to other OS's. I've been trying to install Gentoo/FreeBSD on my other HDD, but their installation CD won't boot for me. But maybe I could get portage running on Darwin. I'll try to upgrade my Darwin version 1st.

prushik 06-15-2009 01:27 PM

All Darwin source links seem to take me to the Apple Open source page for Mac OS X. But thats probably because those portions of Mac and Darwin are identical. So I downloaded the xnu kernel source and tried to build it, but it failed miserably, I don't know, maybe I'm doing it wrong. So I wrote a script to download and extract all the source for X11R7.4. The script worked mostly, except for some reason, libX11 won't download from the ftp (permission denied?), so I substituted libX11 from 7.3, which needs xcb, which needs python to compile, and python won't build correctly. But I think xcb is a pretty recent addition, so Ill try X11R7.1, which is, I believe the version that I successfully cross compiled for armeb-xscale.

vansmith 06-15-2009 01:52 PM

While I commend you for trying to do this, maybe you should stick to something like PureDarwin. This will let you avoid the tedious parts of compiling all of this and focus on whatever it is you want Darwin for. The nano iso might be what you're looking for and I believe it is based off of Darwin 9.

I will give that nano install a run tonight in VirtualBox to see what I can come up with.

prushik 06-15-2009 07:35 PM

I am pretty much just using Darwin for fun, to see what I can do with it. Besides the fact that I can't seem to get much running on it, I like it a lot. It boots really fast (under 20 seconds, my windows xp took over 10 minutes, windows 7 takes about 2 minutes), its very bare-bones (which I like, because then I can build from the ground up, or close to it), and its not linux (I love linux, but it has its problems).
I don't want to use PureDarwin because I feel Darwin is a starting point and that I need to add my own customization to it, PureDarwin is somebody else's customization. However, PureDarwin does look very intriguing. It looks like they are working on building a liveCD version of Darwin 9. Turns out I can't build Darwin from source right now as it can only be done on a Mac (according to something I read, I forget where, probably apple dev connection), and I currently do not have OSX installed, but I did just order 2 new hard drives, so I will soon probably.
I'm going to switch to Darwin now and see what I can do with X11R7.1 or 7.0.

vansmith 06-15-2009 08:15 PM

I wish you the best of luck ;). I would also hope this was just for fun. To be otherwise would be insane.

I tried PureDarwin in VirtualBox - that was a no-go. You're on your own now :).

prushik 06-15-2009 09:29 PM

I got the X11R7.0 sources and everything is there, I compiled everything up to libX11 (all dependencies satisfied). When I try to build libX11, builds a program called "makekeys", I can't figure out what its for, but it gets used in the build process, it does something to a source file, something to do with key codes. makekeys gets built, but when it trys to run it, it dies with a floating point exception. I remember when I cross-compiled I had a similar problem because it built makekeys for my target instead of my build system, so my build system couldn't run it. I fixed it by first compiling xlib for my build system and then moving the file over to my target source tree. That won't work since I can't build it for Darwin or cross-compile for Darwin, but maybe I can think of something, like finding a good output file from a working makekeys or something, I don't know, probably won't work. I think the problem may be that its still trying to use xproto from X11R7.4 instead of R7.0, I think the header that it modifies is from xproto. I'll work on it some more and see what I can come up with.
From what I have read, HFS+ is a very bad and problematic filesystem, causing many compilation errors in many different programs. That may be why xfree86 wouldn't build and it was why pkgsrc faild. If I can't get this to work I'll consider switching to UFS. That would mean starting from scratch, but really the only thing I don't want to lose is a good gcc-4.1 build.

prushik 06-15-2009 10:33 PM

Ok, I'm back in windows 7 now because libXfont has informed me that I must have freetype installed.
Using the correct xproto version worked, I now have a full client side X11R7.0 running on Darwin. Now all I need it the server and drivers, and I'm almost there.

Edit: After viewing the freetype website, I am wondering whether I should install freetype version 1 or 2. libxfont didn't specifically ask for a version. My gut and brain says go with version 1, but my heart says dev snapshot.

vansmith 06-15-2009 10:46 PM


Originally Posted by prushik (Post 860574)
libxfont didn't specifically ask for a version. My gut and brain says go with version 1, but my heart says dev snapshot.

My intuition say that, despite the nerd factor is using a dev snapshot, you should go with v1. I think you've suffered enough ;).

All times are GMT -4. The time now is 04:47 AM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.