If I run JNAerator using the header for my library, the process gobbles processor time and never seems to finish - after first issuing warnings:
adrian$ java -Xmx128m -jar ~/JNAerator/jnaerator/target/jnaerator-0.13-SNAPSHOT-shaded.jar /Users/adrian/DRAMSim2/DRAMSim.h -mode StandaloneJar
Warning: no -library option for file 'DRAMSim.h', using "DRAMSim".
Auto-configuring parser...
Parsing native headers...
/usr/include/sys/cdefs.h:74:25: warning: #warning "Unsupported compiler detected"
/usr/include/_types/_wctype_t.h:30:19: warning: No newline before end of file
So, I have also tried the -ScanSymbols option:
java -Xmx128m -jar ~/JNAerator/jnaerator/target/jnaerator-0.13-SNAPSHOT-shaded.jar -scanSymbols -mode StandaloneJar
Auto-configuring parser...
Parsing native headers...
Normalizing parsed code...
Generating libraries...
Compiling JNAerated files...
[....]
Copying runtime classes...
Generating out.jar
#
# SUCCESS: JNAeration completed !
# Output mode is 'StandaloneJar(JAR with bindings and runtime dependencies)
#
# => '/Users/adrian/groovy/simul/src/simul/./out.jar'
And out.jar has a great many .class files but no .java and I have no idea how to use it.
Using -noComp -noJar as suggested in the wiki generates no output at all ...
adrian$ java -Xmx128m -jar ~/JNAerator/jnaerator/target/jnaerator-0.13-SNAPSHOT-shaded.jar -scanSymbols -noComp -noJar
WARNING: option (?i)-noComp is deprecated and might be removed in future versions.
WARNING: option (?i)-noJar is deprecated and might be removed in future versions.
WARNING: legacy options (?i)-noJar and (?i)-noComp used, defaulting -mode to Directory
Auto-configuring parser...
Parsing native headers...
Normalizing parsed code...
Generating libraries...
#
# SUCCESS: JNAeration completed !
# Output mode is 'Directory(Bindings sources in simple file hierarchy)
#
# => '/Users/adrian/groovy/simul/src/simul/.'
What am I doing wrong? Or is this a hopeless case?
Related
Trying to call "make" on Apache Mesos, after fixing some other javadocs related issues, this is what i'm currently getting.
Anyone ran into the same issues?
Here is the trace:
/Library/Java/JavaVirtualMachines/openjdk-12.0.2.jdk/Contents/Home/bin/javac -h java/jni \
-classpath java/target/mesos-1.10.0.jar:/Users/hanshenriksande/Master/mesos/build/src/java/target/protobuf-java-3.5.0.jar \
../../src/java/src/org/apache/mesos/MesosExecutorDriver.java
Note: ../../src/java/src/org/apache/mesos/MesosExecutorDriver.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
An exception has occurred in the compiler (12.0.2). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for com.google.protobuf.GeneratedMessageV3 not found
make[1]: *** [java/jni/org_apache_mesos_MesosExecutorDriver.h] Error 4
make: *** [all-recursive] Error 1
Do you need java bindings for Mesos? If not then run --disable-java and --disable-python see auto tools options.
If you need this bindings then you need to downgrade your JVM to 7 or 8. Follow these instructions
I created a new Android Studio Project with C++ support and did not add anything to it. The project builds, compiles and runs with CMake. I then added the following two lines of code to CMakeLists.txt at the bottom of the file and I get a CMake build error.
find_package(Java COMPONENTS Development) # Line 47
find_package(JNI REQUIRED) # Line 48
And this is the error I get when building the project
-- Found Java: /usr/lib/jvm/java-10-oracle/bin/java (found version "10.0.1") found components: Development
-- Configuring incomplete, errors occurred!
CMake Error at /home/xxxxx/Android/Sdk/cmake/3.6.4111459/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
See also "/home/xxxxx/AndroidStudioProjects/MyApplication/app/.externalNativeBuild/cmake/release/x86_64/CMakeFiles/CMakeOutput.log".
JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
Call Stack (most recent call first):
/home/xxxxxx/Android/Sdk/cmake/3.6.4111459/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
/home/xxxxxx/Android/Sdk/cmake/3.6.4111459/share/cmake-3.6/Modules/FindJNI.cmake:314 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:48 (find_package)
External native generate JSON release: JSON generation completed with problems
CMake runs when being called form the command line, but fails inside Android Studio for some reason and I am not sure why.
EDIT 1
Here is the CMakeOutput.log file
EDIT 2
This is all that is in CMakeLists.txt file. It compiles in cmd with the command cmake.
cmake_minimum_required(VERSION 3.4.1)
find_package(Java COMPONENTS Development)
find_package(JNI REQUIRED)
This is the cmd output
E:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\build>cmake ..
-- Configuring done
-- Generating done
-- Build files have been written to: E:/Users/xxxxx/AndroidStudioProjects/MyApplication/app/build
When I try to add it compile it in Android Studio using gradle I get the following error on Windows 10 pro 64 bit
Microsoft Windows [Version 10.0.17134.112]
(c) 2018 Microsoft Corporation. All rights reserved.
E:\Users\xxxxx\AndroidStudioProjects\MyApplication>gradlew build --stacktrace
> Task :app:generateJsonModelDebug
External native generate JSON debug: starting JSON generation
External native generate JSON debug: using platform version 24 for ABI ARMEABI_V7A and min SDK version 24
External native generate JSON debug: noticing that build file 'E:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\CMakeLists.txt' is out of date with respect to E:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\.extern
alNativeBuild\cmake\debug\armeabi-v7a\android_gradle_build.json
External native generate JSON debug: rebuilding JSON E:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\.externalNativeBuild\cmake\debug\armeabi-v7a\android_gradle_build.json due to:
External native generate JSON debug: - a dependent build file changed
External native generate JSON debug: keeping json folder 'E:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\.externalNativeBuild\cmake\debug\armeabi-v7a' but regenerating project
External native generate JSON debug: executing cmake Executable : E:\Android\SDK\cmake\3.6.4111459\bin\cmake.exe
arguments :
-HE:\Users\xxxxx\AndroidStudioProjects\MyApplication\app
-BE:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\.externalNativeBuild\cmake\debug\armeabi-v7a
-DANDROID_ABI=armeabi-v7a
-DANDROID_PLATFORM=android-24
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=E:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\build\intermediates\cmake\debug\obj\armeabi-v7a
-DCMAKE_BUILD_TYPE=Debug
-DANDROID_NDK=E:\Android\SDK\ndk-bundle
-DCMAKE_CXX_FLAGS=
-DCMAKE_TOOLCHAIN_FILE=E:\Android\SDK\ndk-bundle\build\cmake\android.toolchain.cmake
-DCMAKE_MAKE_PROGRAM=E:\Android\SDK\cmake\3.6.4111459\bin\ninja.exe
-GAndroid Gradle - Ninja
jvmArgs :
CMake Error at E:/Android/SDK/cmake/3.6.4111459/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
Call Stack (most recent call first):
E:/Android/SDK/cmake/3.6.4111459/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
E:/Android/SDK/cmake/3.6.4111459/share/cmake-3.6/Modules/FindJNI.cmake:314 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:4 (find_package)
-- Configuring incomplete, errors occurred!
See also "E:/Users/xxxxx/AndroidStudioProjects/MyApplication/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log".
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
Solved with
sudo apt-get install -y openjdk-8-jdk
sudo apt-get install -y default-jdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
As the CMake version bundled with Android tries to tell you, it can't find the JNI package because some parts were missing:
missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH
Checking the documentation for FindJNI (https://cmake.org/cmake/help/latest/module/FindJNI.html) these variables are set to the locations of libraries and headers not shipped with the Android version of JNI (to little surprise, Android does not included the AWT library for instance).
When running find_package(JNI REQUIRED), the FindJNI code checks if these variables are set and if not, issues an error.
A workaround is to set these variables yourself, before calling find_package:
# We are only interested in finding jni.h: we do not care about extended JVM
# functionality or the AWT library.
set(JAVA_AWT_LIBRARY NotNeeded)
set(JAVA_JVM_LIBRARY NotNeeded)
set(JAVA_INCLUDE_PATH2 NotNeeded)
set(JAVA_AWT_INCLUDE_PATH NotNeeded)
find_package(JNI REQUIRED)
Be aware though, that your code will only be able to use jni.h and its functionality: if it tries to access any other part of the JNI package it will fail (probably at compile time) because essentially, you have tricked CMake into thinking that the entire package was found, when in reality only a part of it exists in the Android setup.
I found a solution that works for me:
cmake_minimum_required(VERSION 3.10)
project("ktaglib")
set(JAVA_AWT_LIBRARY "$ENV{JAVA_HOME}/lib/libjawt.so")
set(JAVA_JVM_LIBRARY "$ENV{JAVA_HOME}/lib/server/libjvm.so")
set(JAVA_INCLUDE_PATH "$ENV{JAVA_HOME}/include")
set(JAVA_INCLUDE_PATH2 "$ENV{JAVA_HOME}/include/linux")
set(JAVA_AWT_INCLUDE_PATH "$ENV{JAVA_HOME}/include")
find_package(JNI REQUIRED)
You must set the environment variable JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64" beforehand.
More info: https://github.com/dockcross/dockcross/issues/576
Same on alpine:edge docker image, fixed using:
ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
RUN apk add --no-cache openjdk8
ref: https://pkgs.alpinelinux.org/contents?branch=edge&name=openjdk8&arch=x86_64&repo=community
My environment is
CentOS 7;
Spark 1.6.1;
Hadoop 2.6.4; and I have two slave-node in a cluster mode.
When I tried hadoop command, I got WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform… using builtin-java classes where applicable
And I check hadoop checknative -a, I got all false responses. Part of this problem is solved when I add
export HADOOP_COMMON_LIB_NATIVE_DIR=${HADOOP_HOME}/lib/native
export HADOOP_OPTS="-Djava.library.path=${HADOOP_HOME}/lib/native/"
in hadoop-env.sh and reinstall openssl-devel.
However, I still got warning when I type hadoop checknative -a:
[hadoop#host-10-174-101-17 ~]$ hadoop checknative -a
16/07/13 14:36:24 WARN bzip2.Bzip2Factory: Failed to load/initialize native-bzip2 library system-native, will use pure-Java version
16/07/13 14:36:24 INFO zlib.ZlibFactory: Successfully loaded & initialized native-zlib library
Native library checking:
hadoop: true /usr/local/hadoop/lib/native/libhadoop.so.1.0.0
zlib: true /lib64/libz.so.1
snappy: true /lib64/libsnappy.so.1
lz4: true revision:99
bzip2: false
openssl: true /lib64/libcrypto.so
16/07/13 14:36:24 INFO util.ExitUtil: Exiting with status 1
I reinstalled bizp2 and I check bzip2 --version:
[hadoop#host-10-174-101-17 ~]$ bzip2 --version
bzip2, a block-sorting file compressor. Version 1.0.6, 6-Sept-2010.
Copyright (C) 1996-2010 by Julian Seward.
This program is free software; you can redistribute it and/or modify
it under the terms set out in the LICENSE file, which is included
in the bzip2-1.0.6 source distribution.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
LICENSE file for more details.
bzip2: I won't write compressed data to a terminal.
bzip2: For help, type: `bzip2 --help'.
What's more, I check dictionary ~/lib64/, both libbz2.so.1 and libbz2.so exist, it's said that if bzip2 is well loaded, this should be the path.
It seems that bzip2 is well installed, but hadoop cannot load it.
I also tried to recompile as https://issues.apache.org/jira/browse/HADOOP-10409 mentioned.
If I follow exactly as it, it doesn't work:
[hadoop#host-10-174-101-17 ~]$ strings /export/apps/hadoop/latest/lib/native/libhadoop.so | grep initIDs
strings: '/export/apps/hadoop/latest/lib/native/libhadoop.so': No such file
If I change path to my path of hadoop: /usr/local/hadoop/lib/native/libhadoop.so, this is what it got:
[hadoop#host-10-174-101-17 ~]$ strings /usr/local/hadoop/lib/native/libhadoop.so | grep initIDs
Java_org_apache_hadoop_io_compress_lz4_Lz4Compressor_initIDs
Java_org_apache_hadoop_io_compress_lz4_Lz4Decompressor_initIDs
Java_org_apache_hadoop_io_compress_snappy_SnappyCompressor_initIDs
Java_org_apache_hadoop_io_compress_snappy_SnappyDecompressor_initIDs
Java_org_apache_hadoop_crypto_OpensslCipher_initIDs
Java_org_apache_hadoop_io_compress_zlib_ZlibCompressor_initIDs
Java_org_apache_hadoop_io_compress_zlib_ZlibDecompressor_initIDs
Java_org_apache_hadoop_io_compress_lz4_Lz4Compressor_initIDs
Java_org_apache_hadoop_io_compress_lz4_Lz4Decompressor_initIDs
Java_org_apache_hadoop_io_compress_snappy_SnappyCompressor_initIDs
Java_org_apache_hadoop_io_compress_snappy_SnappyDecompressor_initIDs
Java_org_apache_hadoop_crypto_OpensslCipher_initIDs
Java_org_apache_hadoop_io_compress_zlib_ZlibCompressor_initIDs
Java_org_apache_hadoop_io_compress_zlib_ZlibDecompressor_initIDs
Java_org_apache_hadoop_io_compress_lz4_Lz4Decompressor_initIDs
Java_org_apache_hadoop_io_compress_lz4_Lz4Compressor_initIDs
Java_org_apache_hadoop_io_compress_zlib_ZlibDecompressor_initIDs
Java_org_apache_hadoop_io_compress_snappy_SnappyCompressor_initIDs
Java_org_apache_hadoop_io_compress_snappy_SnappyDecompressor_initIDs
Java_org_apache_hadoop_io_compress_zlib_ZlibCompressor_initIDs
Java_org_apache_hadoop_crypto_OpensslCipher_initIDs
Though, I check hadoop checknative -a, still it doesn't work.
What can I do in this situation? Thank you very much.
I get this error when I used the URL
http://www.webservicex.net/geoipservice.asmx?WSDL
C:\Program Files (x86)\Java\jdk1.6.0_18\bin>wsimport **<URL>**
parsing WSDL...
[WARNING] Ignoring SOAP port "GeoIPServiceSoap12": it uses non-standard SOAP 1.2
binding.
You must specify the "-extension" option to use this binding.
line 197 of **<URL>**
[WARNING] ignoring port "GeoIPServiceHttpGet": no SOAP address specified. try ru
nning wsimport with -extension switch.
line 200 of **<URL>**
[WARNING] ignoring port "GeoIPServiceHttpPost": no SOAP address specified. try r
unning wsimport with -extension switch.
line 203 of **<URL>**
generating code...
**[ERROR] .\net\webservicex\GeoIP.java (The system cannot find the path specified)**
C:\Program Files (x86)\Java\jdk1.6.0_18\bin>
This error suggests the compiler needs GeoIP.java in order to progress - which should (technically) be given by your WSDL. I had this error, and it was because I did not have permissions to write to the directory (in this case, you're writing to C:\Program Files (x86)\Java\jdk1.6.0_18\bin - simple test would just be to try and run mkdir TEST in this directory) so GeoIP (for example) could not be written.
Specify a directory using the -d switch or change your working directory to one where you have permissions.
This error is coming because of permission issue.
C:\Program Files\Java\jdk1.8.0_65\bin> mkdir test
Access is denied.
Try using another directory to place generated files.
wsimport [options] < WSDL_URL > -d <directory>
specifies where to place generated output files
E:\sei is the directory, i am using to place output class files.
C:\Program Files\Java\jdk1.8.0_65\bin> wsimport -d E:\sei http://www.webservicex.net/geoipservice.asmx?wsdl
In case http://www.webservicex.net/geoipservice.asmx?WSDL is not responding, use http://wsgeoip.lavasoft.com/ipservice.asmx?WSDL instead.
I have this warning:
warning: Supported source version 'RELEASE_6' from annotation processor
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor' less than -source
'1.7'
Note: Creating non-static metadata factory ...
Note: Found Option : eclipselink.canonicalmodel.use_static_factory, with value: false
Note: Optional file was not found: META-INF/orm.xml continuing with generation.
Note: Optional file was not found: META-INF/eclipselink-orm.xml continuing with
generation.
Note: Found Option : eclipselink.canonicalmodel.use_static_factory, with value: false
Note: Optional file was not found: META-INF/orm.xml continuing with generation.
Note: Optional file was not found: META-INF/eclipselink-orm.xml continuing with
generation.
warning: The following options were not recognized by any processor:
'[eclipselink.canonicalmodel.use_static_factory]'
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning
Copying 5 files to E:\NetBeansProjects\votaciones\build\classes
compile:
Created dir: E:\NetBeansProjects\votaciones\dist
Copying 1 file to E:\NetBeansProjects\votaciones\build
Copy libraries to E:\NetBeansProjects\votaciones\dist\lib.
Building jar: E:\NetBeansProjects\votaciones\dist\votaciones.jar
To run this application from the command line without Ant, try:
java -jar "E:\NetBeansProjects\votaciones\dist\votaciones.jar"
jar:
BUILD SUCCESSFUL (total time: 8 seconds)
what happen?
It says build was successful. The first warning is saying you use Java 7(1.7) where the source supports Java 6 (1.6). The second waring is a consequence of the first one. If your application works, i dont think there is any problem. If it doesnt work, try using java 1.6 or get the updated versions that support java 1.7.