B4Alpha-Aft3r0mega / javacpp

Automatically exported from code.google.com/p/javacpp
GNU General Public License v2.0
0 stars 0 forks source link

Multiple -l<library> when generating bindings with multiple files. #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We are using JavaCPP to generate bullet bindings for our 3D engine. When there 
are multiple @Platform(link = "bullet") scattered
in the bindings JavaCPP generates multiple -lbullet arguments. One for each 
file.

We are using the Android NDK.

What steps will reproduce the problem?

Invoke JavaCPP to generate one library using multiple input files with 
individual @Platform() annotations.

We invoke JavaCPP like this:

http://code.google.com/p/dinja-engine/source/browse/physics/pom.xml#66

What is the expected output? What do you see instead?

The following output is generated:

/home/adamw/Archives/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebu
ilt/linux-x86/bin/arm-linux-androideabi-g++ 
-I/usr/lib/jvm/java-6-sun-1.6.0.26/include 
-I/usr/lib/jvm/java-6-sun-1.6.0.26/include/linux 
-I/home/adamw/Archives/android-ndk-r7/sources/cxx-stl/gnu-libstdc++/include/ 
-I/home/adamw/Archives/android-ndk-r7/sources/cxx-stl/gnu-libstdc++/libs/armeabi
-v7a/include/ 
-I/home/adamw/Archives/android-ndk-r7/platforms/android-5/arch-arm/usr/include/ 
-I/home/adamw/Projects/dinja-engine/physics/src/main/java/../cpp/ 
/home/adamw/Projects/dinja-engine/physics/target/classes/lib/armeabi-v7a/jniBull
etNative.cpp -march=armv7-a -mtune=xscale 
/home/adamw/Archives/android-ndk-r7/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v
7a/libsupc++.a -Wl,-rpath,lib/ -DANDROID -ffunction-sections -funwind-tables 
-fstack-protector -funswitch-loops -finline-limit=300 -Wall -O3 -nostdlib -fPIC 
-shared -Wl,--no-allow-shlib-undefined -s -o 
/home/adamw/Projects/dinja-engine/physics/target/classes/lib/armeabi-v7a/libjniB
ulletNative.so 
-L/home/adamw/Archives/android-ndk-r7/sources/cxx-stl/gnu-libstdc++/libs/armeabi
-v7a/ 
-L/home/adamw/Archives/android-ndk-r7/platforms/android-5/arch-arm/usr/lib/ 
-L/home/adamw/Projects/dinja-engine/physics/target/local/armeabi-v7a/ -lbullet 
-lbullet -lbullet -lbullet -lbullet -lbullet -lbullet -lbullet -lbullet 
-lbullet -lbullet -lbullet -lbullet -lbullet -lbullet -lbullet -lbullet 
-lbullet -lbullet -lbullet -lbullet -lbullet -lbullet -lbullet -lbullet -llog 
-lstdc++ -lgcc -ldl -lz -lm -lc 

Please provide any additional information below.

This doesn't really have any negative effect as far as I'm aware at least. 
Also, removing the multiple annotations obviously gets rid of the problem. 
Still, i thought I should report it.

Original issue reported on code.google.com by adam.waldenberg@gmail.com on 27 Feb 2012 at 9:55

GoogleCodeExporter commented 8 years ago
Good catch. I updated Loader.appendProperty() to check for duplicates. Could 
you try with the attached Loader.java see if it works better? thanks!

BTW, did you have any problem getting Maven to call JavaCPP? Looking at your 
pom.xml file, it doesn't look much different from Ant, but I might be missing 
something.. thanks

Original comment by samuel.a...@gmail.com on 28 Feb 2012 at 6:18

Attachments:

GoogleCodeExporter commented 8 years ago
I will try the fix later today. Thanks.

It was quite easy to get it to work with Maven. Anyone that wants to use Maven 
just needs to use the maven dependency plugin to get access to JavaCPP (and to 
be able to actually call the JAR file). This is what enables 
<argument>${com.googlecode:javacpp:jar}</argument> to work.

We are actually hosting JavaCPP in our public maven repository at 
http://maven.ejwa.se/, to enable people to compile Dinja Engine.

If you want, I can help out with some documentation if you want to make it 
easier for other people to use JavaCPP together with Maven. You might also 
consider uploading JavaCPP to the central maven repo.

Here is a FAQ:

http://maven.apache.org/guides/mini/guide-central-repository-upload.html

Original comment by adam.waldenberg@gmail.com on 28 Feb 2012 at 7:48

GoogleCodeExporter commented 8 years ago
Thanks for the info! I am not currently using Maven, so it would be great to 
have you check if everything is working alright. I will check back some time 
later about uploading artifacts to the central repository, I might as well 
upload JavaCV as well I suppose (?), but you could start working on some 
documentation right away, that would be great. I suppose creating a page on the 
Wiki tab here would be most appropriate? I can give you permission for that.

If you have some recommendations for the content of the POM files, I'd like to 
hear them as well!

Original comment by samuel.a...@gmail.com on 29 Feb 2012 at 2:57

GoogleCodeExporter commented 8 years ago
The modified Loader.java above fixes the problem with duplicate -l entries.

About Maven... I can do better than give you some recommendations :). I'll open 
a
separate issue concerning Maven integration.

And yeah JavaCV... Why not upload that also :).

Original comment by adam.waldenberg@gmail.com on 29 Feb 2012 at 8:59

GoogleCodeExporter commented 8 years ago
Oh yeah... Concerning documentation on the wiki page, sure I can write 
something up.

Original comment by adam.waldenberg@gmail.com on 29 Feb 2012 at 9:20

GoogleCodeExporter commented 8 years ago
I have included these changes in the latest release. Thanks for the feedback 
(and the wiki)!

Original comment by samuel.a...@gmail.com on 3 Mar 2012 at 4:50