There was a general problem in mapserver with OSX, at one time an Xcode update caused unwind_resume errors in linking. But it has been fixed: LD should be C++. It looks like the current 5.0 release has this fixed in the java mapscript makefile, at least as far as the LD definition goes. But the link command is wrong - it uses $(CC) instead of $(LD), and uses the wrong flag for a dynamic library:

        $(CC) -fpic -shared mapscript_wrap.o -o libmapscript.so $(LDFLAGS)

This should be (-single_module is also a good idea):

$(LD) -fpic -dynamiclib -single_module mapscript_wrap.o -o libmapscript.so $(LDFLAGS)

This is a very specific casse - the shared/dynamic lib flags should also be set by configure for the system, like in the PHP mapscript makefile.

Note also that CC is set twice in the java mapscript makefile - once from configure, then again hardwired to gcc. This will override any custom GCC setting from configure (like when I do universal builds).


BUT, I've done this, and java mapscript doesn't work (I forget the error). I don't have time (or much interest) to fiddle with java mapscript. If you want to look into this you should file bug reports for any problems you find.


On Oct 22, 2007, at 1:40 PM, Z Kissane wrote:

Short version:  I'm trying to get the Java Mapscript
shared library to compile on OS X Tiger.  I've been
trying to hack the Makefile to get it to work.
Everything compiles just fine (including the jar
file), it's the linker that's giving me grief.  Both
Mapserver 4.10 and Mapserver 5 will not build the Java
Mapscript shared library "out of the box" as far as I
can tell.  I have followed the guide  at kyngchaos.com
to get Mapserver itself to build, which works just
fine.

Longer version:  The linker for OS X is a little bit
"special".  I don't know if I'm supposed to be using
ld via g++, ld on its own, or libtool.  Also, the Sun
JVM for OS X is "special" in its own right; it
requires JNI libraries passed to the JVM to be named
<libname>.jnilib.    It will ignore libraries like
<libname>.so.  I found this out after I had tabled the
project, but had actually produced some .so output
files (which the JVM was ignoring even though I was
passing their directory to java.library.path).  I
renamed them one by one to libmapscript.jnilib , and
it turned out that one of them did, in fact work, but
by then I had tried something else with the Makefile,
wiping out the "good" settings.

Basically, I can't remember what combination of g++,
ld, libtool, -dynamic, -dynamiclib, and -bundle or
whatever got me the file that worked.  If you're
playing along at home, I do know that you have to hack
the JAVA_INCLUDE variable in the Makefile to point at
the proper location for the Java headers; mine is
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/ JavaVM.framework/Versions/1.5.0/headers
I also know that, out of the box (or rather, after you
run configure in the main Mapserver build) that the
SUP_LIBS variable incorrectly uses the iconv header
variable, ICONV_INC, rather than the iconv library
variable, ICONV_LIB, which drove me nuts for a couple
of hours.  You may also get linker errors because it
tries to use gcc to link instead of g++, which means
it gets cut off from some C++ libraries that it needs;
I don't know, all the problems have kind of blurred
together at this point.  But if somebody can just tell
me which tool and which options will produce the
library I would be most grateful.

Thanks,
Zach Kissane
[EMAIL PROTECTED]

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

[Trillian] What are you supposed to do WITH a maniacally depressed robot?

[Marvin] You think you have problems? What are you supposed to do if you ARE a maniacally depressed robot? No, don't try and answer, I'm 50,000 times more intelligent than you and even I don't know the answer...

- HitchHiker's Guide to the Galaxy

Reply via email to