PDA

View Full Version : FreeBSD 4.3 to Darwin


DarkSaint
01-24-2002, 03:31 AM
I am currently having difficulties porting a program from FreeBSD 4.3 to Darwin. When I begin to compile the program, it seems to work, until it hits a fatal error; "/usr/bin/ld: can't locate file for: -lcrt0.o" I did a grep search for anything even close to that description only to come up with a 'crt1.o' in that same directory. Is this file exclusive to *BSD systems, or is there a workaround so that I am able to use it, build upon it, and finish it on the Darwin platform?

sao
01-24-2002, 04:24 AM
Latest version of FreeBSD is 4.4

Many of the ports require the X Window System to compile and run. They compile and test their ports on XFree86.

http://www.xfree.org/

Latest version of XFree86 is 4.2

Cheers...

mervTormel
01-24-2002, 04:31 AM
if you would disclose the name of the package you are trying to compile, it would save me some shoe leather ;]

DarkSaint
01-24-2002, 10:51 PM
The program is a text game coded by a friend on his system. I wanted to host it locally from Darwin. I recently installed FreeBSD 4.4 onto my VPC drive and it successfully compiled the game without a hitch, though I don't want to host it from within VPC. I'm not the most hardcore of programmers nor a UNIX master, I'm just a little in between :)

-Thanks

mervTormel
01-24-2002, 11:05 PM
ds,

i wonder if this is a typo in the build file:

-lcrt0.o

there is a file /usr/local/lib/crt0.o

and -l is a switch to the ld command

so, perhaps yer build should look something like this:


ld ... -l crt0.o


just clutching at straws at this point.

let us know.

pmccann
01-25-2002, 10:15 PM
I think you must have installed that "crt0.o" file mervTormel, maybe inadvertantly (ie, via another install (from gnu-darwin perhaps?)). I don't have it there, and its absence does prevent compilation of some packages, notably expat 1.95.2. Maybe time for a hunt...

[[For what it's worth, which is not much: -lcrt0.o is fine. No need for the space]]

Anyway, DarkSaint might try the following workaround: look for any "-static" declarations in the "Makefile" you've been given. Just obliterate the "-static" every time you find it in that file and then see if the package will "make" successfully.

Best of luck,
Paul

DarkSaint
01-27-2002, 11:33 PM
Thanks for all of the replies, I'm glad I can find some individuals who like to help. Anyway, I did as you suggested and removed any -static flag in the makefile (there was only 1), and hit 'make', and this flew out:

/usr/bin/ld: warning /usr/lib/crt1.o cputype (173017772, architecture cputype 173017772 cpusubtype 180620004) does not match cputype (18) for specified -arch flag: ppc (file not loaded)
/usr/bin/ld: /usr/lib/libSystem.dylib load command 6 unknown cmd field

There is no -arch flag in the makefile, though not sure if it is supposed to be.

mervTormel - perhaps you could tell me what, if any come to mind, packages that might have installed the Darwin crt0.o, or even post the file somewhere. Any help would be greatly appreciated. :)

Thanks again.
-DS

mervTormel
01-28-2002, 12:51 AM
ds,

i examined my installation and can't figure out what installed crt0.o

% ll /usr/local/lib/crt0.o
-r--r--r-- 1 root wheel 9.0k Sep 14 17:02 /usr/local/lib/crt0.o

for what it's worth, here's the <object lib> (http://home.mindspring.com/~bduart/crt0.o.sit)

that might get you a little further along in your build.

also, be sure and do a google search for crt0.o as it might prove illuminating.

i remember seeing recently a darwintools.pkg on stepwise.com. perhaps that may prove useful.

mervTormel
01-28-2002, 12:58 AM
ds,

i just examined the darwintools.pkg, and in it is ./lib/crt0.o

but there's a lot of other stuff in there that may stomp on an installation, and i haven't evaluated the implications of that, so i declined to install it at this time.

DarkSaint
01-28-2002, 06:23 PM
I went ahead and installed the Darwin Tools, double checked for the /usr/lib/crt0.o, which was there, and hit make once again...

...
/usr/bin/ld: /usr/lib/libSystem.dylib load command 6 unknown cmd field

I guess compiling it is a lot deeper than simply missing a library file. :(

Thanks for all the help though, I truely appreciate it.

mervTormel
01-28-2002, 07:06 PM
yeah, what i think you have there are porting issues, i.e., the developer made little or no provisions for other platforms.

DarkSaint
01-28-2002, 10:03 PM
On a side note, everything I try to compile gives me a related error. I attempt to compile some tools when suddenly...

...
/usr/bin/libtool: object: /usr/lib/libSystem.dylib malformed object (unknown load command 6)

Same command number, same error. This is on a newly installed OS X 10.1.2 (installed it today as a matter of fact) with the Developers Tools. I'm wondering if the errors are somehow related.

mervTormel
01-28-2002, 10:44 PM
hmmmm, curious.

what tool were you compiling? let's see what happens when i try it.

a search at google turned up a single link of this problem, so not very popular...

http://www.google.com/search?hl=en&q=libSystem.dylib+malformed+object

DarkSaint
01-28-2002, 10:52 PM
Hmm, on the first link (http://p2p.wrox.com/archive/macos_x_help/2001-12/0.asp), the original question is nearly exactly mine. The tool I was attempting to compile is the dlcompat, but a newer version than the question on that site. I don't know if my library is corrupted or not, but at least I know I wasn't the only one with the problem. :)

DarkSaint
01-28-2002, 11:11 PM
On a side note, I have stupidly forgotten to download the 10.1 Dev Tools, instead I have been using 10.0's. Someone smack me. :)

mervTormel
01-28-2002, 11:12 PM
yeah, perhaps you were the only two with the prob :D

anyhow, there maybe something in the dlcompat install readme about this problem.

dlcompat may have a dependency on a wrangled version of libSystem.dylib or some such.

perhaps look for a patched up libSystem.dylib ?

FWIW, here's what mine looks like:


% ll /usr/lib/libSystem.dylib
lrwxr-xr-x 1 root wheel 17 Jan 17 12:26 /usr/lib/libSystem.dylib -> libSystem.B.dylib*

% ll /usr/lib/libSystem.B.dylib
-r-xr-xr-x 1 root wheel 1.2M Dec 6 01:26 /usr/lib/libSystem.B.dylib*

DarkSaint
01-29-2002, 01:00 AM
Whelp, that did it. dlcompat successfully installed, and then I tried my luck, crossed my fingers, and hit make on my game... and what do you know, it compiled! I ran it and boy if it ain't a work of art. I'd like to thank everyone who helped out, especially mervTormel for going out and checking sites for me. I hope this helps others when porting FreeBSD to Darwin apps.
Me go play game now :D