Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilation error: use of undeclared identifier (macosx) #799

Closed
ghost opened this issue Oct 4, 2019 · 19 comments
Closed

compilation error: use of undeclared identifier (macosx) #799

ghost opened this issue Oct 4, 2019 · 19 comments

Comments

@ghost
Copy link

ghost commented Oct 4, 2019

Hi.
I followed the build instruction https://github.com/bytedeco/javacpp-presets/wiki/Build-Environments, but still got compilation error like below.
Please share if any additional suggestion. Appreciate that.

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] JavaCPP Presets 1.5.2-SNAPSHOT ..................... SUCCESS [ 0.716 s]
[INFO] JavaCPP Presets for OpenBLAS 0.3.7-1.5.2-SNAPSHOT .. SUCCESS [10:37 min]
[INFO] JavaCPP Presets for OpenCV 4.1.1-1.5.2-SNAPSHOT .... SUCCESS [13:48 min]
[INFO] JavaCPP Presets for FFmpeg 4.2.1-1.5.2-SNAPSHOT .... SUCCESS [18:06 min]
[INFO] JavaCPP Presets for FlyCapture 2.13.3.31-1.5.2-SNAPSHOT FAILURE [ 1.119 s]

/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:294:99: error: use of undeclared identifier
'MultiSyncLibrary'
static void JavaCPP_org_bytedeco_flycapture_FlyCapture2_SyncManager_deallocate(void p) { delete (MultiSyncLibrary::SyncManager)p; }
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:294:129: error: expected expression
static void JavaCPP_org_bytedeco_flycapture_FlyCapture2_SyncManager_deallocate(void p) { delete (MultiSyncLibrary::SyncManager)p; }
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:295:106: error: use of undeclared identifier
'MultiSyncLibrary'
static void JavaCPP_org_bytedeco_flycapture_FlyCapture2_SyncManager_deallocateArray(void* p) { delete[] (MultiSyncLibrary::SyncManager*)p; }
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:295:136: error: expected expression
static void JavaCPP_org_bytedeco_flycapture_FlyCapture2_SyncManager_deallocateArray(void* p) { delete[] (MultiSyncLibrary::SyncManager*)p; }
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:314:18: error: use of undeclared identifier
'MultiSyncLibrary'
{ sizeof(MultiSyncLibrary::SyncManager) },
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:445:9: error: use of undeclared identifier
'MultiSyncLibrary'
MultiSyncLibrary::SyncManager* rptr = new MultiSyncLibrary::SyncManager[arg0];
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:445:51: error: use of undeclared identifier
'MultiSyncLibrary'
MultiSyncLibrary::SyncManager* rptr = new MultiSyncLibrary::SyncManager[arg0];
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:457:5: error: use of undeclared identifier
'MultiSyncLibrary'
MultiSyncLibrary::SyncManager* ptr = (MultiSyncLibrary::SyncManager*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID));
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:457:43: error: use of undeclared identifier
'MultiSyncLibrary'
MultiSyncLibrary::SyncManager* ptr = (MultiSyncLibrary::SyncManager*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID));
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:457:73: error: expected expression
MultiSyncLibrary::SyncManager* ptr = (MultiSyncLibrary::SyncManager*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID));
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:467:9: error: use of undeclared identifier
'MultiSyncLibrary'
MultiSyncLibrary::PGRSyncError rval = (MultiSyncLibrary::PGRSyncError)ptr->RescanMasterTimingBus();
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:467:48: error: use of undeclared identifier
'MultiSyncLibrary'
MultiSyncLibrary::PGRSyncError rval = (MultiSyncLibrary::PGRSyncError)ptr->RescanMasterTimingBus();
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:479:5: error: use of undeclared identifier
'MultiSyncLibrary'
MultiSyncLibrary::SyncManager* ptr = (MultiSyncLibrary::SyncManager*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID));
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:479:43: error: use of undeclared identifier
'MultiSyncLibrary'
MultiSyncLibrary::SyncManager* ptr = (MultiSyncLibrary::SyncManager*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID));
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:479:73: error: expected expression
MultiSyncLibrary::SyncManager* ptr = (MultiSyncLibrary::SyncManager*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID));
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:489:9: error: use of undeclared identifier
'MultiSyncLibrary'
MultiSyncLibrary::PGRSyncMessage rval = (MultiSyncLibrary::PGRSyncMessage)ptr->GetSyncStatus();
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:489:50: error: use of undeclared identifier
'MultiSyncLibrary'
MultiSyncLibrary::PGRSyncMessage rval = (MultiSyncLibrary::PGRSyncMessage)ptr->GetSyncStatus();
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:501:5: error: use of undeclared identifier
'MultiSyncLibrary'
MultiSyncLibrary::SyncManager* ptr = (MultiSyncLibrary::SyncManager*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID));
^
/Users/my/javacpp-presets/flycapture/target/native/org/bytedeco/flycapture/macosx-x86_64/jniFlyCapture2.cpp:501:43: error: use of undeclared identifier
'MultiSyncLibrary'
MultiSyncLibrary::SyncManager* ptr = (MultiSyncLibrary::SyncManager*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID));
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]

btw, since there is no ngraph for macosx https://repo1.maven.org/maven2/org/bytedeco/ngraph/0.22.0-1.5.1/, it is required to compile the native libraries manually for macosx. Is there any suggestion to build only ngraph project from Mac OS?

Below is what I tried to build single sub project "ngraph". With modification in ngraph/cppbuild.sh

53 #cp onnx/bin/libonnxifi.so ../lib/
54 cp onnx/bin/libonnxifi.dylib ../lib/

I got below error:

/Users/my/javacpp-presets/ngraph/target/native/org/bytedeco/ngraph/macosx-x86_64/jningraph.cpp:3023:58: error: cannot initialize a parameter of type
'::onnxBackendID *' (aka 'void ') with an lvalue of type 'void '
ngraph::onnxifi::BackendManager::get_backend_ids(ptr0, (std::size_t
)ptr1);
^~~~
/Users/my/javacpp-presets/ngraph/cppbuild/macosx-x86_64/include/ngraph/frontend/onnxifi/backend_manager.hpp:41:58: note: passing argument to parameter 'backend_ids'
here
static void get_backend_ids(::onnxBackendID
backend_ids, std::size_t
count)

@saudet
Copy link
Member

saudet commented Oct 4, 2019 via email

@ghost
Copy link
Author

ghost commented Oct 4, 2019

@saudet very appreciate your reply. Apart from "FlyCapture", is nGraph supported on Mac OSX?

@saudet
Copy link
Member

saudet commented Oct 4, 2019 via email

@ghost
Copy link
Author

ghost commented Oct 4, 2019

Thanks for the information. :D

@EmergentOrder
Copy link
Member

EmergentOrder commented Oct 9, 2019

Sorry, I can't / don't proactively support Mac (or Windows for that matter), I only have a Linux box.

@EmergentOrder EmergentOrder removed their assignment Oct 9, 2019
@saudet
Copy link
Member

saudet commented Oct 9, 2019 via email

@saudet
Copy link
Member

saudet commented Oct 13, 2019

Ok, it's done! Let me know if you encounter any issues with the snapshots: http://bytedeco.org/builds/

@ghost
Copy link
Author

ghost commented Oct 16, 2019

@saudet: Thanks for the information. Since nGraph needs mkl-dnn to be compiled first, I got the errors while doing the compilation in mkl-dnn sub project. ps. I am using macOS Catalina

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:443:34: error: expected initializer before '__OSX_AVAILABLE_STARTING'

and

/Users/my/javacpp-presets-master/mkl-dnn/cppbuild/macosx-x86_64/mkl-dnn-0.21.1/src/cpu/xbyak/xbyak.h:317:12: error: 'posix_memalign' was not declared in this scope

@saudet
Copy link
Member

saudet commented Oct 16, 2019 via email

@ghost
Copy link
Author

ghost commented Oct 17, 2019

I was experiencing that the pre-compiled nd4j related *.dylib was loaded without problem to macOS Mojave but is loaded with exception in macOS Catalina. So I would like to try compiling from my latest OS. Btw, I could also try the pre-compiled nGraph. Will update my status once I got it work. Really appreciate your help.

@saudet
Copy link
Member

saudet commented Oct 18, 2019

Ok, I see. Both nGraph and MKL-DNN have been upgraded yesterday, so please try again!

@ghost
Copy link
Author

ghost commented Oct 22, 2019

Hi,

I am able to compile ngraph project latest source code (pull from master on Oct21, 2019) by the command: mvn clean install -rf :ngraph -U which downloads pre-compiled jar if any prerequisite dependencies.
OS: MacOS Catalina 10.15
Xcode: 11.1

But the latest version of ngraph platform ngraph-platform 0.26.0-1.5.2-SNAPSHOT cannot load CPU backend. The output stuck at loading cpu backend... with below sample code from https://github.com/bytedeco/javacpp-presets/blob/master/ngraph/README.md
System.out.println("loading cpu backend...");
Backend backend = Backend.create("CPU");
Shape shape = new Shape(new SizeTVector(1, 2));
System.out.println("creating input tensor...");
Tensor input = backend.create_tensor(org.bytedeco.ngraph.global.ngraph.f32(), shape);

@saudet
Copy link
Member

saudet commented Oct 22, 2019

If you set the "org.bytedeco.javacpp.logger.debug" system property to "true", do you get anything more on the console?

@ghost
Copy link
Author

ghost commented Oct 22, 2019

Here is the result with debug on -Dorg.bytedeco.javacpp.logger.debug=true

loading cpu backend...
Loading class org.bytedeco.ngraph.global.ngraph
Loading class org.bytedeco.ngraph.global.ngraph
Loading /Users/my/.javacpp/cache/mkl-dnn-0.21.2-1.5.2-SNAPSHOT-macosx-x86_64.jar/org/bytedeco/mkldnn/macosx-x86_64/libiomp5.dylib
Loading /Users/my/.javacpp/cache/mkl-dnn-0.21.2-1.5.2-SNAPSHOT-macosx-x86_64.jar/org/bytedeco/mkldnn/macosx-x86_64/libmklml.dylib
Loading library mklml_intel
Failed to load for mklml_intel: java.lang.UnsatisfiedLinkError: no mklml_intel in java.library.path
Loading /Users/my/.javacpp/cache/ngraph-0.26.0-1.5.2-SNAPSHOT-macosx-x86_64.jar/org/bytedeco/ngraph/macosx-x86_64/libmkldnn.dylib
Loading /Users/my/.javacpp/cache/ngraph-0.26.0-1.5.2-SNAPSHOT-macosx-x86_64.jar/org/bytedeco/ngraph/macosx-x86_64/libncurses.6.dylib
Loading /Users/my/.javacpp/cache/ngraph-0.26.0-1.5.2-SNAPSHOT-macosx-x86_64.jar/org/bytedeco/ngraph/macosx-x86_64/libonnxifi.dylib
Loading /Users/my/.javacpp/cache/ngraph-0.26.0-1.5.2-SNAPSHOT-macosx-x86_64.jar/org/bytedeco/ngraph/macosx-x86_64/libngraph.dylib

@saudet
Copy link
Member

saudet commented Oct 22, 2019 via email

@ghost
Copy link
Author

ghost commented Oct 30, 2019

Sorry for late reply. I hope I knew how to enable the debug mode for nGraph.

Also, I notice the similar situation while trying to run sample code under onnxruntime sub project. https://github.com/bytedeco/javacpp-presets/blob/master/onnxruntime/README.md

Loading class org.bytedeco.onnxruntime.global.onnxruntime
Loading /Users/my/.javacpp/cache/mkl-dnn-0.21.2-1.5.2-SNAPSHOT-macosx-x86_64.jar/org/bytedeco/mkldnn/macosx-x86_64/libiomp5.dylib
Loading /Users/my/.javacpp/cache/mkl-dnn-0.21.2-1.5.2-SNAPSHOT-macosx-x86_64.jar/org/bytedeco/mkldnn/macosx-x86_64/libmklml.dylib
Loading library mklml_intel
Failed to load for mklml_intel: java.lang.UnsatisfiedLinkError: no mklml_intel in java.library.path
Loading /Users/my/.javacpp/cache/mkl-dnn-0.21.2-1.5.2-SNAPSHOT-macosx-x86_64.jar/org/bytedeco/mkldnn/macosx-x86_64/libmkldnn.0.dylib
Loading /Users/my/.javacpp/cache/onnxruntime-0.5.0-1.5.2-SNAPSHOT-macosx-x86_64.jar/org/bytedeco/onnxruntime/macosx-x86_64/libonnxruntime.0.5.0.dylib
Loading /Users/my/.javacpp/cache/onnxruntime-0.5.0-1.5.2-SNAPSHOT-macosx-x86_64.jar/org/bytedeco/onnxruntime/macosx-x86_64/libjnionnxruntime.dylib
Using Onnxruntime C API
2019-10-30 10:26:55.889463 [W:onnxruntime:test, model.cc:114 Model] ONNX Runtime only *guarantees* support for models stamped with opset version 7 or above for opset domain 'ai.onnx'. Please upgrade your model to opset 7 or higher. For now, this opset 6 model may run depending upon legacy support of some older opset version operators.
Registering org.bytedeco.javacpp.SizeTPointer[address=0x7fc524e69ee0,position=0,limit=1,capacity=1,deallocator=org.bytedeco.javacpp.Pointer$NativeDeallocator[ownerAddress=0x7fc524e69ee0,deallocatorAddress=0x13d0de7c0]]
Loading class org.bytedeco.onnxruntime.global.onnxruntime
Loading class org.bytedeco.onnxruntime.OrtAllocator
Loading library mklml_intel
Failed to load for mklml_intel: java.lang.UnsatisfiedLinkError: no mklml_intel in java.library.path
Registering org.bytedeco.onnxruntime.OrtAllocator[address=0x7fc524e36010,position=0,limit=1,capacity=1,deallocator=org.bytedeco.javacpp.Pointer$NativeDeallocator[ownerAddress=0x7fc524e36010,deallocatorAddress=0x13d0b7a10]]
Registering org.bytedeco.javacpp.PointerPointer[address=0x7fc524e32650,position=0,limit=1,capacity=1,deallocator=org.bytedeco.javacpp.Pointer$NativeDeallocator[ownerAddress=0x7fc524e32650,deallocatorAddress=0x13d0de270]]
Number of inputs = 1
Input 0 : name=x
Input 0 : type=1
Registering org.bytedeco.javacpp.SizeTPointer[address=0x7fc524e6aaa0,position=0,limit=1,capacity=1,deallocator=org.bytedeco.javacpp.Pointer$NativeDeallocator[ownerAddress=0x7fc524e6aaa0,deallocatorAddress=0x13d0de7c0]]
Input 0 : num_dims=2
Registering org.bytedeco.javacpp.LongPointer[address=0x7fc524e6aac0,position=0,limit=2,capacity=2,deallocator=org.bytedeco.javacpp.Pointer$NativeDeallocator[ownerAddress=0x7fc524e6aac0,deallocatorAddress=0x13d0dd160]]
Input 0 : dim 0=1
Input 0 : dim 1=2
Registering org.bytedeco.javacpp.FloatPointer[address=0x7fc5181d0000,position=0,limit=150528,capacity=150528,deallocator=org.bytedeco.javacpp.Pointer$NativeDeallocator[ownerAddress=0x7fc5181d0000,deallocatorAddress=0x13d0dd4d0]]
Registering org.bytedeco.javacpp.PointerPointer[address=0x7fc524e6a790,position=0,limit=1,capacity=1,deallocator=org.bytedeco.javacpp.Pointer$NativeDeallocator[ownerAddress=0x7fc524e6a790,deallocatorAddress=0x13d0de270]]
Registering org.bytedeco.javacpp.BytePointer[address=0x7fc524e6a880,position=0,limit=13,capacity=13,deallocator=org.bytedeco.javacpp.Pointer$NativeDeallocator[ownerAddress=0x7fc524e6a880,deallocatorAddress=0x13d0dc0d0]]
Registering org.bytedeco.javacpp.PointerPointer[address=0x7fc4c4c22fc0,position=0,limit=1,capacity=1,deallocator=org.bytedeco.javacpp.Pointer$NativeDeallocator[ownerAddress=0x7fc4c4c22fc0,deallocatorAddress=0x13d0de270]]
Registering org.bytedeco.javacpp.PointerPointer[address=0x7fc4c4c16e20,position=0,limit=1,capacity=1,deallocator=org.bytedeco.javacpp.Pointer$NativeDeallocator[ownerAddress=0x7fc4c4c16e20,deallocatorAddress=0x13d0de270]]
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000013c8eef51, pid=72049, tid=0x0000000000001103
#
# JRE version: Java(TM) SE Runtime Environment (8.0_221-b11) (build 1.8.0_221-b11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.221-b11 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libonnxruntime.0.5.0.dylib+0x36f51]  OrtRun+0xd21
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/my/Workspace/test-javacpp-onnx/hs_err_pid72049.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

@saudet
Copy link
Member

saudet commented Oct 31, 2019

ONNX Runtime appears to have issues running under the JVM, yes, but that's probably not related.

For nGraph, it looks like we can get more information by setting the NGRAPH_CPU_DEBUG_TRACER environment variable to 1:
https://github.com/NervanaSystems/ngraph/blob/master/doc/sphinx/source/frameworks/other.rst

@saudet
Copy link
Member

saudet commented Nov 6, 2019

In any case, working binaries for at least nGraph have been released with version 1.5.2. Enjoy!

@saudet saudet closed this as completed Nov 6, 2019
@saudet
Copy link
Member

saudet commented Dec 1, 2019

ONNX Runtime 1.0.0 is also running fine now:
https://github.com/bytedeco/javacpp-presets/tree/master/onnxruntime/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants