JavaCV-OpenCV MacOSX 10.7.4 x64 - opencv

I have tried everything possible to solve this error, I was able to run in Windows x86 but I can't compile anything in my MacOSX x64.
I have installed OpenCV using Xcode and port -v opencv +python27 option all the linkpaths are correct. One thing that i have found different is inside the code
public static final String genericIncludepath = "/opt/local/include/";
public static final String genericLinkpath = "/opt/local/lib/:/opt/local/lib64/:/usr/local/lib/:/usr/local/lib64/";
The genericLinkpath for MacOSX does not contains lib64.
What steps will reproduce the problem?
1. Try to run HoughLines or any sample
What is the expected output? What do you see instead?
Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/qr/j3rwh4h15fncfqgff8__qvcw0000gn/T/libjniopencv_core2612287037709553365.dylib: Library not loaded: lib/libopencv_core.2.4.dylib Referenced from: /private/var/folders/qr/j3rwh4h15fncfqgff8__qvcw0000gn/T/libjniopencv_core2612287037709553365.dylib Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1020)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:403)
at com.googlecode.javacpp.Loader.load(Loader.java:342)
at com.googlecode.javacpp.Loader.load(Loader.java:316)
at com.googlecode.javacv.cpp.opencv_core.(opencv_core.java:131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.googlecode.javacpp.Loader.load(Loader.java:335)
at com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:96)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.googlecode.javacpp.Loader.load(Loader.java:335)
at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui.java:91)
at com.javacv.HoughLines.main(HoughLines.java:32)
What version of the product are you using? On what operating system?
MacOS X 10.7.4
$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3646)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)
JAVACV -- javacv-bin-20120512
echo $PATH
/opt/local/include:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
$ ls | grep opencv
opencv_createsamples
opencv_haartraining
opencv_performance
opencv_traincascade
$ ls | grep opencv
libopencv_calib3d.2.4.0.dylib
libopencv_calib3d.2.4.dylib
libopencv_calib3d.dylib
libopencv_contrib.2.4.0.dylib
libopencv_contrib.2.4.dylib
libopencv_contrib.dylib
libopencv_core.2.4.0.dylib
libopencv_core.2.4.dylib
libopencv_core.dylib
libopencv_features2d.2.4.0.dylib
libopencv_features2d.2.4.dylib
libopencv_features2d.dylib
libopencv_flann.2.4.0.dylib
libopencv_flann.2.4.dylib
libopencv_flann.dylib
libopencv_gpu.2.4.0.dylib
libopencv_gpu.2.4.dylib
libopencv_gpu.dylib
libopencv_highgui.2.4.0.dylib
libopencv_highgui.2.4.dylib
libopencv_highgui.dylib
libopencv_imgproc.2.4.0.dylib
libopencv_imgproc.2.4.dylib
libopencv_imgproc.dylib
libopencv_legacy.2.4.0.dylib
libopencv_legacy.2.4.dylib
libopencv_legacy.dylib
libopencv_ml.2.4.0.dylib
libopencv_ml.2.4.dylib
libopencv_ml.dylib
libopencv_nonfree.2.4.0.dylib
libopencv_nonfree.2.4.dylib
libopencv_nonfree.dylib
libopencv_objdetect.2.4.0.dylib
libopencv_objdetect.2.4.dylib
libopencv_objdetect.dylib
libopencv_photo.2.4.0.dylib
libopencv_photo.2.4.dylib
libopencv_photo.dylib
libopencv_stitching.2.4.0.dylib
libopencv_stitching.2.4.dylib
libopencv_stitching.dylib
libopencv_ts.2.4.0.dylib
libopencv_ts.2.4.dylib
libopencv_ts.dylib
libopencv_video.2.4.0.dylib
libopencv_video.2.4.dylib
libopencv_video.dylib
libopencv_videostab.2.4.0.dylib
libopencv_videostab.2.4.dylib
libopencv_videostab.dylib
System.out.println(System.getProperty("os.arch")); x86_64
System.out.println(System.getProperty("sun.arch.data.model")); 64

Related

Compilation using native image is failing

I have no idea why am getting this error. someone may have at least a clue please.
\[1/7\] Initializing... (0.0s # 0.30GB)
Fatal error: java.lang.NullPointerException: Cannot invoke "String.hashCode()" because "\<local2\>" is null
at com.oracle.svm.core.option.OptionOrigin.from(OptionOrigin.java:81)
at com.oracle.svm.core.option.LocatableMultiOptionValue.lambda$getValuesWithOrigins$1(LocatableMultiOptionValue.java:87)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.processClassInitializationOptions(ClassInitializationFeature.java:82)
at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:812)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:554)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:514)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:413)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:591)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:129)
at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:621)
it fails where running gradle nativeCompile
MacBook Pro M1 chip.
openjdk version "17.0.3" 2022-04-19
OpenJDK Runtime Environment GraalVM CE 22.1.0-dev (build 17.0.3+4-jvmci-22.1-b03)
OpenJDK 64-Bit Server VM GraalVM CE 22.1.0-dev (build 17.0.3+4-jvmci-22.1-b03, mixed mode, sharing)
tried to change the GraalVM versions but no success.

Can't run NiFi on OSX

I installed NiFi on my OSX machine using
brew install nifi
This worked fine, but when I run the command
nifi run
I checked the nifi-app log and this is what pops out:
2017-10-27 00:24:26,211 WARN [main] org.apache.nifi.bootstrap.Command
Launched Apache NiFi but could not determined the Process ID
I tried nifi startas well but get the following as status:
2017-10-27 00:26:48,081 INFO [main] org.apache.nifi.bootstrap.Command
Apache NiFi is currently running, listening to Bootstrap on port
50289, PID=unknown
Not sure if I have to edit something, but I'm concerned by PID is unknown.
EDIT:
When running
2017-10-27 11:14:13,809 ERROR [main] org.apache.nifi.NiFi Failure to
launch NiFi due to java.util.ServiceConfigurationError:
org.apache.nifi.processor.Processor: Provider
org.apache.nifi.processors.standard.ParseCEF could not be instantiated
java.util.ServiceConfigurationError:
org.apache.nifi.processor.Processor: Provider
org.apache.nifi.processors.standard.ParseCEF could not be instantiated
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:581)
at java.base/java.util.ServiceLoader.access$100(ServiceLoader.java:390)
at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:799)
at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:721)
at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1389)
at org.apache.nifi.nar.ExtensionManager.loadExtensions(ExtensionManager.java:142)
at org.apache.nifi.nar.ExtensionManager.discoverExtensions(ExtensionManager.java:117)
at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:702)
at org.apache.nifi.NiFi.<init>(NiFi.java:160)
at org.apache.nifi.NiFi.main(NiFi.java:268)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at org.apache.bval.jsr.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:357)
at org.apache.bval.jsr.ConfigurationImpl.createBootstrapConfiguration(ConfigurationImpl.java:349)
at org.apache.bval.jsr.ConfigurationImpl.prepare(ConfigurationImpl.java:340)
at org.apache.bval.jsr.ConfigurationImpl.__privileged_doBuildValidatorFactory(ConfigurationImpl.java:329)
at org.apache.bval.jsr.ConfigurationImpl.doBuildValidatorFactory(ConfigurationImpl.java)
at org.apache.bval.jsr.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:324)
at org.apache.nifi.processors.standard.ParseCEF.<init>(ParseCEF.java:179)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:777)
... 7 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
... 19 common frames omitted
I was using JDK 9. Turns out as of today, this doesn't work. I downgraded to JDK 8 and voila! Thanks y'all
No need to download to JDK 8, but you do need it installed.
Picking which JDK to Run
I have an app (nifi) which does not work on JDK 9, so I want to switch the JDK Version.
List Possible Versions
This is the command
/usr/libexec/java_home -V
And the correctponing output
Matching Java Virtual Machines (2):
9.0.1, x86_64: "Java SE 9.0.1" /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
1.8.0_151, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
Set your Java-Home
For picking just a major Version you can do this
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
Run App (nifi)
I now just need to select this Java, export it. And run the startup script...
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
tim#T-Mac-mini bin $ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
tim#TMac-mini bin $ ./nifi.sh run
It now works.

VSTS - Problems with Xamarin Proguard Version and JDK 1.8

I have a Xamarin Forms Project that I'm trying to integrate with HockeyApps using Continuous Integration with VSTS.
My app compiles using Java 1.8 and it uses ProGuard to shrink the android apk file.
But when java try to compile the application, it finds that the Installed version of proguard is not compatible with Java 1.8
The error is the following:
... Can't process class [android/app/ActivityTracker.class] Unsupported class version number [52.0] maximum 51.0, Java 1.7...
In my local visual studio installation, I fixed it replacing the default proguard version that Xamarin Installs for the lastest one 5.x...
Anybody knows how to do it with VSTS?
DETAILED ERROR:
_CompileToDalvikWithDx:
C:\Program Files\Java\jdk1.8.0_102\\bin\java.exe -jar C:\java\androidsdk\android-sdk\tools\proguard\lib\proguard.jar -include C:\java\androidsdk\android-sdk\tools\proguard\proguard-android.txt -include obj\Release\proguard\proguard_xamarin.cfg -include obj\Release\proguard\proguard_project_references.cfg -include obj\Release\proguard\proguard_project_primary.cfg -include proguard.cfg "-injars 'obj\Release\proguard\__proguard_input__.jar';'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\mono.android.jar';'obj\Release\__library_projects__\FormsViewGroup\library_project_imports\formsviewgroup.jar';'obj\Release\__library_projects__\HockeySDK.AndroidBindings\library_project_imports\bin\classes.jar';'C:\Users\buildguest\AppData\Local\Xamarin\Xamarin.Android.Support.Animated.Vector.Drawable\23.3.0.0\embedded\classes.jar';'C:\Users\buildguest\AppData\Local\Xamarin\Xamarin.Android.Support.Design\23.3.0.0\embedded\classes.jar';'C:\Users\buildguest\AppData\Local\Xamarin\Xamarin.Android...
java.io.IOException: Can't read [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\mono.android.jar] (Can't process class [android/app/ActivityTracker.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))
at proguard.InputReader.readInput(InputReader.java:230)
at proguard.InputReader.readInput(InputReader.java:200)
at proguard.InputReader.readInput(InputReader.java:178)
at proguard.InputReader.execute(InputReader.java:78)
at proguard.ProGuard.readInput(ProGuard.java:196)
at proguard.ProGuard.execute(ProGuard.java:78)
at proguard.ProGuard.main(ProGuard.java:492)
Caused by: java.io.IOException: Can't process class [android/app/ActivityTracker.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7))
at proguard.io.ClassReader.read(ClassReader.java:112)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.JarReader.read(JarReader.java:65)
at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
at proguard.InputReader.readInput(InputReader.java:226)
... 6 more
Caused by: java.lang.UnsupportedOperationException: Unsupported class version number [52.0] (maximum 51.0, Java 1.7)
at proguard.classfile.util.ClassUtil.checkVersionNumbers(ClassUtil.java:140)
at proguard.classfile.io.ProgramClassReader.visitProgramClass(ProgramClassReader.java:88)
at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
at proguard.io.ClassReader.read(ClassReader.java:91)
... 11 more
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2025,3): Error MSB6006: "java.exe" exited with code 1.
I'm afraid that there isn't any workaround for your issue with Hosted Build Agent since the user has no permission to update the installed software on Hosted Machine.
You need to deploy your own build agent and then replace the files manually.
The reason is that it uses JDK 1.7 that is incompatible. You can specify JDK version of Xamarin build step:

Building OpenCV with CUDA support Error on transpose.cu

Recently I am trying to build OpenCV with CUDA support, and I met problem while building the module cudaarithm.
OpenCV source: git cloned from : http://github.com/Itseez/opencv.git
OpenCV branch: master branch
OpenCV commit:
`commit 5466e321b8c8f97536002a357e5b7ff49a5d2bf9, on Tue Feb 10 12:17:11 2015 +0000`
CUDA version: CUDA 6.5
Hardware: MacBook Pro (13-inch, Mid 2010)
GPU: NVIDIA GeForce 320M 256 MB
OS Version: OS X Yosemite
Steps I used:
1. cd in OpenCVSource, then mkdir myrelease, and cd myrelease
2. cmake -DPLANTUML_JAR=/usr/local/Cellar/plantuml/8002 -D BUILD_DOCS=1 -DPYTHON2_LIBRARY=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib -DPYTHON2_INCLUDE_DIR=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DPYTHON3_LIBRARY=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4m.dylib -DPYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/include/python3.4m -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -Wno-dev -DNVCC_FLAGS_EXTRA="-Xcompiler -stdlib=libstdc++; -Xlinker -stdlib=libstdc++" -DOPENCV_EXTRA_CXX_FLAGS=" -stdlib=libstdc++" -DOPENCV_EXTRA_EXE_LINKER_FLAGS="-stdlib=libstdc++" ..
3. make VERBOSE=1
Expect Result: Building success without error
Actual Result: when building OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu, error happend like below:
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(61): *error: identifier "getInputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(67): *error: identifier "getOutputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(92): *error: identifier "syncOutput" is undefined*
Then what action I take:
check the code and I found these undefined symboles are defined in OpenCVSource/modules/core/include/opencv2/core/private.cuda.hpp
check the code and I confrim that the "transpose.cu" file include "opencv2/core/private.cuda.hpp"
check the building log, and I the confirm the private.cuda.hpp is in the search path of header file
cp "opencv2/core/private.cuda.hpp" as another file "opencv2/core/hawk.hpp", and then edit "transpose.cu" to include this new file, and I found
the "undifined symbole error" disapeared.
Although this is a workable workaround, I would like know whether the original OpenCV source cannot be compiled.
All, I think I found the problem cause.
Before I met such problem, I've already build and install OpenCV using older code from the git repo. So that there already have header files in my /usr/local/include/opencv2, especially there is /usr/local/include/opencv2/core/private.cuda.hpp.
However, it is an older one that doesn't define the symbols reporting undefined in above question. At the same time I found during the building nvcc have -I/usr/local/include in the command line, so that it use wrong private.cuda.hpp. As you know it should use the one in OpenCVSource, not the older installed one.
I think the solution is to gracefully remove the original installed OpenCV from my computer, then build again. I am trying and I will report later.

Configure OpenCV2.3.0 on CentOS and run jar file

I am getting the exception while running a jar file from CentOS 5.7 x86_64 command prompt. Where as it is working on CentOS 6.2 x86_64. The jar file is loading an xml file of openCV and it is producing the error like I have copied here.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/libjniopencv_core3672406464017531068.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/lampp/htdocs/k_project_1/innefu/OpenCV-2.3.0/build/lib/libopencv_core.so.2.3)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1750)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1646)
at java.lang.Runtime.load0(Runtime.java:787)
at java.lang.System.load(System.java:1022)
at com.googlecode.javacpp.Loader.load(Loader.java:352)
at com.googlecode.javacpp.Loader.load(Loader.java:285)
at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:129)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at com.googlecode.javacpp.Loader.load(Loader.java:305)
at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:96)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at com.googlecode.javacpp.Loader.load(Loader.java:305)
at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:91)
at com.innefu.faceDetect.ImgFaceDetectNew.main(ImgFaceDetectNew.java:68)
While I have configured Opencv-2.0.0 on CentOS 5.7 machine but it is producing the same error. I have also export the path of lib and bin folder of OpenCV.
OpenCv 2.3.0 is producing error while trying to configure. So, I have copied the configured OpenCV-2.3.0 from CentOS 6.2 to the CentOS 5.7. But in both the situation error is same. Please provide suggestions.
Thanks

Resources