EngnzWaks / javacv

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

Provide complete build instructions for javacv and its dependencies #220

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Right now, there is no simple step by step build instructions geared toward 
java developers to build javacv from source.

The instruction should include details how to set up and compile all 
dependencies, and how to build javacv native libraries for different platforms.

The info that is present right now project home page is geared more towards 
people that are already familiar with used libraries than toward java 
developers that never used them before.

Original issue reported on code.google.com by marko.ko...@gmail.com on 19 Jul 2012 at 8:31

GoogleCodeExporter commented 8 years ago
I've just committed a new `pom.xml` that builds without any other dependencies 
than OpenCV, which should simply the build process. Let me know if this 
satisfies you, and if you still feel that nightly snapshots or more detailed 
build instructions are still required, thank you

Original comment by samuel.a...@gmail.com on 20 Jul 2012 at 4:33

GoogleCodeExporter commented 8 years ago
Hi Samuel,

Thanks for all of your efforts on this.  I am running into dead ends trying to 
compile as well.  At first I didn't know (and still don't) where to place 
javacpp.jar so that Maven would find it.

Then I noticed you changed things up so that we could skip the javacpp 
dependency:
mvn package -Pall -Djavacpp.skip=true

Unfortunately, that doesn't seem to do the trick either.  I run into:

[INFO] Building JavaCV 0.2
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.3:properties (properties) @ javacv ---
[INFO] 
[INFO] --- maven-dependency-plugin:2.3:copy-dependencies (copy-dependencies) @ 
javacv ---
[INFO] javacpp-0.2.jar already exists in destination.
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ javacv 
---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3:compile (default-compile) @ javacv ---
[INFO] Compiling 77 source files to 
/Users/vanevery/Desktop/javacv/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] 
/Users/vanevery/Desktop/javacv/src/main/java/com/googlecode/javacv/cpp/opencv_co
re.java:[87,40] cannot find symbol
symbol  : class StdVector
location: package com.googlecode.javacpp.annotation

and so on..

Any thoughts?

Original comment by savanev...@gmail.com on 13 Aug 2012 at 8:17

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
That's just the Maven versioning system doing its thing... I'm not sure how to 
effectively use it yes, so just make sure you install JavaCPP from source as 
well. 

Original comment by samuel.a...@gmail.com on 14 Aug 2012 at 2:08

GoogleCodeExporter commented 8 years ago
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building JavaCV 0.2
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.3:properties (properties) @ javacv ---
[INFO] 
[INFO] --- maven-dependency-plugin:2.3:copy-dependencies (copy-dependencies) @ 
javacv ---
[INFO] javacpp-0.2.jar already exists in destination.
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ javacv 
---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3:compile (default-compile) @ javacv ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- exec-maven-plugin:1.2:exec (javacpp) @ javacv ---
Generating source file: 
/www/javacv/target/classes/com/googlecode/javacv/cpp/jnicvkernels.cpp
Building library file: 
/www/javacv/target/classes/com/googlecode/javacv/cpp/macosx-x86_64/libjnicvkerne
ls.dylib
g++ -I/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/include 
-I/opt/local/include/ 
/www/javacv/target/classes/com/googlecode/javacv/cpp/jnicvkernels.cpp -msse3 
-ffast-math -Wl,-rpath,@loader_path/. -march=x86-64 -m64 -Wall -O3 -fPIC 
-dynamiclib -o 
/www/javacv/target/classes/com/googlecode/javacv/cpp/macosx-x86_64/libjnicvkerne
ls.dylib 
In file included from 
/www/javacv/target/classes/com/googlecode/javacv/cpp/jnicvkernels.cpp:44:
/www/javacv/target/classes/com/googlecode/javacv/cpp/cvkernels.h:22:33: error: 
opencv2/core/core_c.h: No such file or directory
In file included from 
/www/javacv/target/classes/com/googlecode/javacv/cpp/jnicvkernels.cpp:44:

Original comment by flo...@mandache.com on 14 Aug 2012 at 10:54

GoogleCodeExporter commented 8 years ago
@florin As mentioned in the README.txt file, the requirements include OpenCV 
2.4.2. On Mac OS X, we can install that easily with MacPorts, for example.

Original comment by samuel.a...@gmail.com on 15 Aug 2012 at 11:27

GoogleCodeExporter commented 8 years ago
Hi Samuel, I am unfortunately still running into the same set of errors, about 
100 instances of various classes not being able to find StdVector:

[ERROR] 
/Users/vanevery/Desktop/javacv/src/main/java/com/googlecode/javacv/cpp/opencv_st
itching.java:[970,62] cannot find symbol
[ERROR] symbol  : class StdVector
[ERROR] location: class com.googlecode.javacv.cpp.opencv_stitching

They all involve not being able to find StdVector.

JavaCPP compiles fine and through the new pom.xml if I don't have the jar file 
in place it downloads correctly so I know that it is there. 

Just can get around not being able to find StdVector.

Original comment by savanev...@gmail.com on 21 Aug 2012 at 2:23

GoogleCodeExporter commented 8 years ago
I'm having the same issue as savanev right now, I'm quite new to this, this is 
my first experience with Maven so I apologize if I'm missing something obvious.

I've run mvn install no javacpp, put javacpp.jar in my classpath.. and also put 
the jar directly in the JavaCV directory.  

Thanks for your time.

Original comment by Version1...@gmail.com on 21 Aug 2012 at 3:04

GoogleCodeExporter commented 8 years ago
Hi Version135b and Samuel,

I am new to Maven as well, trying to wade my way through.

I see that the version of JavaCPP that gets downloaded automatically is 
actually missing the StdVector class.  It is placing it in ~/.m2/...  

The version that I compile from source has it so I am attempting to try to 
figure out how to compile JavaCV with my version of JavaCPP rather than the 
automatically downloaded version.

Original comment by savanev...@gmail.com on 21 Aug 2012 at 3:13

GoogleCodeExporter commented 8 years ago
interesting.. I cannot find StdVector in my source for JavaCPP or the jar.  Are 
you certain it is supposed to be there?

Original comment by Version1...@gmail.com on 21 Aug 2012 at 3:21

GoogleCodeExporter commented 8 years ago
I definitely have it in the version I checked out.  It seems to be in the repo:

http://code.google.com/p/javacpp/source/browse/src/main/java/com/googlecode/java
cpp/annotation/StdVector.java

Unfortunately, not certain of anything..

Original comment by savanev...@gmail.com on 21 Aug 2012 at 3:27

GoogleCodeExporter commented 8 years ago
interesting.. when i search from top level that doesn't come up.  I notice that 
I'm missing StdString too.. I'm going to try and get the jar built with these 
files and see if i can catch up to you :)

Original comment by Version1...@gmail.com on 21 Aug 2012 at 3:29

GoogleCodeExporter commented 8 years ago
Ok, under tag 0.1 and 0.2 those files are missing, tag <none> contains them.  

Original comment by Version1...@gmail.com on 21 Aug 2012 at 3:34

GoogleCodeExporter commented 8 years ago
Ok, i got it to work by pulling the master with git (i dunno if that made sense 
i have little experience with git as well.. ) i then did mvn install for 
javacpp.. after that i did mvn install in javacv (without clean!) i think clean 
will replace the installed jar for javacpp.. not sure though.

Original comment by Version1...@gmail.com on 21 Aug 2012 at 3:55

GoogleCodeExporter commented 8 years ago
Fantastic!  That did the trick for me as well.

Thanks

Original comment by savanev...@gmail.com on 21 Aug 2012 at 4:13

GoogleCodeExporter commented 8 years ago
Are you able to run mvn install on javaCV?  I'm getting a crazy error 

-1073741515(Exit value: -1073741515) -> [Help 1]

to which there seems to be no reference.  

Original comment by Version1...@gmail.com on 21 Aug 2012 at 4:15

GoogleCodeExporter commented 8 years ago
Yes, it is building and installing as it should.  I am running on MacOS X 10.8 
with OpenCV installed via Homebrew.

My goal is to build this for Android though so I am not sure I am done.

Original comment by savanev...@gmail.com on 21 Aug 2012 at 4:20

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
For Android, you need to set some options for JavaCPP as explained here:
    http://code.google.com/p/javacpp/#Instructions_for_Android
In the case of JavaCV, I've included in the pom.xml file a property named 
javacpp.options, whose purpose should be pretty obvious, so we can build it 
this way:
    mvn package -Djavacpp.options="-properties android-arm -Dplatform.root=<path to android-ndk-r8> -Dcompiler.path=<path to arm-linux-androideabi-g++>"

Original comment by samuel.a...@gmail.com on 22 Aug 2012 at 12:24

GoogleCodeExporter commented 8 years ago
I'm now getting errors about finding the openCV library.. i've added 
C:\opencv\build\include 
to the PATH and classpath.. was there some other var that needs configuring as 
well?

The error is looking for opencv2/core/core_c.h which lies inside 
C:\opencv\build\include

Thanks so much for your help so far.. Much appreciated.

Original comment by Version1...@gmail.com on 22 Aug 2012 at 3:33

GoogleCodeExporter commented 8 years ago
Which var is used by maven to look for these files?? I'm not finding stdlib or 
jni headers either.. 

I'm sure its just a matter of plugging in the correct directories for these 
files now.

Original comment by Version1...@gmail.com on 22 Aug 2012 at 4:24

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I've gotten rid of the stdlib and jni errors, what VAR should contain the 
include path for opencv?  I'm still getting opencv2/core/core_c.h no such file 
or directory issues.
LIB OPENCV and INCLUDE setup, classpath and path are both pointing  to opencv's 
build/include directory too.  Thanks for your time.

Original comment by Version1...@gmail.com on 23 Aug 2012 at 1:52

GoogleCodeExporter commented 8 years ago
Just "2. Extract OpenCV-2.4.2.exe inside the root directory C:\" as mentioned 
here:
http://code.google.com/p/javacv/wiki/Windows7AndOpenCV

Original comment by samuel.a...@gmail.com on 23 Aug 2012 at 1:58

GoogleCodeExporter commented 8 years ago
If that is all that is required, perhaps linking with openCV is not the issue.. 
Thanks for continuing to help, perhaps this will help...

Original comment by Version1...@gmail.com on 23 Aug 2012 at 3:20

Attachments:

GoogleCodeExporter commented 8 years ago
If you're trying to compile for Android, you need the OpenCV from here, as 
stated in the README.txt file: 
http://code.google.com/p/javacv/downloads/list

Original comment by samuel.a...@gmail.com on 24 Aug 2012 at 1:06

GoogleCodeExporter commented 8 years ago
Hi all, I'm assigning this to Stuart, who showed interested in creating a wiki 
page detailing the build procedure, thanks!

Original comment by samuel.a...@gmail.com on 12 Oct 2012 at 9:59

GoogleCodeExporter commented 8 years ago
Issue 260 has been merged into this issue.

Original comment by samuel.a...@gmail.com on 6 Dec 2012 at 1:41

GoogleCodeExporter commented 8 years ago
UPDATE: JavaCV 0.4 now comes with a "CPPJARs" package that contains build 
instructions for OpenCV and FFmpeg on a few platforms:
http://code.google.com/p/javacv/downloads/detail?name=javacv-0.4-cppjars.zip

Original comment by samuel.a...@gmail.com on 3 Mar 2013 at 2:13

GoogleCodeExporter commented 8 years ago
I am having some serious problems with building JavaCV on Ubuntu for android, 
with most of the problem right now coming from OpenCV. For some reason the 
cmake isn't installing the libs or the headers. Moreover, I can't even seem to 
find the headers themselves. I was able to get the 'include' folder from a 
windows build i managed to create, but now receiving an error regarding an 
undefined reference to some TBB methods. 

If anyone has the openCV static libraries and headers, and could share it it 
would be beautiful. I want to make sure i have built OpenCV properly.

Thanks,
K

Original comment by klomm...@gmail.com on 21 May 2013 at 1:23

GoogleCodeExporter commented 8 years ago
@klommenz OpenCV requires a little patch that's part of the cppjars archive. 
Make sure to apply that patch and also execute the build process in a way 
similar to what is in the build_opencv-android-arm.sh script file.

Original comment by samuel.a...@gmail.com on 21 May 2013 at 1:27

GoogleCodeExporter commented 8 years ago
I have used the build_opencv-android-arm.sh script file for my build. I am 
going to remove everything from my file system, and start a clean copy now that 
i know where the pitfalls are.

I will update in case the problems are persisting.

Thanks

Original comment by klomm...@gmail.com on 21 May 2013 at 1:29

GoogleCodeExporter commented 8 years ago
Ok, i made an entirely fresh copy of the JavaCV project, along with all its 
libraries, and used the build script files you have provided, as is.

OS : CentOS
NDK: r8e 64bit
FFMpeg: 1.2
OpenCV: 2.4.5
X264: Latest version
JDK: 1.7
Maven: 3

Right now I am missing the header file core_c.h (and all the other opencv 
headers with it). It's quite evident that the script is not installing the 
headers anywhere in the file system, and also the libs are kept under opencv's 
libs subfolder. when i enter make/cmake install, it reports that it has no 
install instructions. I have already came across this problem in my previous 
attempts. Does anyone have any advice on how to get cmake to produce the 
correct headers, or could just provide me with the correct headers for android, 
so i can continue and eliminate other problems?

I am attaching build logs for opencv and ffmpeg.

Thanks

Original comment by klomm...@gmail.com on 21 May 2013 at 5:43

Attachments:

GoogleCodeExporter commented 8 years ago
Well, redeployed everything. Changed the building paths, and verified 
read/write permissions, and all of a sudden make install works. build succeeds

*little shake tail*
*little dance*

thanks for all that have helped

*little dance*

Original comment by klomm...@gmail.com on 22 May 2013 at 7:49

GoogleCodeExporter commented 8 years ago
@klommenz Ok, good to hear that :) I was going to say to change 
"-DCMAKE_INSTALL_PREFIX=$HOME/android" to wherever you want the files to get 
copies...

Original comment by samuel.a...@gmail.com on 22 May 2013 at 1:03

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
@ kIommenz I really wished that you could make a more detailed step by step 
guide. It is such a time waster for someone has already figured it out step by 
step.

@samuel

I'm trying to use ffmpegframegrabber but wanted to set option rtp_transport = 
tcp.
av_dict_set(&optionDictionary, "rtsp_transport", "tcp", 0); so I want to modify 
your source and compile. (unless there is a way to set it without recompiling 
javacv?)

Even though I got FFmpeg working on iOS and BlackBerry, but they are native. I 
know when it comes to building JavaCV for Android, I would run into a lot of 
trouble. I haven't used Maven before and I know less about JNI wrapper.

Ok here it goes:

When you say OpenCV is the dependency for building JavaCV. I hear your words 
but cannot think of the way to go forward.

I used specifically macport to install opencv (as you stated in Aug 15, 2012), 
which I assume that I have that dependency fulfilled. But after running mvn 
package -Djavacpp.options="-properties android-arm -Dplatform.root=<path to 
android-ndk-r8> -Dcompiler.path=<path to arm-linux-androideabi-g++>" it still 
asks for core.hpp.

Then i read your words on
"If you're trying to compile for Android, you need the OpenCV from here, as 
stated in the README.txt file: 
http://code.google.com/p/javacv/downloads/list"

Again I head the words, but don't know how the opencv-2.4.6.1-android-arm.jar 
is gonna help for compiling javacv. Should I extract the .so and put it 
somewhere else? or should I put the jar file somewhere?

Or you point us to that link so that we can build our own opencv.jar using the 
.sh script as example to follow?

Could you please enlighten me, I'm pulling my hair out...

Original comment by juiy...@gmail.com on 31 Oct 2013 at 10:07

GoogleCodeExporter commented 8 years ago
Yes, I don't think there is any generic way to set options through 
FFmpegFrameGrabber and av_dict_set() at the moment, but if you have a patch to 
enhance that, though, please send it! thanks

About building JavaCV, the best way is to simply recompile everything from 
scratch, first OpenCV and FFmpeg themselves, through the scripts. We still need 
to run "make install" after the scripts run, and the install directories might 
not quite end up where JavaCV expects them, but it should be pretty 
straightforward to figure that out from the errors you get with "mvn package", 
and yes that's pretty much it.

So, start with building OpenCV and see that goes...

Original comment by samuel.a...@gmail.com on 3 Nov 2013 at 2:11

GoogleCodeExporter commented 8 years ago
@sam

Thanks for your kind words. In the end, I just subclassed FramGrabber class 
without compiling and I should be able to send a patch on FFmpegFrameGrabber 
through to specify the tcp. I will do that after my project here let me have a 
breather.

I lost some of my hair. I should read up on mvn...

Original comment by juiy...@gmail.com on 4 Nov 2013 at 7:50

GoogleCodeExporter commented 8 years ago
Sure, anytime, juiyout, take it easy!

Original comment by samuel.a...@gmail.com on 4 Nov 2013 at 10:55

GoogleCodeExporter commented 8 years ago
Hi samuel, i'm trying to build javacv but it's fails, here is the output:

BUILD FAILURE
------------------------------------------------------------------------
Total time: 19.838s
Finished at: Wed Nov 20 18:13:34 ART 2013
Final Memory: 15M/187M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (javacpp) 
on project javacv: Command execution failed. Process exited with an error: 
1(Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the 
following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Original comment by ef.moy...@gmail.com on 20 Nov 2013 at 9:18

GoogleCodeExporter commented 8 years ago
@ef.moyano Please install JavaCPP before trying to build JavaCV...

Original comment by samuel.a...@gmail.com on 24 Nov 2013 at 12:58

GoogleCodeExporter commented 8 years ago
This is going to get better with JavaCPP Presets:
    http://code.google.com/p/javacpp/wiki/Presets
If anyone wants to help out with this effort, please let us know, thanks!

Original comment by samuel.a...@gmail.com on 4 Jan 2014 at 2:32

GoogleCodeExporter commented 8 years ago
Starting with JavaCV 0.8, we can fully build *everything* from absolute scratch 
with Bash and Maven. More info about all that in this news release here:
    http://bytedeco.org/release/2014/04/28/first-release.html
As well as on the new project site at GitHub:
    https://github.com/bytedeco

But the instructions are mostly part of the scripts :) If there is anything 
that isn't clear from the README files and the scripts though, please let me 
know, and we'll fix it, thanks!

Original comment by samuel.a...@gmail.com on 29 Apr 2014 at 12:41