java - Issue executing OpenCV native functions via JNI -
i'm attempting run native opencv functions via java native interface on unbuntu. i'm trying accomplish use bagofwords
functions available in default version of opencv, time being i'm trying test out running simple functions using interface.
so, have following java file relative native functions.
class opencvsample { static { system.loadlibrary("bridge1"); } public native int bridgefunction(); public static void main(string[] args) { opencvsample b = new opencvsample(); b.bridgefunction(); }
}
here c++ bridge
file.
#include "opencvsample.h" #include <string.h> #include <cv.h> jniexport jint jnicall java_opencvsample_bridgefunction(jnienv *env, jobject obj) { iplimage *img = cvcreateimage( cvsize( 640, 480 ), ipl_depth_8u, 1 ); return 1; } int main(){}
now mentioned, i'm doing on ubuntu, i'm first compiling opencv shared library jdk gcc
following command.
g++ -shared -o libbridge1.so bridge1.cpp -fpic -i/usr/lib/jvm/java-1.7.0-openjdk-amd64/include -i/usr/lib/jvm/java-1.7.0-openjdk-amd64/include/linux -i/var/opencv/opencv/include/opencv -i/var/opencv/opencv/modules/core/include -i/var/opencv/opencv/modules/imgproc/include -i/var/opencv/opencv/modules/features2d/include -i/var/opencv/opencv/modules/flann/include -i/var/opencv/opencv/modules/calib3d/include -i/var/opencv/opencv/modules/objdetect/include -i/var/opencv/opencv/modules/legacy/include -i/var/opencv/opencv/modules/highgui/include
which create shared library called libbridge1.so
. problem arises when try run java file itself, following error.
java: symbol lookup error: /var/tests/oc/libbridge1.so: undefined symbol: cvcreateimage
i've looked quite bit , i'm sure i'm creating shared library correctly, can't understand why i'm getting error, explain?
----------------------------------- edit -----------------------------------
thanks users andrew henle , james black advise. i've gone ahead , linked respective libraries following command.
g++ -shared -o libbridge1.so opencvsample.cpp -fpic -i/usr/lib/jvm/java-1.7.0-openjdk-amd64/include -i/usr/lib/jvm/java-1.7.0-openjdk-amd64/include/linux -i/var/opencv/opencv/include -i/var/opencv/opencv/include/opencv -i/var/opencv/opencv/modules/core/include -i/var/opencv/opencv/modules/imgproc/include -i/var/opencv/opencv/modules/photo/include -i/var/opencv/opencv/modules/objdetect/include -l/var/opencv/opencv/build/lib -lopencv_core -l/var/opencv/opencv/build/lib -lopencv_imgproc -l/var/opencv/opencv/build/lib -lopencv_highgui -l/var/opencv/opencv/build/lib -lopencv_objdetect -l/var/opencv/opencv/build/lib -lopencv_features2d -l/var/opencv/opencv/build/lib -lopencv_video -l/var/opencv/opencv/build/lib -lopencv_core249
and library seems compile, issue seems that it's filled undefined references
. when running ld
command on libbridge1.so
following stream of errors.
ld: warning: cannot find entry symbol _start; not setting start address libbridge1.so: undefined reference `ippicvimirror_32s_c4r' libbridge1.so: undefined reference `ippicvitranspose_8u_c1r' libbridge1.so: undefined reference `ippicvinormdiff_inf_16u_c4r' libbridge1.so: undefined reference `ippicvisub_8u_c1rsfs' libbridge1.so: undefined reference `ippicvitranspose_32s_c1ir' libbridge1.so: undefined reference `ippicvisum_32f_c3r' libbridge1.so: undefined reference `pthread_mutex_trylock' libbridge1.so: undefined reference `ippicvimean_16u_c1mr' libbridge1.so: undefined reference `ippicvitranspose_16s_c3r' libbridge1.so: undefined reference `ippicvinorm_l2_16s_c3r' libbridge1.so: undefined reference `ippicvixor_8u_c1r' libbridge1.so: undefined reference `ippicvimirror_8u_c4r' libbridge1.so: undefined reference `ippicvinorm_inf_16u_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l2_16u_c1r' libbridge1.so: undefined reference `ippicvinormdiff_inf_16u_c3cmr' libbridge1.so: undefined reference `ippicvinormdiff_l2_32f_c3r' libbridge1.so: undefined reference `ippicvinorm_l2_32f_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l1_16s_c3r' libbridge1.so: undefined reference `ippicvinorm_l1_8s_c1mr' libbridge1.so: undefined reference `ippicviset_16u_c3mr' libbridge1.so: undefined reference `gzeof' libbridge1.so: undefined reference `ippicvinormdiff_inf_32f_c1mr' libbridge1.so: undefined reference `ippicvitranspose_16u_c3ir' libbridge1.so: undefined reference `ippicvisum_16u_c4r' libbridge1.so: undefined reference `ippicviabsdiff_8u_c1r' libbridge1.so: undefined reference `ippicvinormrel_l2_8u_c1mr' libbridge1.so: undefined reference `ippicviabsdiff_16u_c1r' libbridge1.so: undefined reference `ippicvsminevery_16u' libbridge1.so: undefined reference `ippicvmalloc' libbridge1.so: undefined reference `ippicvinormdiff_l1_32f_c1mr' libbridge1.so: undefined reference `ippicvimirror_16u_c3ir' libbridge1.so: undefined reference `ippicviconvert_8s32f_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l2_16s_c4r' libbridge1.so: undefined reference `ippicvsflip_32f_i' libbridge1.so: undefined reference `ippicvinormdiff_l2_16u_c3r' libbridge1.so: undefined reference `ippicvinormdiff_inf_8u_c3cmr' libbridge1.so: undefined reference `ippicvitranspose_16u_c1ir' libbridge1.so: undefined reference `ippicvisub_16u_c1rsfs' libbridge1.so: undefined reference `ippicviset_16u_c4mr' libbridge1.so: undefined reference `ippicvitranspose_8u_c3ir' libbridge1.so: undefined reference `ippicvinorm_l1_16u_c3r' libbridge1.so: undefined reference `gzopen' libbridge1.so: undefined reference `ippicvitranspose_16u_c1r' libbridge1.so: undefined reference `ippicvimean_32f_c3cmr' libbridge1.so: undefined reference `ippicvinormdiff_l2_32f_c1mr' libbridge1.so: undefined reference `pthread_mutexattr_settype' libbridge1.so: undefined reference `gzclose' libbridge1.so: undefined reference `ippicvinorm_l2_16u_c4r' libbridge1.so: undefined reference `ippicvicompare_16s_c1r' libbridge1.so: undefined reference `ippicvimax_8u_c1r' libbridge1.so: undefined reference `ippicvimean_16s_c3r' libbridge1.so: undefined reference `ippicviconvert_32f16u_c1rsfs' libbridge1.so: undefined reference `ippicviconvert_32s32f_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l2_8u_c1mr' libbridge1.so: undefined reference `ippicvimean_8u_c1r' libbridge1.so: undefined reference `ippicvimirror_16s_c3r' libbridge1.so: undefined reference `ippicvinormdiff_l1_32f_c4r' libbridge1.so: undefined reference `ippicvinormrel_l1_8u_c1mr' libbridge1.so: undefined reference `pthread_key_create' libbridge1.so: undefined reference `ippicvimirror_16u_c1ir' libbridge1.so: undefined reference `ippicvinormrel_l2_16u_c1r' libbridge1.so: undefined reference `gzrewind' libbridge1.so: undefined reference `ippicvimirror_32s_c1r' libbridge1.so: undefined reference `ippicviadd_32f_c1r' libbridge1.so: undefined reference `ippicvinorm_l1_8u_c1mr' libbridge1.so: undefined reference `ippicvinormdiff_inf_32f_c1r' libbridge1.so: undefined reference `ippicvinormdiff_inf_8u_c4r' libbridge1.so: undefined reference `ippicvisum_8u_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l1_8s_c1mr' libbridge1.so: undefined reference `ippicviconvert_16u32s_c1r' libbridge1.so: undefined reference `ippicvinorm_l1_16s_c4r' libbridge1.so: undefined reference `ippicviconvert_16u8s_c1rsfs' libbridge1.so: undefined reference `ippicvimirror_16s_c4ir' libbridge1.so: undefined reference `ippicvinormdiff_l2_16u_c3cmr' libbridge1.so: undefined reference `ippicvinormrel_l1_16u_c1mr' libbridge1.so: undefined reference `ippicvicompare_8u_c1r' libbridge1.so: undefined reference `ippicviminmaxindx_32f_c1mr' libbridge1.so: undefined reference `ippicvimirror_32f_c4ir' libbridge1.so: undefined reference `ippicvinormdiff_inf_32f_c4r' libbridge1.so: undefined reference `ippicvisum_16s_c3r' libbridge1.so: undefined reference `ippicvimin_32f_c1r' libbridge1.so: undefined reference `ippicvinorm_l1_16s_c3r' libbridge1.so: undefined reference `ippicvinormdiff_l2_16s_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l1_32f_c1r' libbridge1.so: undefined reference `dlsym' libbridge1.so: undefined reference `ippicvinormrel_l2_16s_c1r' libbridge1.so: undefined reference `ippicvicopy_32s_c3mr' libbridge1.so: undefined reference `ippicviconvert_16u8u_c1r' libbridge1.so: undefined reference `ippicviset_16s_c4mr' libbridge1.so: undefined reference `ippicvimax_16s_c1r' libbridge1.so: undefined reference `ippicviminmaxindx_8u_c1mr' libbridge1.so: undefined reference `pthread_once' libbridge1.so: undefined reference `ippicvinormrel_l2_8s_c1mr' libbridge1.so: undefined reference `ippicvinorm_l1_32f_c1mr' libbridge1.so: undefined reference `ippicvitranspose_8u_c4ir' libbridge1.so: undefined reference `ippicviconvert_16s32s_c1r' libbridge1.so: undefined reference `ippicvicopy_8u_c1r' libbridge1.so: undefined reference `ippicvsminevery_8u' libbridge1.so: undefined reference `ippicvsflip_64f_i' libbridge1.so: undefined reference `ippicvsmaxevery_32f' libbridge1.so: undefined reference `ippicvimirror_32f_c1r' libbridge1.so: undefined reference `ippicvinormrel_l1_16u_c1r' libbridge1.so: undefined reference `ippicvinormrel_l2_32f_c1mr' libbridge1.so: undefined reference `ippicvinorm_l1_16u_c4r' libbridge1.so: undefined reference `ippicviadd_16u_c1rsfs' libbridge1.so: undefined reference `ippicvinorm_l2_16s_c4r' libbridge1.so: undefined reference `ippicvimean_8u_c1mr' libbridge1.so: undefined reference `ippicvinormdiff_inf_16u_c3r' libbridge1.so: undefined reference `ippicvimul_16u_c1rsfs' libbridge1.so: undefined reference `ippicvsmaxevery_64f' libbridge1.so: undefined reference `ippicvimirror_16u_c3r' libbridge1.so: undefined reference `ippicvitranspose_32s_c4ir' libbridge1.so: undefined reference `ippicvimirror_8u_c3ir' libbridge1.so: undefined reference `ippicviconvert_32s8u_c1r' libbridge1.so: undefined reference `ippicvitranspose_16s_c3ir' libbridge1.so: undefined reference `ippicvisum_8u_c3r' libbridge1.so: undefined reference `ippicvinorm_inf_32f_c4r' libbridge1.so: undefined reference `ippicvitranspose_8u_c3r' libbridge1.so: undefined reference `ippicviminmaxindx_8s_c1mr' libbridge1.so: undefined reference `ippicviconvert_32s16u_c1rsfs' libbridge1.so: undefined reference `ippicviconvert_8s8u_c1rs' libbridge1.so: undefined reference `ippicvinormrel_inf_32f_c1mr' libbridge1.so: undefined reference `ippicvitranspose_8u_c1ir' libbridge1.so: undefined reference `ippicvinormdiff_inf_8s_c3cmr' libbridge1.so: undefined reference `ippicvinormdiff_l1_8u_c4r' libbridge1.so: undefined reference `ippicvssortascend_8u_i' libbridge1.so: undefined reference `ippicvinormdiff_inf_16u_c1mr' libbridge1.so: undefined reference `ippicviconvert_32f32s_c1rsfs' libbridge1.so: undefined reference `ippicvitranspose_16s_c1r' libbridge1.so: undefined reference `ippicvicopy_32s_c4mr' libbridge1.so: undefined reference `ippicvinormdiff_l2_8u_c3cmr' libbridge1.so: undefined reference `ippicvinorm_l2_16u_c3r' libbridge1.so: undefined reference `pthread_getspecific' libbridge1.so: undefined reference `ippicviset_32s_c4mr' libbridge1.so: undefined reference `ippicvinorm_inf_16u_c3r' libbridge1.so: undefined reference `ippicvinormdiff_l1_32f_c3r' libbridge1.so: undefined reference `ippicvitranspose_32s_c1r' libbridge1.so: undefined reference `ippicvinit' libbridge1.so: undefined reference `ippicvimean_8u_c3cmr' libbridge1.so: undefined reference `ippicvinormdiff_inf_8u_c3r' libbridge1.so: undefined reference `ippicvinorm_l1_32f_c3r' libbridge1.so: undefined reference `pthread_mutexattr_destroy' libbridge1.so: undefined reference `ippicvinorm_inf_8u_c4r' libbridge1.so: undefined reference `ippicviconvert_32s16s_c1rsfs' libbridge1.so: undefined reference `ippicvimul_16s_c1rsfs' libbridge1.so: undefined reference `ippicvinormdiff_inf_8s_c1mr' libbridge1.so: undefined reference `ippicvinormdiff_l2_16u_c4r' libbridge1.so: undefined reference `ippicvimean_stddev_8u_c3cmr' libbridge1.so: undefined reference `ippicvimirror_32s_c4ir' libbridge1.so: undefined reference `ippicvicopy_16u_c1mr' libbridge1.so: undefined reference `ippicvimean_stddev_16u_c1mr' libbridge1.so: undefined reference `ippicvinormrel_l1_32f_c1mr' libbridge1.so: undefined reference `ippicviconvert_32f8s_c1rsfs' libbridge1.so: undefined reference `ippicvisum_16u_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l1_8u_c1r' libbridge1.so: undefined reference `ippicvimirror_8u_c3r' libbridge1.so: undefined reference `ippicvinorm_l1_16u_c1r' libbridge1.so: undefined reference `ippicvimirror_32s_c1ir' libbridge1.so: undefined reference `ippicvimul_32f_c1r' libbridge1.so: undefined reference `ippicvinormdiff_inf_16s_c4r' libbridge1.so: undefined reference `ippicvitranspose_32s_c4r' libbridge1.so: undefined reference `ippicviconvert_32s8s_c1r' libbridge1.so: undefined reference `ippicvitranspose_16u_c4r' libbridge1.so: undefined reference `ippicvinorm_l2_16u_c1mr' libbridge1.so: undefined reference `ippicvinorm_inf_16s_c4r' libbridge1.so: undefined reference `ippicvitranspose_32f_c4ir' libbridge1.so: undefined reference `ippicvinorm_l2_8u_c3r' libbridge1.so: undefined reference `ippicvimean_16u_c4r' libbridge1.so: undefined reference `ippicvitranspose_16s_c4r' libbridge1.so: undefined reference `ippicvimean_32f_c1r' libbridge1.so: undefined reference `ippicvinot_8u_c1r' libbridge1.so: undefined reference `ippicvinorm_inf_8u_c3r' libbridge1.so: undefined reference `ippicvinorm_l2_16s_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l2_16u_c1mr' libbridge1.so: undefined reference `ippicvilutpalette_8u_c4r' libbridge1.so: undefined reference `ippicvimirror_16u_c4r' libbridge1.so: undefined reference `ippicvitranspose_32f_c1ir' libbridge1.so: undefined reference `ippicvinormrel_inf_16s_c1r' libbridge1.so: undefined reference `ippicvimean_stddev_16u_c3cmr' libbridge1.so: undefined reference `ippicvisub_16s_c1rsfs' libbridge1.so: undefined reference `ippicvinormdiff_l2_8u_c1r' libbridge1.so: undefined reference `ippicvinorm_inf_32f_c3r' libbridge1.so: undefined reference `ippicvinormdiff_l1_16u_c1mr' libbridge1.so: undefined reference `ippicvicopy_8u_c3mr' libbridge1.so: undefined reference `ippicvinorm_l1_32f_c1r' libbridge1.so: undefined reference `ippicvimirror_32s_c3r' libbridge1.so: undefined reference `ippicvinormdiff_l1_16u_c3r' libbridge1.so: undefined reference `ippicvimean_8u_c3r' libbridge1.so: undefined reference `pthread_mutexattr_init' libbridge1.so: undefined reference `ippicvinorm_inf_16s_c1r' libbridge1.so: undefined reference `ippicviconvert_16s8s_c1rsfs' libbridge1.so: undefined reference `ippicvinormrel_inf_32f_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l1_8s_c3cmr' libbridge1.so: undefined reference `ippicvinormrel_l2_16u_c1mr' libbridge1.so: undefined reference `ippicviminmaxindx_8s_c1r' libbridge1.so: undefined reference `ippicvinorm_l1_16s_c1r' libbridge1.so: undefined reference `ippicvimean_stddev_8u_c3cr' libbridge1.so: undefined reference `ippicviset_32f_c3mr' libbridge1.so: undefined reference `ippicviconvert_8s16s_c1r' libbridge1.so: undefined reference `ippicviadd_8u_c1rsfs' libbridge1.so: undefined reference `ippicvinormdiff_inf_32f_c3r' libbridge1.so: undefined reference `ippicviconvert_16u16s_c1rsfs' libbridge1.so: undefined reference `ippicviset_16s_c3mr' libbridge1.so: undefined reference `ippicvitranspose_32f_c1r' libbridge1.so: undefined reference `ippicvisum_16u_c3r' libbridge1.so: undefined reference `ippicvimirror_16s_c3ir' libbridge1.so: undefined reference `ippicvinorm_inf_8s_c1mr' libbridge1.so: undefined reference `ippicviconvert_8s16u_c1rs' libbridge1.so: undefined reference `ippicvinorm_l2_32f_c3r' libbridge1.so: undefined reference `ippicvimean_16u_c1r' libbridge1.so: undefined reference `ippicvinorm_l1_8u_c3r' libbridge1.so: undefined reference `ippicvicopy_8u_c3p3r' libbridge1.so: undefined reference `ippicvicopy_16u_c3mr' libbridge1.so: undefined reference `ippicvinorm_l2_16u_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l2_8u_c3r' libbridge1.so: undefined reference `ippicvisum_8u_c4r' libbridge1.so: undefined reference `ippicvinormdiff_l1_16u_c1r' libbridge1.so: undefined reference `ippicvimean_32f_c1mr' libbridge1.so: undefined reference `ippicvitranspose_16s_c4ir' libbridge1.so: undefined reference `ippicvimirror_8u_c1ir' libbridge1.so: undefined reference `ippicvitranspose_32f_c4r' libbridge1.so: undefined reference `ippicvimean_stddev_32f_c1mr' libbridge1.so: undefined reference `ippicvinormdiff_l1_16s_c4r' libbridge1.so: undefined reference `ippicvinormrel_inf_16u_c1r' libbridge1.so: undefined reference `ippicvisum_16s_c1r' libbridge1.so: undefined reference `ippicvinormdiff_inf_16s_c3r' libbridge1.so: undefined reference `ippicvimean_16u_c3r' libbridge1.so: undefined reference `ippicvidotprod_16u64f_c1r' libbridge1.so: undefined reference `ippicvicompare_16u_c1r' libbridge1.so: undefined reference `ippicvimean_stddev_16u_c3cr' libbridge1.so: undefined reference `ippicvinorm_l2_8u_c4r' libbridge1.so: undefined reference `ippicvimirror_8u_c4ir' libbridge1.so: undefined reference `ippicvsdotprod_64f' libbridge1.so: undefined reference `ippicviset_32f_c4mr' libbridge1.so: undefined reference `ippicvsminevery_32f' libbridge1.so: undefined reference `ippicvinormdiff_l1_32f_c3cmr' libbridge1.so: undefined reference `ippicvinorm_l2_8u_c1mr' libbridge1.so: undefined reference `ippicvinorm_inf_16s_c3r' libbridge1.so: undefined reference `ippicvisum_32f_c4r' libbridge1.so: undefined reference `ippicvinormrel_l1_32f_c1r' libbridge1.so: undefined reference `ippicvitranspose_16u_c4ir' libbridge1.so: undefined reference `ippicvinorm_inf_8u_c1mr' libbridge1.so: undefined reference `ippicvisub_32f_c1r' libbridge1.so: undefined reference `ippicvimax_16u_c1r' libbridge1.so: undefined reference `ippicvimean_stddev_8u_c1mr' libbridge1.so: undefined reference `ippicvitranspose_32f_c3r' libbridge1.so: undefined reference `ippicvisum_32f_c1r' libbridge1.so: undefined reference `ippicviminmaxindx_8u_c1r' libbridge1.so: undefined reference `ippicvimin_16u_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l2_8s_c1mr' libbridge1.so: undefined reference `ippicviset_32s_c3mr' libbridge1.so: undefined reference `ippicvinorm_l2_8s_c1mr' libbridge1.so: undefined reference `ippicvimax_32f_c1r' libbridge1.so: undefined reference `ippicvinorm_l2_32f_c1mr' libbridge1.so: undefined reference `ippicvinormdiff_l1_16u_c4r' libbridge1.so: undefined reference `ippicvinorm_l1_16u_c1mr' libbridge1.so: undefined reference `ippicvinorm_l1_32f_c4r' libbridge1.so: undefined reference `ippicvinormdiff_l2_32f_c3cmr' libbridge1.so: undefined reference `ippicvicopy_8u_c4p4r' libbridge1.so: undefined reference `ippicvsmaxevery_16u' libbridge1.so: undefined reference `ippicvinormrel_inf_8s_c1mr' libbridge1.so: undefined reference `ippicvinormdiff_inf_8u_c1r' libbridge1.so: undefined reference `ippicvitranspose_16s_c1ir' libbridge1.so: undefined reference `ippicvicopy_8u_c1mr' libbridge1.so: undefined reference `ippicviset_32s_c1mr' libbridge1.so: undefined reference `ippicvsflip_8u_i' libbridge1.so: undefined reference `ippicviconvert_8u32s_c1r' libbridge1.so: undefined reference `ippicvinormrel_inf_8u_c1mr' libbridge1.so: undefined reference `ippicvitranspose_32s_c3r' libbridge1.so: undefined reference `ippicvsminevery_64f' libbridge1.so: undefined reference `ippicvitranspose_16u_c3r' libbridge1.so: undefined reference `ippicviconvert_8u16s_c1r' libbridge1.so: undefined reference `ippicvicopy_32s_c1mr' libbridge1.so: undefined reference `ippicviconvert_8u8s_c1rsfs' libbridge1.so: undefined reference `ippicvinormdiff_inf_16s_c1r' libbridge1.so: undefined reference `ippicvidotprod_16s64f_c1r' libbridge1.so: undefined reference `ippicviset_16s_c1mr' libbridge1.so: undefined reference `ippicvinorm_l1_8u_c1r' libbridge1.so: undefined reference `ippicvinorm_l2_32f_c4r' libbridge1.so: undefined reference `ippicvior_8u_c1r' libbridge1.so: undefined reference `ippicvimirror_8u_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l1_8u_c3r' libbridge1.so: undefined reference `ippicvitranspose_32s_c3ir' libbridge1.so: undefined reference `ippicvimirror_16s_c1r' libbridge1.so: undefined reference `ippicvimean_16s_c4r' libbridge1.so: undefined reference `ippicvimean_16s_c1r' libbridge1.so: undefined reference `ippicviconvert_32f8u_c1rsfs' libbridge1.so: undefined reference `ippicviconvert_16s32f_c1r' libbridge1.so: undefined reference `ippicvimin_8u_c1r' libbridge1.so: undefined reference `ippicvinorm_l2_8u_c1r' libbridge1.so: undefined reference `ippicvilutpalette_8u_c3r' libbridge1.so: undefined reference `gzgets' libbridge1.so: undefined reference `ippicvimirror_32f_c1ir' libbridge1.so: undefined reference `ippicviadd_16s_c1rsfs' libbridge1.so: undefined reference `ippicvimean_stddev_32f_c3cr' libbridge1.so: undefined reference `ippicviconvert_8u16u_c1r' libbridge1.so: undefined reference `ippicvimean_stddev_32f_c3cmr' libbridge1.so: undefined reference `ippicvimirror_32f_c4r' libbridge1.so: undefined reference `ippicvinorm_inf_8u_c1r' libbridge1.so: undefined reference `ippicvimul_8u_c1rsfs' libbridge1.so: undefined reference `ippicvitranspose_32f_c3ir' libbridge1.so: undefined reference `ippicvimin_16s_c1r' libbridge1.so: undefined reference `ippicvinormrel_l2_8u_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l2_32f_c4r' libbridge1.so: undefined reference `ippicvimirror_32s_c3ir' libbridge1.so: undefined reference `ippicvimirror_16s_c1ir' libbridge1.so: undefined reference `ippicvimean_8u_c4r' libbridge1.so: undefined reference `ippicvinormrel_inf_8u_c1r' libbridge1.so: undefined reference `ippicvinorm_l1_8u_c4r' libbridge1.so: undefined reference `ippicvinormrel_inf_16u_c1mr' libbridge1.so: undefined reference `ippicvinormrel_l1_8s_c1mr' libbridge1.so: undefined reference `ippicvimean_32f_c3r' libbridge1.so: undefined reference `ippicvimean_32f_c4r' libbridge1.so: undefined reference `ippicvimirror_32f_c3r' libbridge1.so: undefined reference `gzputs' libbridge1.so: undefined reference `ippicvimirror_32f_c3ir' libbridge1.so: undefined reference `ippicviabsdiff_32f_c1r' libbridge1.so: undefined reference `ippicvsflip_16u_i' libbridge1.so: undefined reference `ippicvinormrel_l1_16s_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l2_32f_c1r' libbridge1.so: undefined reference `ippicviconvert_16s16u_c1rs' libbridge1.so: undefined reference `ippicvsdotprod_32f64f' libbridge1.so: undefined reference `ippicvimean_stddev_8u_c1r' libbridge1.so: undefined reference `ippicvimirror_16u_c1r' libbridge1.so: undefined reference `ippicviminmaxindx_16u_c1mr' libbridge1.so: undefined reference `ippicvinormdiff_inf_32f_c3cmr' libbridge1.so: undefined reference `ippicviconvert_16u32f_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l1_8u_c1mr' libbridge1.so: undefined reference `ippicvfree' libbridge1.so: undefined reference `ippicvinorm_inf_32f_c1r' libbridge1.so: undefined reference `ippicviset_32f_c1mr' libbridge1.so: undefined reference `ippicviminmaxindx_16u_c1r' libbridge1.so: undefined reference `ippicvsmaxevery_8u' libbridge1.so: undefined reference `ippicvitranspose_8u_c4r' libbridge1.so: undefined reference `ippicvinormdiff_l2_16s_c3r' libbridge1.so: undefined reference `ippicvinormdiff_l2_8s_c3cmr' libbridge1.so: undefined reference `ippicvinormdiff_inf_8u_c1mr' libbridge1.so: undefined reference `ippicviminmaxindx_32f_c1r' libbridge1.so: undefined reference `dlopen' libbridge1.so: undefined reference `ippicvimirror_16s_c4r' libbridge1.so: undefined reference `ippicvinormdiff_l2_8u_c4r' libbridge1.so: undefined reference `ippicvinormdiff_l1_8u_c3cmr' libbridge1.so: undefined reference `ippicvisum_16s_c4r' libbridge1.so: undefined reference `pthread_setspecific' libbridge1.so: undefined reference `ippicvimean_stddev_16u_c1r' libbridge1.so: undefined reference `ippicvinormrel_l1_8u_c1r' libbridge1.so: undefined reference `ippicvimean_16u_c3cmr' libbridge1.so: undefined reference `ippicvicompare_32f_c1r' libbridge1.so: undefined reference `ippicvinorm_inf_16u_c4r' libbridge1.so: undefined reference `ippicvinormrel_l2_32f_c1r' libbridge1.so: undefined reference `ippicvinorm_inf_32f_c1mr' libbridge1.so: undefined reference `ippicviconvert_16s8u_c1r' libbridge1.so: undefined reference `ippicvinormdiff_inf_16u_c1r' libbridge1.so: undefined reference `ippicviand_8u_c1r' libbridge1.so: undefined reference `ippicviconvert_8s32s_c1r' libbridge1.so: undefined reference `ippicvinormdiff_l1_16u_c3cmr' libbridge1.so: undefined reference `ippicvimean_stddev_32f_c1r' libbridge1.so: undefined reference `ippicviconvert_8u32f_c1r' libbridge1.so: undefined reference `ippicviset_16u_c1mr' libbridge1.so: undefined reference `ippicvidotprod_32s64f_c1r' libbridge1.so: undefined reference `ippicvimirror_16u_c4ir' libbridge1.so: undefined reference `ippicvssortdescend_8u_i'
when running java file itself, issue:
exception in thread "main" java.lang.unsatisfiedlinkerror: /var/tests/oc/libbridge1.so: /var/tests/oc/libbridge1.so: undefined symbol: ippicviminmaxindx_16u_c1r @ java.lang.classloader$nativelibrary.load(native method) @ java.lang.classloader.loadlibrary0(classloader.java:1937) @ java.lang.classloader.loadlibrary(classloader.java:1855) @ java.lang.runtime.loadlibrary0(runtime.java:870) @ java.lang.system.loadlibrary(system.java:1122) @ bridge1.<clinit>(opencvsample.java:4)
--------------------------------- edit 2 ---------------------------------
after further tinkering i've found issue getting undefined references. linking wrong core file. issue still persists, on smaller scale. here following command im using:
g++ -wall -shared-libgcc -im -o libbridge1.so bridge1.cpp -fpic -i/usr/lib/jvm/java-1.7.0-openjdk-amd64/include -i/usr/lib/jvm/java-1.7.0-openjdk-amd64/include/linux -i/var/opencv/opencv/include -i/var/opencv/opencv/include/opencv -i/var/opencv/opencv/modules/core/include -i/var/opencv/opencv/modules/imgproc/include -i/var/opencv/opencv/modules/photo/include -i/var/opencv/opencv/modules/objdetect/include -i/var/opencv/opencv/modules/imgcodecs/include -i/var/opencv/opencv/modules/videoio/include -i/var/opencv/opencv/modules/highgui/include -l/var/opencv/opencv/build/lib -lopencv_core249 -l/var/opencv/opencv/build/lib -lopencv_features2d -l/var/opencv/opencv/build/lib -lopencv_imgproc -i/var/opencv/opencv/build/lib
during compile process error:
bridge1.cpp: in function ‘jint java_bridge1_bridgefunction(jnienv*, jobject)’: bridge1.cpp:8:12: warning: unused variable ‘img’ [-wunused-variable] iplimage *img = cvcreateimage( cvsize( 640, 480 ), ipl_depth_8u, 1 ); ^ /tmp/ccqbvddx.o: in function `java_bridge1_bridgefunction': bridge1.cpp:(.text+0x63): undefined reference `cvcreateimage' collect2: error: ld returned 1 exit status
you need link shared object required "-l..." options, if compiling normal c/c++ executable run same function.
you should see libraries needed if "ldd libbridge1.so". if don't see needed libraries, need add them link step.