I am trying to install OpenCV Java for Mac with homebrew, but CMake is giving me error during the process. The steps I have taken are as follows:
Installing CMake
Installing ant with: brew install ant
Changing the variable -DBUILD_opencv_java=OFF to ON
Installing OpenCV using: brew install --build-from-source opencv
Here is what gets printed to my terminal (error below):
==> Downloading https://github.com/opencv/opencv/archive/4.2.0.tar.gz
Already downloaded: /Users/gtalmor/Library/Caches/Homebrew/downloads/2606bd5bbd9d3231837dd3bc1f76c1a935cb4ce0eae9c2a472fd15c77dfbb510--opencv-4.2.0.tar.gz
==> Downloading https://github.com/opencv/opencv_contrib/archive/4.2.0.tar.gz
Already downloaded: /Users/gtalmor/Library/Caches/Homebrew/downloads/47ad25f9dd163b753420e122bad3928281696bdb5cd1c925fc90cf82e91ccda5--opencv_contrib-4.2.0.tar.gz
==> cmake .. -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG
==> make
Last 15 lines from /Users/gtalmor/Library/Logs/Homebrew/opencv/02.make:
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../lib/liblibprotobuf.a(gzip_stream.cc.o) has no symbols
/usr/bin/ranlib ../lib/liblibprotobuf.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../lib/liblibprotobuf.a(arenastring.cc.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../lib/liblibprotobuf.a(io_win32.cc.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../lib/liblibprotobuf.a(gzip_stream.cc.o) has no symbols
[ 26%] Built target libprotobuf
[ 26%] Linking CXX static library ../../../../../../lib/libmultiview.a
cd /tmp/opencv-20200203-6856-92bpyc/opencv-4.2.0/build/modules/sfm/src/libmv/libmv/multiview && /usr/local/Cellar/cmake/3.16.3/bin/cmake -P CMakeFiles/multiview.dir/cmake_clean_target.cmake
cd /tmp/opencv-20200203-6856-92bpyc/opencv-4.2.0/build/modules/sfm/src/libmv/libmv/multiview && /usr/local/Cellar/cmake/3.16.3/bin/cmake -E cmake_link_script CMakeFiles/multiview.dir/link.txt --verbose=1
/usr/bin/ar qc ../../../../../../lib/libmultiview.a CMakeFiles/multiview.dir/conditioning.cc.o CMakeFiles/multiview.dir/euclidean_resection.cc.o CMakeFiles/multiview.dir/fundamental.cc.o CMakeFiles/multiview.dir/fundamental_kernel.cc.o CMakeFiles/multiview.dir/homography.cc.o CMakeFiles/multiview.dir/panography.cc.o CMakeFiles/multiview.dir/panography_kernel.cc.o CMakeFiles/multiview.dir/projection.cc.o CMakeFiles/multiview.dir/robust_estimation.cc.o CMakeFiles/multiview.dir/robust_fundamental.cc.o CMakeFiles/multiview.dir/robust_resection.cc.o CMakeFiles/multiview.dir/triangulation.cc.o CMakeFiles/multiview.dir/twoviewtriangulation.cc.o
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../../../../../../lib/libmultiview.a(robust_estimation.cc.o) has no symbols
/usr/bin/ranlib ../../../../../../lib/libmultiview.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../../../../../../lib/libmultiview.a(robust_estimation.cc.o) has no symbols
[ 26%] Built target multiview
make: *** [all] Error 2
READ THIS: https://docs.brew.sh/Troubleshooting
Any idea what went wrong? I have seen posts of people with same issue and exact same error in different forums, but no one seem to have resolved it..
Related
I am trying to generate java files from asn1 file using the below in my android project and facing error in generating the files in Mac OS and in window it worked fine.
org.openmuc:jasn1:1.9.0
org.openmuc:jasn1-compiler:1.9.0
Below is the bash file
#!/bin/bash
JARS_LOCATION="../build/libs-all"
MAIN_CLASS="org.openmuc.jasn1.compiler.Compiler"
SYSPROPS=""
PARAMS=""
SCRIPT_HOME=`dirname $0`
CLASSPATH=$(JARS=("$SCRIPT_HOME"/"$JARS_LOCATION"/*.jar); IFS=:; echo "${JARS[*]}")
for i in $#; do
if [[ $i == -D* ]]; then
SYSPROPS="$SYSPROPS $i";
else
PARAMS="$PARAMS $i";
fi
done
java $SYSPROPS -cp $CLASSPATH $MAIN_CLASS $PARAMS
and the above bash file will be called from my projects build.gradle file.
Below is the final command will be executed from the bash. Shortened the file paths for easy understanding.
java -cp "/libs/antlr-2.7.7.jar:/libs/jasn1-1.9.0.jar:/libs/jasn1-compiler-1.9.0.jar" org.openmuc.jasn1.compiler.Compiler -p com.test.package.asn1 -f /asn1def/asn1/RSPDefinition.asn /asn1def/asn1/PKIX1Explicit88.asn /asn1def/asn1/PKIX1Implicit88.asn -o /asn1def/build/generated/source/java
Below is the error I am getting
Generated code will be saved in /asn1def/build/generated/source/java
Parsing "/asn1def/asn1/RSPDefinition.asn"
Parsing "/asn1def/asn1/PKIX1Explicit88.asn"
Parsing "/asn1def/asn1/PKIX1Implicit88.asn"
Generating classes for module "PKIX1Implicit88"
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
at org.openmuc.jasn1.compiler.HexConverter.toShortHexString(HexConverter.java:63)
at org.openmuc.jasn1.compiler.HexConverter.toShortHexString(HexConverter.java:59)
at org.openmuc.jasn1.compiler.HexConverter.appendShortHexString(HexConverter.java:99)
at org.openmuc.jasn1.compiler.HexConverter.appendHexString(HexConverter.java:108)
at org.openmuc.jasn1.compiler.HexConverter.toHexString(HexConverter.java:9)
at org.openmuc.jasn1.compiler.BerClassWriter.writeEncodeTag(BerClassWriter.java:2169)
at org.openmuc.jasn1.compiler.BerClassWriter.writeSequenceOrSetEncodeFunction(BerClassWriter.java:1107)
at org.openmuc.jasn1.compiler.BerClassWriter.writeSequenceOrSetClass(BerClassWriter.java:731)
at org.openmuc.jasn1.compiler.BerClassWriter.writeConstructedTypeClass(BerClassWriter.java:493)
at org.openmuc.jasn1.compiler.BerClassWriter.translateModule(BerClassWriter.java:194)
at org.openmuc.jasn1.compiler.BerClassWriter.translate(BerClassWriter.java:133)
at org.openmuc.jasn1.compiler.Compiler.main(Compiler.java:89)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 12 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':asn1def:compileAsn'.
> Process 'command '/asn1def/run-scripts/jasn1-compiler'' finished with non-zero exit value 1
I have the main class in the jasn1-compiler-1.9.0.jar file in the libs folder. The same generate files in windows but in Mac it is not working. The difference in windows & Mac is Java version. Mac has Java 11 & windows has Java 1.8. I also tried adding the JDK 1.8 location as below at the end of above code.
-Dorg.gradle.java.home=/Users/Shared/Jenkins/.jenkins/tools/hudson.model.JDK/JDK_1_8
Can anyone help me to point out what's missing?
Finally I found the answer. The error was happened because of the Java version in Mac, it has Java 11 and it didn't support javax xml bind. So I installed the JDK 1.8 in the mac machine and use that path in the bash file as below before the java execution line in bash file.
export JAVA_HOME=/usr/java/jdk1.8.161/
It may useful for someone.
I'm trying to compile dlib for Android. My SO is Ubuntu 20.04. I followed this tutorial from https://github.com/tzutalin/dlib-android
I downloaded Android-NDK version r14b and unzipped it at /opt. When I run python3 build.py command, I get this error:
/bin/sh: 1: /opt/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++: not found
/bin/sh: 1: /opt/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++: not found
make: *** [/opt/android-ndk-r14b/build/core/build-binary.mk:530: obj/local/armeabi-v7a/objs/android_dlib/jni_imageutils.o] Error 127
make: *** Waiting for unfinished jobs....
/bin/sh: 1: /opt/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++: not found
make: *** [/opt/android-ndk-r14b/build/core/build-binary.mk:530: obj/local/armeabi-v7a/objs/android_dlib/jni_pedestrian_det.o] Error 127
make: *** [/opt/android-ndk-r14b/build/core/build-binary.mk:530: obj/local/armeabi-v7a/objs/android_dlib/jni_face_det.o] Error 127
Build Error
Inspecting /opt/android-ndk-r14b, there is no linux-x86_64 under prebuild folder. The only directory there is darwin-x86_64.
I also tried with android-ndk-r21d, but I got another error:
/opt/android-ndk-r21d/build/core/add-application.mk:178: *** Android NDK: APP_STL gnustl_static is no longer supported. Please switch to either c++_static or c++_shared. See https://developer.android.com/ndk/guides/cpp-support.html for more information. . Stop.
Build Error
Can you help me?
You can look into this, https://github.com/Luca96/dlib-for-android/blob/master/setup.sh. I did not try on linux but if there are problems the link below could give some hints.
I used the powershell script with some modifications from the repo above and used dlib master from github to compile on windows. It copies files to given Android Studio folder when done. Latest modified script here, https://github.com/quickgrid/Setup-Guide/blob/master/dlib-android-setup.ps1.
I download the source code of OpenJDK14 and put them in \home\yuanfang\jdk14 and after running bash configure --disable-warnings-as-errors and make images, I build OpenJDK14 successfully, The newly built JDK is in home\yuanfang\jdk14\build\linux-x86_64-server-release\jdk. By the way, I am using Ubuntu 20.04 LTS.
Then I want to debug OpenJDK14 using CLion IDE. I was using CLion 2020.2 and I take the following steps:
After open CLion I choose Create New CMake Project from Sources and choose the directory of \home\yuanfang\jdk14, which is the root directory of the jdk project.
I alter the Run/Debug Configurations to make it look like this:
CLion create a CMakeLists.txt automatically but the file doesn't work, so after googling I find find the correct CMakeLists.txt here at https://github.com/ojdkbuild/ojdkbuild/blob/master/src/java-14-openjdk/CMakeLists.txt. I then rewrite the old CMakeLists.txt using the correct one.
I download the whole repository(that is, github.com/ojdkbuild/ojdkbuild), unzip it and put it into \home\yuanfang\jdk14.
It looks like as follow, the ojdkbuild-master is the newly added folder.
I reload the CMake project, but some CMake error occurs(as follow), why can't CLion find those files? javaI googled but can't find any effective solution. Is there anything I can do or refer to? Thanks in advance.
CMake Error at CMakeLists.txt:19 (include):
include could not find load file:
/home/yuanfang/jdk14/../../resources/cmake/ojdkbuild_common.cmake
CMake Error at CMakeLists.txt:21 (include):
include could not find load file:
/home/yuanfang/jdk14/../../resources/cmake/version.cmake
CMake Error at CMakeLists.txt:93 (add_subdirectory):
add_subdirectory given source
"/home/yuanfang/jdk14/../../deps/rhino/scripting_tasks" which is not an
existing directory.
CMake Error at CMakeLists.txt:98 (ojdkbuild_add_subdirectory):
Unknown CMake command "ojdkbuild_add_subdirectory".
-- Configuring incomplete, errors occurred!
See also "/home/yuanfang/jdk14/cmake-build-debug/CMakeFiles/CMakeOutput.log".
Cannot get compiler information:
Compiler exited with error code 1: /usr/bin/cc -xobjective-c -I/home/yuanfang/jdk14/build/linux-x86_64-server-release/hotspot/variant-server/gensrc/adfiles......./loading/LibraryLoader/jar_src -g -fpch-preprocess -v -dD -E
Using built-in specs.
COLLECT_GCC=/usr/bin/cc
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
COLLECT_GCC_OPTIONS='-I' '/home/yuanfang/jdk14/build/linux-x86_64-server-release/hotspot/variant-server/gensrc/adfiles' '-I' '......'-g' '-fpch-preprocess' '-v' '-dD' '-E' '-D' '___CIDR_DEFINITIONS_END' '-mtune=generic' '-march=x86-64'
cc1obj -E -quiet -v #/tmp/cci3XM6r -imultiarch x86_64-linux-gnu -D ___CIDR_DEFINITIONS_END /tmp/compiler-file5929385022787926768 -mtune=generic -march=x86-64 -fpch-preprocess -g -fworking-directory -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -dD
cc: fatal error: cannot execute 'cc1obj': execvp: No such file or directory
compilation terminated.
[Failed to reload]
step: check out this projecdt :https://github.com/ojdkbuild/ojdkbuild.git
step: put the source code of OpenJDK14 in ojdkbuild/src/
step: copy reousrces directory and CMakelists.txt to OpenJDK14
step: recomile openjdk and import project to CLin
I have been trying to install rJava using the following commands:
install.packages('rJava',,'http://www.rforge.net/')
or
install.packages('rJava', type = 'source', INSTALL_opts='--merge-multiarch')
but each time I fail due to this error:
WARNING: JRI could NOT be built Set IGNORE=1 if you want to build
rJava anyway. ERROR: configuration failed for package 'rJava'. I have uninstalled and re-installed both version of java on my machine but still no help!
Does anyone has a solution ?
the full description is as below:
install for i386
installing source package 'rJava' ...
** package 'rJava' successfully unpacked and MD5 sums checked Generate Windows-specific files (src/jvm-w32) ... make: Entering directory
'/Users/ahkay/AppData/Local/Temp/RtmpKalUob/R.INSTALL192609e43b16/rJava/src/jvm-w32'
C:/Rtools/mingw_32/bin/dlltool --as C:/Rtools/mingw_32/bin/as
--input-def jvm.def --kill-at --dllname jvm.dll --output-lib libjvm.dll.a C:/Rtools/mingw_32/bin/gcc -O2 -c -o findjava.o
findjava.c C:/Rtools/mingw_32/bin/gcc -s -o findjava.exe findjava.o
make: Leaving directory
'/Users/ahkay/AppData/Local/Temp/RtmpKalUob/R.INSTALL192609e43b16/rJava/src/jvm-w32'
Find Java... ./configure.win: line 15: [: too many arguments
JAVA_HOME=C:/Program Files/Java/jre1.8.0_202
=== Building JRI === configure.win: line 21: [: too many arguments JAVA_HOME=C:/Program Files/Java/jre1.8.0_202
R_HOME=C:/PROGRA~1/R/R-35~1.2 Creating Makefiles ... Configuration
done. make -C src JRI.jar make[1]: Entering directory
'/Users/ahkay/AppData/Local/Temp/RtmpKalUob/R.INSTALL192609e43b16/rJava/jri/src'
C:/Program Files/Java/jre1.8.0_202/bin/javac -d . ../RList.java
../RBool.java ../RVector.java ../RMainLoopCallbacks.java
../RConsoleOutputStream.java ../Mutex.java ../Rengine.java
../REXP.java ../RFactor.java ../package-info.java make[1]: C:/Program:
Command not found make[1]: * [Makefile.all:41:
org/rosuda/JRI/Rengine.class] Error 127 make[1]: Leaving directory
'/Users/ahkay/AppData/Local/Temp/RtmpKalUob/R.INSTALL192609e43b16/rJava/jri/src'
make: * [Makefile.all:19: src/JRI.jar] Error 2
**** WARNING: JRI could NOT be built Set IGNORE=1 if you want to build rJava anyway. ERROR: configuration failed for package 'rJava'
removing 'C:/Users/ahkay/Documents/R/win-library/3.5/rJava' In R CMD INSTALL In R CMD INSTALL Warning in install.packages : installation
of package ‘rJava’ had non-zero exit status
I have experienced same issue and following approach worked for me in my Mac OS 10.13.6, you can apply minor OS related changes if using in other OS.
OS:
Installing rJava Manually
# curl -#ROL https://www.rforge.net/rJava/snapshot/rJava_0.9-8.tar.gz
# R CMD INSTALL rJava_0.9-8.tar.gz
# su -
Location you have installed R software, you might have different location.
# cd /Library/Frameworks/R.framework/Versions/3.5/Resources/lib
I found that different Java used by R, and forcing by softlink:
#ln -s /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/lib/server/libjvm.dylib libjvm.dylib
Remember, you need to put your JAVA_HOME in the following location in R Studio:
>Sys.setenv(JAVA_HOME = "/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home")
Verifying rJava working in R Studio:
>require(rJava)
I am trying to build jpy for using the SNAP API of the european space agency in my ubuntu 16.04 with anaconda. After setting all my java, jdk and jvm paths correctly, I executed
python setup.py build
and got the following error:
src/main/c/jni/org_jpy_PyLib.c:254:26: warning: unused variable ‘state’ [-Wunused-variable]
PyGILState_STATE state = PyGILState_Ensure();
^~~~~ gcc -pthread -shared -B /home/delgado/local/anaconda3/compiler_compat
-L/home/delgado/local/anaconda3/lib -Wl,-rpath=/home/delgado/local/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/src/main/c/jpy_module.o build/temp.linux-x86_64-3.6/src/main/c/jpy_diag.o build/temp.linux-x86_64-3.6/src/main/c/jpy_conv.o build/temp.linux-x86_64-3.6/src/main/c/jpy_compat.o build/temp.linux-x86_64-3.6/src/main/c/jpy_jtype.o build/temp.linux-x86_64-3.6/src/main/c/jpy_jarray.o build/temp.linux-x86_64-3.6/src/main/c/jpy_jobj.o build/temp.linux-x86_64-3.6/src/main/c/jpy_jmethod.o build/temp.linux-x86_64-3.6/src/main/c/jpy_jfield.o build/temp.linux-x86_64-3.6/src/main/c/jni/org_jpy_PyLib.o -L
-L/home/delgado/local/anaconda3/lib -ljvm -ldl -lpython3.6m -o build/lib.linux-x86_64-3.6/jpy.cpython-36m-x86_64-linux-gnu.so
-Xlinker -rpath gcc: error: : No such file or directory error: command 'gcc' failed with exit status 1
I do not know precisely which file is missing and why it is missing.
Using a built version of jpy in conda solved the issue. I suggest eg: conda install -c terradue jpy
hope this still helps somebody