porting 'NIX software


Every program I have downloaded, generally Linux stuff that I need for my research, croaks when I try to compile it. Even ones which have been ported before (Afterstep for instance).

Obviously, I lack information and knowledge. I would be immensely grateful if someone could point me in the direction where I can learn more about how to deal with problems during "configure" and "make".

I've used the config.guess and config.sub from /usr/libexec, and made a symbolic link gcc -> cc. Helps a little but not much. Is the Mach kernel itself a problem?

I've basically got the same problem as you do. The only things i've been able to compile are command line things like lynx.

I am not an expert in unix but here is what I think it boils down to.

CLI apps just need a simple recompile to work (or the majority of em anyways) because they only use the command line which is universal amogst the unixes, but once you get a GUI involved then things change because each GUI has its own APIs and libs, and maybe, just maybe, most non-CLI apps that are outthere as sourcecode require those APIs and libs (either because they are too specialized, or because of sloppy coding) and they are not available on OS X.

non-cli apps do need some minor reworking (best case scenario) so do expect to get your hands dirty if you try to recompile one ;)

since apple already has two APIs for OSX, Carbon and Cocoa, would it be very hard to also have the x windows libs? I don't know much about such things but couldn't you, after porting X, just create an aqua theme instead of gnome or kde and have all three running together? Or are there fundamental problems with this (eg. does X require the widgets to be on the right side of the title bar). Stuff like the clipboard would also probably be hard to implement.

OK, there are two main hangups for many apps.

1) Configure don't work.
The config scripts can't recognize darwin, and even explicitly running ./configure -Apple-Darwin-PPC or whatever permutation doesn't always get it right.
But, Apple inclided all the necessary files for the config scripts to work. Provided the install doesn't use a custom config script (it really shouldn't) you can just copy the config scripts Apple provided:

%> cp /usr/libexec/config.* .
%> ./configure

(Thanks to sordid over at macnn)

2) Where is lm?
There is no lm library on darwin, because it has been rolled into something else. But programs that look for the lm libs (math libs -- especially a problem for scientific apps) run into trouble.
What to do?
Either you can manually remove all references to "-lm" in the makefiles (ugh...) or you can make a dummy lm file. Again, sordid provides the tip:
Do this as root to fix that problem:

echo "dumdum_fun(){}" >the.c
cc -c the.c
ar ur /usr/lib/libm.a the.o
ranlib /usr/lib/libm.a

Other problems are mroe exotic... but reading where the makefile pukes generally gives you some hints -- is it a missing library? Can I get that library somewhere? Is there a compile option I can turn off to avoid this problem? (like the -nosharedmem flags for gimp, I think...)

At worst, post what the makefile pukes out (just the interesting part, please, not the cascade of errors after the first one...) and maybe soemone here can help.

Many thanks zpinctus!
The lm lib fix helped really well! And now I have the WindowMaker (or Window Maker actually) window manager running under xwindows in parallel with Aqua on Public Beta (iBook). I may need help with other ports, though...

Re: Having an Aqua-like theme on xwindows. It would be nice, of course. Xwindows is said to be very configurable and was **very** surprised to learn that Apple was going 'NIX but NOT xwindows. The client-server function in xwindows is very useful and it's something OS X won't have unless we get it by installing xwindows.
Why build it all over - why not use xwindows? My only take on that is the historical problem. Perhaps there wasn't a good way of creating the carbon lib thing under xwindows, and they needed the ease of transferring old MacOS applications to OS X. Otherwise xwindows should have been the obvious way to go. Having their own core graphics manager seems rather dumb.

Well, thanks again!
X windows is a very primitive display layer -- most of the functionality is left to the applications to implement.

The move to base the graphics layer off the NeXT roots (like basically everything else) was a pretty smart one -- Quartz allows applications a lot more flexibility with the display. Native PDF support, antialiasing, multichannel and transparency effects, native vector object support (as opposed to bitmap) and many others are the advantages of Quartz over any other graphics layer. X windows is primitive compared to what OS 9 takes for granted, and OS 9 is primitive compared to Quartz.

X11 is flexible only because it operates at such a low level that in order to get it to do anything cool, you have to program it yourself, or hope someone else has. This, unfortunately, is not the way I want my desktop OS to run.

As far as display client/server, OS X actually does use this model internally. The "aqua" window manager really does run on top of the CLI guts of the OS, just like any *NIX. It isn't as in-your-face as it is with X11, but as far as I'm concerned that's a feature and not a bug. Perhaps in the future, we will be able to use it over a network, like you can with X11.

Anyhow, I'm really not trying to be rude, but the guts of X11 are really dated and pretty pobre, all in all.

That said, I use X windows a lot, and I'm glad it works on Darwin/OS X. But I'm also glad I can have something modern to look at and use and have apps take advantage of.

Though I'm not holding my breath for an aqua theme -- Apple has threatened basically everyone who posts Aqua themes for other OS's and made them take them down, citing "intellectual property." I can't blame them -- they spent a lot of time on this, and they want to make sure that the only thing that looks like OS X is OS X.

[Edited by zpincus on 02-16-2001 at 05:20 AM]
Originally posted by zpincus
[BThough I'm not holding my breath for an aqua theme -- Apple has threatened basically everyone who posts Aqua themes for other OS's and made them take them down, citing "intellectual property." I can't blame them -- they spent a lot of time on this, and they want to make sure that the only thing that looks like OS X is OS X. [/B]

Mr. Gates,
Your cease and desist order is in the mail


On a more serious note, X11 is the eunuchs equivalent of QuickDraw, which is to say it's a G and no UI. Trust me on this one, we do not want X11 proliferation.

The best plan of attack if you want to port a graphical eunuchs app is to port it to Cocoa then port it back to GNUStep so everybody benefits.
I have used X11 and I have one simple question...
WHY would anyone want to use an X11 environment ?????
THe command line is much better *even for novices * (IMHO) when
it comes to a choice between the two :p LOL

X11 isn't worth the time ;)

A good window manager makes X11 pretty decent.

At my school, you walk in to the UNIX lab, and all the boxes are running Windowmaker or something similar, and there is a toolbar with buttons to click on for emacs, xterm, etc. It is really easy. Not to mention the fact that having a mouse and menus (no matter how primitive) is almost always easier than a CLI.

Example: editing two files in emacs and making a big project.

CLI: Have to remember obscure commands to switch buffers in emacs, and to switch between programs.

X11: Can click on "buffers" menu to select buffer, can click on "xterm" window to look at how make's doing.

I can't believe that you could think otherwise, Admiral. What, have you only used TWM? Look at gnome and enlightenment or Eazel's Nautilus or KDE on someone's linux box (all of which run on top of X11) and then tell me with a straight face that the CLI is easier. Anyone who does serious *NIX work does a lot of it in the X11 environment.

At my school's UNIX labs they use motif (which I have associated with X11), running on a sun sparc Ultra5...

I have had linux on my mac and have used KDE and GNOME, and enlightenment to some extent.

I agree that these window managers are great but unfortunatelly the workstations don't use them. Furthermore, the emacs version they have available AFAIK is the CLI version...so I have to know the commands for switching between buffers.

I just find x11/motif to be very..clumsy and unbecoming of a GUI, and in situations like these I would prefer to use the CLI. IF I had the option of GNOME or afterstep I would change my mind in an instant :)


PS: one last thing I hate about X11/motif combo... when in the CLI and you type "logout" the stupid thing freezes on me. You have to specifically do a right click and click logout (or singout..cant remember) in order to get back to the login prompt :p