I'm trying to implement the JavaFuse project but when I execute the make command I'm getting this error:
gcc -shared build/contextClass.o build/conninfoClass.o build/javafuse_jni.o build/statvfsClass.o build/fsClass.o build/utimebufClass.o build/fileinfoClass.o build/statClass.o -o build/libjavafuse.so
Error:
build/contextClass.o: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make: * [libjavafuse.so] Error 1
I'm using Ubuntu.
Could anyone please suggest what is the problem?
I recommend fuse-jna, it's a project that I've used and it doesn't need to be compiled and also, it's alive and you may find it here fuse-jna. hope it'll help you
Related
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
I'm trying to compile a 27KB .c file in Powershell (Windows 10) using java and the TDM-GCC MinGW provided on sourceforge (https://sourceforge.net/projects/tdm-gcc/). The code I am using (from published paper http://journals.plos.org/ploscompbiol/article?id=10.1371%2Fjournal.pcbi.1001059) generates an executable file using the following code:
gcc -O3 -finline-functions -fomit-frame-pointer -DNDEBUG -fno-strict-aliasing --param max-inline-insns-single=1800 -std=c99 -msse2 -DHAVE_SSE2 -DDSFMT_MEXP=521 -o toy_bat toy_bat.c
When I compile a 6KB example file this works fine. However when I compile the 27KB file I get the following error:
C:/TDM-GCC-64/bin/.../lib/crt2.o: In function '__tmainCRTStartup' followed by a load of 'relocation truncated to fit' messages.
From what I've read onling this error normally comes from a file being too large, but I find it hard to believe that A 27KB file is causing this. Does anyone have any suggestions as to what may be causing this?
Thanks!
I want to learn that how we can call a java function from C++,after following some links i came to know that we need to add following header file in C++ file
#include <jni.h>
but when I added this file in C++ file in Netbeans IDE I got following error
fatal error: jni.h: No such file or directory
How can this error be removed, I am just beginner in JNI.
I went through previous questions asked at stackoverflow but was not able to go through the Problem.
Here is my comile output:
"/C/MinGW/MSYS/1.0/bin./make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/Simer/Documents/NetBeansProjects/JniDemo'
"/C/MinGW/MSYS/1.0/bin./make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/jnidemo.exe
make.exe[2]: Entering directory `/c/Users/Simer/Documents/NetBeansProjects/JniDemo'
mkdir -p build/Debug/MinGW-Windows
rm -f "build/Debug/MinGW-Windows/main.o.d"
g++ -c -g -MMD -MP -MF "build/Debug/MinGW-Windows/main.o.d" -o build/Debug/MinGW-Windows/main.o main.cpp
main.cpp:9:17: fatal error: jni.h: No such file or directory
#include <jni.h>
^
compilation terminated.
make.exe[2]: *** [build/Debug/MinGW-Windows/main.o] Error 1
make.exe[2]: Leaving directory `/c/Users/Simer/Documents/NetBeansProjects/JniDemo'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/Simer/Documents/NetBeansProjects/JniDemo'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 2s)
You are compiling with MinGW without including Java headers, thats why it complains about not found
Try to add this option to your compilation command -I"c:/path/to/jdk/include" -I"c:/path/to/jdk/include/win32" -D__int64="long long".
The last option is to avoid the error caused because windows compiler uses the type __int64 and gcc uses long long.
Have you looked at the Netbeans JNI tutorial?
It goes through everything you should need to do in pretty good detail.
I am trying to use JNI to call a Java program from a C++ program. A supplier has put in place some phone apparatus and it only uses C++. I want to write a Screen Popper but don't want to do it in C++ so therefore want to pass across the event of the phone call coming in and the number to a Java routine to handle. I am using Netbeans as it makes the coding easier (usually!). I have not done C++ before which is why I want to escape to Java ASAP!
I am following instructions here: http://www.ibm.com/developerworks/java/tutorials/j-jni/j-jni.html
Which seem to set out how to call a Java routine from C++ but I cannot get it to compile. I have got as far as I with lots of help from this site but now I'm stumped.
I have added the '-D__int64=long long' switch to the compiler options for the project and added the Java libraries to the Application include paths. I have reparsed the code using code assistance. But now I'm left with this error:
make[1]: Entering directory '/cygdrive/f/Javadev/Sample2'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/sample2.exe
make[2]: Entering directory '/cygdrive/f/Javadev/Sample2'
mkdir -p build/Debug/Cygwin_4.x-Windows
rm -f build/Debug/Cygwin_4.x-Windows/main.o.d
g++.exe -D__int64=long long -c -g -I/cygdrive/C/Program\ Files\ \(x86\)/Java/jdk1.6.0_33/include/win32 -I/cygdrive/C/Program\ Files\ \(x86\)/Java/jdk1.6.0_33/include -MMD -MP -MF build/Debug/Cygwin_4.x-Windows/main.o.d -o build/Debug/Cygwin_4.x-Windows/main.o main.cpp
nbproject/Makefile-Debug.mk:65: recipe for target 'build/Debug/Cygwin_4.x-Windows/main.o' failed
make[2]: Leaving directory '/cygdrive/f/Javadev/Sample2'
nbproject/Makefile-Debug.mk:58: recipe for target '.build-conf' failed
make[1]: Leaving directory '/cygdrive/f/Javadev/Sample2'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
g++: error: long: No such file or directory
make[2]: *** [build/Debug/Cygwin_4.x-Windows/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
All source files are under F:\javadev, Sample2 is C++ and Sample3 is Java. Is there something else I need to include from Cygwin? It seems to say there is a problem with 'long' but that only really occurs in the switch and without it it fails even more catastrophically, saying that __int64 does not have a type.
Bear with me - this is a long description, but I wanted to include all details. I'm trying use android NDK and JNI for building OpenCV Android apps.
I'm following this tutorial to get everything installed:
http://www.stanford.edu/class/ee368/Android/Tutorial-2-OpenCV-for-Android-Setup-Macintosh-API8.pdf
The following installed just fine:
/usr/bin/g++
/usr/local/bin/swig
/usr/bin/cmake
/usr/bin/make
/Developer/pcre-8.32/
Contents of my .bashrc file:
export NDK=/Users/Me/Code/Android/android-ndk-r4-crystax
export SDK=/Users/Me/Code/Android/adt-bundle-mac-x86_64-20130219/
export OPCV=/Users/Me/Code/OpenCV/opencv
export PATH=$NDK:$SDK/tools:$SDK/platform-tools:$PATH
export NDK_ROOT=$NDK
Making OpenCV libraries went just fine.
Due to complaint in using make, I had to make a small edit in /Users/Me/Code/OpenCV/opencv/android/android-jni/local.env.mk which looked like so:
#ANDROID_NDK_ROOT=$(HOME)/android-ndk-r4-crystax
ANDROID_NDK_ROOT=/Users/Me/Code/Android/android-ndk-r4-crystax
Then upon trying again to make in the android-jni, directory, disaster struck:
/Users/Me/Code/Android/android-ndk-r4-crystax/ndk-build OPENCV_CONFIG=../build/android-opencv.mk \
PROJECT_PATH= ARM_TARGETS="armeabi armeabi-v7a" V=
Gdbserver : [arm-eabi-4.4.0] /Users/Me/Code/OpenCV/opencv/android/android-jni/libs/armeabi/gdbserver
Gdbsetup : /Users/Me/Code/OpenCV/opencv/android/android-jni/libs/armeabi/gdb.setup
Gdbsetup : + source directory /Users/Me/Code/OpenCV/opencv/android/android-jni/jni
Gdbserver : [arm-eabi-4.4.0] /Users/Me/Code/OpenCV/opencv/android/android-jni/libs/armeabi-v7a/gdbserver
Gdbsetup : /Users/Me/Code/OpenCV/opencv/android/android-jni/libs/armeabi-v7a/gdb.setup
Gdbsetup : + source directory /Users/Me/Code/OpenCV/opencv/android/android-jni/jni
SharedLibrary : libandroid-opencv.so
/Users/Me/Code/Android/android-ndk-r4-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/../../../../arm-eabi/bin/ld: cannot find -lopencv_calib3d
collect2: ld returned 1 exit status
make[1]: *** [/Users/Me/Code/OpenCV/opencv/android/android-jni/obj/local/armeabi/libandroid-opencv.so] Error 1
make: *** [libs/armeabi-v7a/libandroid-opencv.so] Error 2
I thought perhaps this was a pkg-config error, but that appears to be set up as well, though in my old install of OpenCV. Below is the output of pkg-config --cflags --libs opencv:
-I/usr/include/opencv /usr/lib/libopencv_calib3d.dylib /usr/lib/libopencv_contrib.dylib /usr/lib/libopencv_core.dylib /usr/lib/libopencv_features2d.dylib /usr/lib/libopencv_flann.dylib /usr/lib/libopencv_gpu.dylib /usr/lib/libopencv_highgui.dylib /usr/lib/libopencv_imgproc.dylib /usr/lib/libopencv_legacy.dylib /usr/lib/libopencv_ml.dylib /usr/lib/libopencv_nonfree.dylib /usr/lib/libopencv_objdetect.dylib /usr/lib/libopencv_photo.dylib /usr/lib/libopencv_stitching.dylib /usr/lib/libopencv_ts.dylib /usr/lib/libopencv_video.dylib /usr/lib/libopencv_videostab.dylib
The install built by this particular tutorial has placed an opencv.pc file at this location:
/Users/Me/Code/OpenCV/opencv/build/unix-install
BUT Running the below and trying make again doesn't fix the problem:
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/Users/Me/Code/OpenCV/opencv/build/unix-install
I can't figure out what is wrong. I've been battling with this problem for about a month on and off, and finally needed some outside opinions. Any ideas?
Error message says
cannot find -lopencv_calib3d collect2: ld returned 1 exit status
It means linker can't find opencv_calib3d library. It may have name libopencv_calib3d.a or libopencv_calib3d.so. So you need find one of them and add path to this file to your LD_LIBRARY_PATH env variable.
I mean if let's say folder /Users/Me/Code/OpenCV/opencv/lib contains libopencv_calib3d.so then you need execute something like following before make:
export LD_LIBRARY_PATH=/Users/Me/Code/OpenCV/opencv/lib:$LD_LIBRARY_PATH
Try the official OpenCV4Android tutorials at http://docs.opencv.org/trunk/doc/tutorials/introduction/android_binary_package/android_dev_intro.html