Skip to content

java headers are not bundled in /System/Library anymore (Mac OS) #24

@fedejinich

Description

@fedejinich

apparently, previous jdk versions came with the necessary JNI headers, but that's not the case anymore. This produces an error when trying to build directly to mac OS (experimental feature)

jni support explicitly requested but headers/dependencies were not found mac

one possible patch to fix this is to generate the configure file (by doing ./autogen.sh) and then edit this part to match the expected $JAVA_HOME/include path

case "$host_os" in
        darwin*)        # Apple Java headers are inside the Xcode bundle.
            macos_version=$(sw_vers -productVersion | sed -n -e 's/^[0-9]*.\([0-9]*\).[0-9]*/\1/p')
            if [ "$macos_version" -gt "7" ]; then
                _JTOPDIR="$(xcrun --show-sdk-path)/System/Library/Frameworks/JavaVM.framework"
                _JINC="$_JTOPDIR/Headers"
            else
                # _JTOPDIR="/System/Library/Frameworks/JavaVM.framework" 
                # _JINC="$_JTOPDIR/Headers"
                # MAC NOW USES ANOTHER PATH FOR THE JDK
                # IN MY CASE /Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home

                _JINC="$_JTOPDIR/include" # JAVA_HOME SHOULD HAVE AN /include PATH LIKE THIS
            fi
            ;;
        *) _JINC="$_JTOPDIR/include";;
esac

after doing the configure you'll be able to do the make clean && make in order to build the mac binary

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions