You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Daniel L. Rall" <dl...@collab.net> on 2004/03/12 18:44:19 UTC

Progress towards a usable SWIG/Java build

So it looks like I totally mis-read r7581 -- the need for reverting any of it 
seems quite slim.  With the changes I've made over the last couple days, the 
main outstanding item for that is the presence of the SWIG/Java code in the 
svn-api.jar file.  As I mentioned earlier, I'd originally intended only the 
non-SWIG .class files to go in there.  If we want to follow that division 
(still under investigation), the SWIG-dependent code should be moved into a 
separate JAR file (svn-swig.jar?).  Otherwise, svn-api.jar should probably be 
renamed (perhaps to svn-swig.jar anyhow).

Here's what I've found about the current state of the build:

I've confirmed that libsvn_subr and libsvn_delta are now auto-loaded.

The libsvn_swig_java is not copied over into the svn-java installation 
directory by the "install-swig-java" build target (as it is for the Python 
library).

Even though both apr and aprutil are mentioned in build.conf as deps for 
libsvn_swig_java, they do not appear to be getting auto-loaded when loading 
libsvn_swig_java from Java using System.loadLibrary().  Thoughts?

dlr@despot:dlr$ (export 
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/dlr/src/svn/subversion/bindings/swig/.libs:/usr/local/apr/lib"; 
java -classpath 
.:/home/dlr/src/svn/subversion/bindings/swig/java/build/svn-api.jar test)
Initializing SVN native resources...
Exception in thread "main" java.lang.UnsatisfiedLinkError: apr_initialize
         at org.tigris.subversion.swig.coreJNI.apr_initialize(Native Method)
         at org.tigris.subversion.swig.core.apr_initialize(core.java:23)
         at 
org.tigris.subversion.util.NativeResources.initialize(NativeResources.java:100)
         at test.main(test.java:9)

- Dan

Re: Progress towards a usable SWIG/Java build

Posted by Gustav Munkby <gr...@gmx.net>.
I've been looking into the building of the SWIG/Java bindings.

In difference from the usual swig bindings, all apis should be exported 
through one library. This is currently dubbed libsvn_swig_java-1.so, 
which might be confusing since it overlaps with the 
libsvn_swig_{py,pl}-1.so files which does something completely different.

I first made a usual makefile, which would be invoked from within the 
subversion/bindings/swig directory, this is attached as swigjava.mk

Then, per Daniel Rall's suggestion, I tweaked my build-outputs.mk, to 
include the build-rules specified by swigjava.mk.

I did so, and the attachment build-outputs.mk.patch is a patch of the 
build-outputs.mk generated on my computer from revision 9209.

After this introduction, I have a question, how do I change the build 
system, as per build.conf and the python generating scripts, to make 
sure that the build-outputs.mk gets the contents specified by the patch?

I could probably find out what has to be changed, but it would take very 
long time, and I assume that it would be a rather quick change for 
someone experienced with the build/configuration/generation thingie.

regards,
Gustav Munkby


Re: Progress towards a usable SWIG/Java build

Posted by "Daniel L. Rall" <dl...@collab.net>.
Daniel L. Rall wrote:
...
> Here's what I've found about the current state of the build:
> 
> I've confirmed that libsvn_subr and libsvn_delta are now auto-loaded.
> 
> The libsvn_swig_java is not copied over into the svn-java installation 
> directory by the "install-swig-java" build target (as it is for the 
> Python library).
...

libsvn_swig_java's .so is copied over if you run the install-swig-java-lib 
target.  For some reason, explicit invocation of this target isn't necessary 
for the SWIG/Python bindings.  (Thanks to Justin for pointing this out.)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Progress towards a usable SWIG/Java build

Posted by Gustav Munkby <gr...@gmx.net>.
Daniel Rall wrote:
> Daniel L. Rall wrote:
> ...
> 
>> Even though both apr and aprutil are mentioned in build.conf as deps 
>> for libsvn_swig_java, they do not appear to be getting auto-loaded 
>> when loading libsvn_swig_java from Java using System.loadLibrary().  
>> Thoughts?
>>
>> dlr@despot:dlr$ (export 
>> LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/dlr/src/svn/subversion/bindings/swig/.libs:/usr/local/apr/lib"; 
>> java -classpath 
>> .:/home/dlr/src/svn/subversion/bindings/swig/java/build/svn-api.jar test)
>> Initializing SVN native resources...
>> Exception in thread "main" java.lang.UnsatisfiedLinkError: apr_initialize
>>         at org.tigris.subversion.swig.coreJNI.apr_initialize(Native 
>> Method)
>>         at org.tigris.subversion.swig.core.apr_initialize(core.java:23)
>>         at 
>> org.tigris.subversion.util.NativeResources.initialize(NativeResources.java:100) 
>>
>>         at test.main(test.java:9)
> 
> 
> For some reason libsvn_swig_py.so dynamically links to apr_initialize, 
> while libsvn_swig_java.so does not.  Why?
> 
> svn$ nm -o subversion/bindings/swig/.libs/libsvn_swig_.so | grep apr_init
> subversion/bindings/swig/.libs/libsvn_swig_py-1.so:         U 
> apr_initialize
> 
> 

make swig-java
cd subversion/bindings/swig
gcc -g -pthread -shared -o libsvn_swig_java-1.so swigutil_java.o 
java/.libs/*.o -lsvn_client-1 -lsvn_wc-1 -lsvn_ra-1 -lsvn_fs-1 
-lsvn_delta-1 -lsvn_subr-1 -lsvn_repos-1

produces a functional libsvn_swig_java-1.so (linked against correct 
libraries, and importing apr_initialize as it's supposed to)

a little more libtoolish version (taken form the actual build, but added 
"java/*.lo" and most of the .la entries):

/bin/sh ../../../libtool --silent --mode=link gcc  -g -pthread 
-DNEON_ZLIB -DNEON_SSL    -rpath /usr/lib -o libsvn_swig_java-1.la 
swigutil_java.lo java/*.lo 
../../../subversion/libsvn_client/libsvn_client-1.la 
../../../subversion/libsvn_wc/libsvn_wc-1.la 
../../../subversion/libsvn_ra/libsvn_ra-1.la 
../../../subversion/libsvn_fs/libsvn_fs-1.la 
../../../subversion/libsvn_delta/libsvn_delta-1.la 
../../../subversion/libsvn_subr/libsvn_subr-1.la 
../../../subversion/libsvn_repos/libsvn_repos-1.la 
/usr/lib/libaprutil-0.la -lgdbm -ldb -lexpat /usr/lib/libapr-0.la -lrt 
-lm -lcrypt -lnsl  -ldl -lz

For one that doesn't know (and doesn't understand) what are the purpose 
of all the generated _client.so and so forth?

!g  <--  confused


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Progress towards a usable SWIG/Java build

Posted by Daniel Rall <dl...@collab.net>.
Daniel L. Rall wrote:
...
> Even though both apr and aprutil are mentioned in build.conf as deps for 
> libsvn_swig_java, they do not appear to be getting auto-loaded when 
> loading libsvn_swig_java from Java using System.loadLibrary().  Thoughts?
> 
> dlr@despot:dlr$ (export 
> LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/dlr/src/svn/subversion/bindings/swig/.libs:/usr/local/apr/lib"; 
> java -classpath 
> .:/home/dlr/src/svn/subversion/bindings/swig/java/build/svn-api.jar test)
> Initializing SVN native resources...
> Exception in thread "main" java.lang.UnsatisfiedLinkError: apr_initialize
>         at org.tigris.subversion.swig.coreJNI.apr_initialize(Native Method)
>         at org.tigris.subversion.swig.core.apr_initialize(core.java:23)
>         at 
> org.tigris.subversion.util.NativeResources.initialize(NativeResources.java:100) 
> 
>         at test.main(test.java:9)

For some reason libsvn_swig_py.so dynamically links to apr_initialize, while 
libsvn_swig_java.so does not.  Why?

svn$ nm -o subversion/bindings/swig/.libs/libsvn_swig_.so | grep apr_init
subversion/bindings/swig/.libs/libsvn_swig_py-1.so:         U apr_initialize



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org