This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: building gcj on OS X (also AWT)



On May 20, 2004, at 22:30, John Gabriele wrote:

You're welcome.


It took about 4 hours for me to "make bootstrap", but here I am
with a nice fresh gcj binary. :) Right off the bat though, what
puzzles me is, when I run gcj it presumably uses other tools in
/usr/local/gcj/bin and /usr/local/gcj/libexec to do its job (g++,
gcc, the preprocessor, etc.). Since I installed everything in
/usr/local/gcj, and since that directory is *not* in my path,
when I run

    /usr/local/gcj/bin/gcj -c Foo.java
    /usr/local/gcj/bin/gcj --main=Foo -o myProgram Foo.o

how does gcj find the tools it needs in /usr/local/gcj if
that directory isn't in my $PATH? Why doesn't it get the wrong
tools instead (the ones in /usr/local/bin) and barf?

Because this is the way GCC was always worked, GCC the driver tries to finds its compilers via a couple of different directories and the first one is always PREFIX/libexec/gcc/TARGET/VERSION/ and if it does not match in there or the executable is really in a different place, it looks for them via a relative path from the driver.

Same goes for libraries. I'm not sure how OS X does things,
but I know that:

 A. I've got two libstdc++'s (one in /usr/local/gcj/lib and the
    other in /usr/lib).

Two reasons: 1. because GCC when invoked does a -LPATH_TO_LIBRARIES_FOR_THIS_GCC

	2. Because on Mac OS X the library installed path gets built into
the executable so it finds the right one.


 B. I haven't edited any /etc/ld.so.conf and haven't run any
    ldconfig (which, I notice don't even exist on OS X)

Explained about in 2.



So, when I run my little myProgram (which works fine), how does it find the right libstdc++? (or any other lib that it needs from /usr/local/gcj/lib for that matter). (Hmm... no ldd here either...)

Explained in 2. Also read dyld's man page for more information.



Thanks, Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]