Coder Social home page Coder Social logo

Comments (13)

coachwei avatar coachwei commented on August 26, 2024 1

I rebooted my machine and the cache issue went away. So now my build is successful!
Thanks @thatdatabaseguy.

from jpostal.

albarrentine avatar albarrentine commented on August 26, 2024

These are the relevant lines:

checking for /System/Library/Frameworks/JavaVM.framework/Versions/include/jni.h... no
configure: error: cannot find JDK header files

You'll need to find jni.h on your system and make sure it's on the C include path.

from jpostal.

coachwei avatar coachwei commented on August 26, 2024

It turns out that the build process is looking for the header file jni.h at /System/Library/Frameworks/JavaVM.framework/Versions/include/ directory, which doesn't exist on MacOS (Sierra). On Mac, the JDK installation has these files at /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/include/.

Is there a way to tell the build process to look for the header files in a different location?

from jpostal.

albarrentine avatar albarrentine commented on August 26, 2024

From configure.ac, you can set JNI_INCLUDE_DIRS and they'll be added to the C include flags.

I wrote libpostal and all its bindings on a Mac (still on El Capitan though), and this shouldn't be necessary if Java/JNI is installed through XCode (Apple Developer Tools).

from jpostal.

coachwei avatar coachwei commented on August 26, 2024

thanks @thatdatabaseguy ! Unfortunately Java/JNI wasn't installed through XCode for me...

I did set JNI_INCLUDE_DIRS to the right directory that contains jni.h in configure.ac. When i ran
./gradlew assemble

I saw the same error (can't find the jni.h). Do i need to run some other scripts for it to kick in?

(I did try to run autoconf, which generated an updated configure file that I can see with my updates to JNI_INCLUDE_DIRS. But still got the same error when running ./gradlew assemble)

from jpostal.

albarrentine avatar albarrentine commented on August 26, 2024

JNI_INCLUDE_DIRS is an environment variable, no need to modify configure.ac, just:

export JNI_INCLUDE_DIRS=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/include/
./gradlew assemble

If that doesn't work, I'd say overall this doesn't seem to be libpostal-related, and it's a non-standard install of Java, so Google is probably the best resource.

from jpostal.

coachwei avatar coachwei commented on August 26, 2024

Tried setting the variable JNI_INCLUDE_DIRS, and didn't work. Same error as before.

Don't think it is related to non-standard installation of Java. In newer version of Mac, the JDK documentation (including the .h files) was left out. For example, see:

http://stackoverflow.com/questions/9704376/how-to-install-java-native-development-headers-on-os-x-lion

Whenever you need to build JNI, you need to manually specify the jni.h file locations, see documentation from Apple website:

https://developer.apple.com/library/content/documentation/Java/Conceptual/Java14Development/05-CoreJavaAPIs/CoreJavaAPIs.html

(My java installation was fairly typical. When I ran into the jni.h issue, i went to Oracle.com, downloaded and installed JDK from there to see if it fixed the problem. It didn't).

My suspicion is that the JNI_INCLUDE_DIRS variables are not being passed to gcc compiler for some reason. Is there a place that we can add the jni.h path to gcc compiler directly?

from jpostal.

albarrentine avatar albarrentine commented on August 26, 2024

Normally you would have to specify the JNI include dir, but we use an autoconf macro that's supposed to checks most common locations for you. I just upgraded the macro to the latest version from GNU, so try pulling from master and seeing if that fixes it.

from jpostal.

coachwei avatar coachwei commented on August 26, 2024

@thatdatabaseguy the upgrade DID the magic. the error went away. I didn't even have to bother with setting JNI_INCLUDE_DIRS variable.

However, towards the later part of the build process (install), i got the following error:

libtool: install: ranlib /Volumes/Data/MyProjects/xcode/jlibpostal/src/main/jniLibs/libjpostal_parser.a
libtool: install: /usr/bin/install -c .libs/libjpostal_expander.a /Volumes/Data/MyProjects/xcode/jlibpostal/src/main/jniLibs/libjpostal_expander.a
libtool: install: chmod 644 /Volumes/Data/MyProjects/xcode/jlibpostal/src/main/jniLibs/libjpostal_expander.a
libtool: install: ranlib /Volumes/Data/MyProjects/xcode/jlibpostal/src/main/jniLibs/libjpostal_expander.a
make[2]: Nothing to be done for `install-data-am'.
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
:compileJava
cache taskArtifacts.bin (/Volumes/Data/MyProjects/xcode/jlibpostal/.gradle/2.9/taskArtifacts/taskArtifacts.bin) is corrupt. Discarding.

FAILURE: Build failed with an exception.

* What went wrong:
Could not open cache taskArtifacts.bin (/Volumes/Data/MyProjects/xcode/jlibpostal/.gradle/2.9/taskArtifacts/taskArtifacts.bin).
> Corrupted FreeListBlock 0 found in cache '/Volumes/Data/MyProjects/xcode/jlibpostal/.gradle/2.9/taskArtifacts/taskArtifacts.bin'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 20.01 secs

I have no idea what this problem is...I did try to delete this cache folder completely and built from scratch, but got the same error.

What to do from here?

from jpostal.

albarrentine avatar albarrentine commented on August 26, 2024

Hm, can you rm -rf the entire jpostal checkout, clone it and build again?

from jpostal.

coachwei avatar coachwei commented on August 26, 2024

did that. Removed the entire repo, recloned it and do the build. Got the same error.

* What went wrong:
Could not open cache taskArtifacts.bin (/Volumes/Data/MyProjects/xcode/jlibpostal/.gradle/2.9/taskArtifacts/taskArtifacts.bin).
> Corrupted FreeListBlock 0 found in cache '/Volumes/Data/MyProjects/xcode/jlibpostal/.gradle/2.9/taskArtifacts/taskArtifacts.bin'.

from jpostal.

albarrentine avatar albarrentine commented on August 26, 2024

It seems like there's some cache directory that needs to be removed as well. What is "jlibpostal"? This project is called jpostal, so assuming that's some other project for which this is a dependency, maybe that project needs a gradle clean or something along those lines.

In any case, this seems to be solidly in Gradle territory now, and since I can't see your machine, it's better if you Google the problem and post what you find.

from jpostal.

taoj avatar taoj commented on August 26, 2024

Hi, @albarrentine I tried to build jpostal and found the same issue in this thread. I pull from the master also tried export JNI_INCLUDE_DIRS, still seeing the configure: error: cannot find JDK header files error. Any suggestions? Thanks a lot!

from jpostal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.