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

Error building caffe: sun.reflect.annotation.TypeNotPresentExceptionProxy #154

Closed
Booley opened this issue Feb 18, 2016 · 16 comments
Closed
Labels

Comments

@Booley
Copy link

Booley commented Feb 18, 2016

I'm trying to build the Caffe presets on OSX following these steps:

git clone https://github.com/bytedeco/javacpp
cd javacpp
mvn clean
mvn install

git clone https://github.com/bytedeco/javacpp-presets
cd javacpp-presets

Then, enabled CPU_ONLY=1 for macosx build in ./caffe/cppbuild.sh (ln 30). After,

./cppbuild.sh install opencv
mvn -U install --projects .,opencv

./cppbuild.sh install caffe
mvn -U install --projects .,caffe -X

But the last command outputs a lot of warnings (not sure if they are relevant?) and a sun.reflect.annotation.TypeNotPresentExceptionProxy:

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:opencv:jar:3.1.0-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:opencv:3.1.0-${project.parent.version}, (directory)/javacpp/javacpp-presets/opencv/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:ffmpeg:jar:2.8.5-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:ffmpeg:2.8.5-${project.parent.version}, (directory)/javacpp/javacpp-presets/ffmpeg/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:flycapture:jar:2.8.3.1-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:flycapture:2.8.3.1-${project.parent.version}, (directory)/javacpp/javacpp-presets/flycapture/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:libdc1394:jar:2.2.4-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:libdc1394:2.2.4-${project.parent.version}, (directory)/javacpp/javacpp-presets/libdc1394/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:libfreenect:jar:0.5.3-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:libfreenect:0.5.3-${project.parent.version}, (directory)/javacpp/javacpp-presets/libfreenect/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:videoinput:jar:0.200-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:videoinput:0.200-${project.parent.version}, (directory)/javacpp/javacpp-presets/videoinput/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:artoolkitplus:jar:2.3.1-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:artoolkitplus:2.3.1-${project.parent.version}, (directory)/javacpp/javacpp-presets/artoolkitplus/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:chilitags:jar:master-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:chilitags:master-${project.parent.version}, (directory)/javacpp/javacpp-presets/chilitags/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:flandmark:jar:1.07-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:flandmark:1.07-${project.parent.version}, (directory)/javacpp/javacpp-presets/flandmark/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:fftw:jar:3.3.4-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:fftw:3.3.4-${project.parent.version}, (directory)/javacpp/javacpp-presets/fftw/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:gsl:jar:2.1-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:gsl:2.1-${project.parent.version}, (directory)/javacpp/javacpp-presets/gsl/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:llvm:jar:3.7.0-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:llvm:3.7.0-${project.parent.version}, (directory)/javacpp/javacpp-presets/llvm/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:leptonica:jar:1.72-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:leptonica:1.72-${project.parent.version}, (directory)/javacpp/javacpp-presets/leptonica/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:tesseract:jar:3.04-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:tesseract:3.04-${project.parent.version}, (directory)/javacpp/javacpp-presets/tesseract/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:caffe:jar:master-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:caffe:master-${project.parent.version}, (directory)/javacpp/javacpp-presets/caffe/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:cuda:jar:7.5-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:cuda:7.5-${project.parent.version}, (directory)/javacpp/javacpp-presets/cuda/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:tensorflow:jar:master-1.2-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:tensorflow:${tensorflow.version}-${project.parent.version}, (directory)/javacpp/javacpp-presets/tensorflow/pom.xml, line 14, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] Inspecting build with total of 2 modules...
[INFO] Not installing Nexus Staging features:
[INFO]  * Preexisting staging related goal bindings found in 2 modules.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] JavaCPP Presets
[INFO] JavaCPP Presets for Caffe
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building JavaCPP Presets 1.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-javadoc-plugin:2.10.3:jar (attach-javadocs) @ javacpp-presets ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ javacpp-presets ---
[INFO] Installing (directory)/javacpp/javacpp-presets/pom.xml to /var/root/.m2/repository/org/bytedeco/javacpp-presets/1.2-SNAPSHOT/javacpp-presets-1.2-SNAPSHOT.pom
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building JavaCPP Presets for Caffe master-1.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.7:resources (generate-sources) @ caffe ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory (directory)/javacpp/javacpp-presets/caffe/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (generate-sources) @ caffe ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- javacpp:1.2-SNAPSHOT:build (generate-sources) @ caffe ---
[ERROR] Failed to execute JavaCPP Builder: sun.reflect.annotation.TypeNotPresentExceptionProxy
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] JavaCPP Presets .................................... SUCCESS [  4.101 s]
[INFO] JavaCPP Presets for Caffe .......................... FAILURE [  1.512 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.784 s
[INFO] Finished at: 2016-02-18T11:27:31+00:00
[INFO] Final Memory: 18M/94M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.bytedeco:javacpp:1.2-SNAPSHOT:build (generate-sources) on project caffe: Failed to execute JavaCPP Builder: sun.reflect.annotation.TypeNotPresentExceptionProxy -> [Help 1]

Also, I found that this issue is almost identical to #97, the only difference being that I'm building on Mac instead of Linux.

Is there a way to build the presets for Mac using the CPU_ONLY option?

@saudet
Copy link
Member

saudet commented Feb 18, 2016

It just looks like there's conflicting classes on your class path. Make sure you didn't add anything to your class path.

Sure, we can modify cppbuild.sh and change that option.

@Booley
Copy link
Author

Booley commented Feb 18, 2016

I'm not seeing anything javacpp-related in my class path, but any hints on specific files/locations to be wary of (e.g. older versions of javacpp)? I've also tried mvn clean but no success.

@Booley
Copy link
Author

Booley commented Feb 18, 2016

I'm still sifting through my class path, but I noticed this in the debugged output:

...
[DEBUG] Importing foreign packages into class realm plugin>org.bytedeco:javacpp:1.2-SNAPSHOT
[DEBUG]   Imported:  < project>org.bytedeco:javacpp-presets:1.2-SNAPSHOT
[DEBUG] Populating class realm plugin>org.bytedeco:javacpp:1.2-SNAPSHOT
[DEBUG]   Included: org.bytedeco:javacpp:jar:1.2-SNAPSHOT
[DEBUG]   Included: javax.enterprise:cdi-api:jar:1.0
[DEBUG]   Included: javax.annotation:jsr250-api:jar:1.0
...

That space after the bracket in "< project>org.bytedeco:javacpp-presets..." looks strange. Should that be there? (I doubt this is causing the error, but I thought it looked curious and worth mentioning just in case.)

@Booley
Copy link
Author

Booley commented Feb 18, 2016

I'm also able to install the presets for OpenCV successfully, so I'm wondering if maybe the issue is Caffe-specific? I also deleted the bytedeco folder from both my /var/root/.m2/ and ~/.m2 directories and ran another install.

My machine does not have cuda installed, but I'll try to test the CPU_ONLY installation on a machine that does have it.

@saudet
Copy link
Member

saudet commented Feb 20, 2016

Could you try to remove the -U option? Maven might be picking outdated SNAPSHOT binaries from the server.

@Booley
Copy link
Author

Booley commented Feb 21, 2016

Ran another clean install without -U, but no luck. :(

@Booley
Copy link
Author

Booley commented Feb 24, 2016

After fixing the javacpp.jar build, I was able to build the caffe preset and get a new error:

In file included from (dir)/javacpp-presets/caffe/cppbuild/macosx-x86_64/include/caffe/util/math_functions.hpp:11:
/Users/bomoon/Documents/JavaCPP/javacpp-presets/caffe/cppbuild/macosx-x86_64/include/caffe/util/mkl_alternate.hpp:11:10: fatal error: 
      'cblas.h' file not found
#include <cblas.h>
         ^
1 error generated.

I tried brew install openblas and verified that cblas.h exists in /usr/local/opt/openblas/include, which is the directory referenced in line 54 of Makefile.config.example (BLAS_INCLUDE := $(shell brew --prefix openblas)/include). (This is all with the CPU_ONLY=1 option enabled.) Any hints on how I can get the build to pick up on cblas.h?

@Booley
Copy link
Author

Booley commented Feb 24, 2016

By the way, for posterity's sake, it seems that I can recreate the sun.reflect.annotation.TypeNotPresentExceptionProxy exception by doing a clean install without building opencv first; however, if I built opencv before caffe, then the missing cblas.h error occurs.

@saudet
Copy link
Member

saudet commented Feb 25, 2016

On Mac OS X, blas comes with Xcode:
https://github.com/bytedeco/javacpp-presets/blob/master/caffe/cppbuild.sh#L138
If for some reason Xcode doesn't install that on your machine, try to contact someone at Apple about that...

@Booley
Copy link
Author

Booley commented Feb 25, 2016

I'm cleaning/editing various parameters but no dice. I'm wondering if maybe I'd have better luck trying a different package by tinkering with the cppbuild.sh parameters. Would I be able to change the export BLAS=atlas option to export BLAS=open to use OpenBLAS? I still end up with the same error, so are there other parameters to edit?

@Booley
Copy link
Author

Booley commented Feb 26, 2016

I was able to build Caffe natively from the main site's instructions without any errors (and using the CPU_ONLY option). However, I'm not sure how to integrate it into the presets build in lieu of cppbuild.sh. I copied this folder over javacpp-presets/caffe/cppbuild/macosx-x86_64/caffe-master, then ran mvn install --projects .,caffe without running cppbuild.sh, but still came up with the missing cblas.h error. It looks like Caffe picks up on BLAS but the wrapper doesn't (maybe?). Is this the correct procedure for using natively built projects without cppbuild.sh?

@saudet
Copy link
Member

saudet commented Feb 26, 2016

If you don't want to use the Accelerate framework, and use something like OpenBLAS, you can of course modify the cppbuild.sh build file accordingly. That's perfectly fine.

@saudet
Copy link
Member

saudet commented Feb 27, 2016

Without using cppbuild.sh? Just make sure to copy all the required header and library files in the include and lib subdirectories respectively. That's all that the wrappers care about!

@saudet saudet closed this as completed Feb 27, 2016
saudet added a commit that referenced this issue Mar 4, 2016
 * Make OpenBLAS build for Caffe more generic (issue #154)
@saudet
Copy link
Member

saudet commented Mar 4, 2016

I've modified the cppbuild.sh script so that if we set BLAS=open, it should build it even on OS X! Thanks for giving me the idea :)

@Booley
Copy link
Author

Booley commented Mar 17, 2016

Ah this is a long time ago, but I thought to include this here on the slim chance someone comes across this with the same issue: the mvn clean install refused to find my OpenBLAS path, so I manually included it by running export CPATH=/usr/local/Cellar/openblas/0.2.15/include before doing the build, and it worked fine. I haven't tried running your new cppbuild.sh script yet, but I just wanted to mention this just in case someone finds it useful. Thanks! :)

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

No branches or pull requests

2 participants