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

Build Jpostal erro on Mac OS Ventura 13.2.1 #42

Open
kishoreraj05 opened this issue Mar 10, 2023 · 3 comments
Open

Build Jpostal erro on Mac OS Ventura 13.2.1 #42

kishoreraj05 opened this issue Mar 10, 2023 · 3 comments

Comments

@kishoreraj05
Copy link

ERROR:
checking if gcc supports -fno-rtti -fno-exceptions... yes checking for gcc option to produce PIC... -fno-common -DPIC checking if gcc PIC flag -fno-common -DPIC works... yes checking if gcc static flag -static works... no checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin22.3.0 dyld checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking for gcj... no checking for guavac... no checking for jikes... no checking for javac... javac checking if javac works... yes checking for /System/Library/Frameworks/JavaVM.framework/Headers/jni.h... no configure: error: cannot find JDK header files checking for /System/Library/Frameworks/include/jni.h... no make: *** No rule to make target install'. Stop.
:buildJniLib FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':buildJniLib'.

Process 'command './build.sh'' finished with non-zero exit value 2

`
below env variable already set but still facing this issue.
JAVA_HOME= /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
JNI_INCLUDE_DIRS=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/include/

I tried debugging by following steps mentioned in #14 but no luck yet.

@SahibYar
Copy link

SahibYar commented May 7, 2023

@albarrentine in configure I can see following line.

# Apple Java headers are inside the Xcode bundle.

Which is not always the case. I installed JDK from Oracle. Installed location

/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home

java --version
java 11.0.18 2023-01-17 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.18+9-LTS-195)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.18+9-LTS-195, mixed mode)

MacOS Ventura 13.3.1 (a)

echo $JNI_INCLUDE_DIRS
/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home/include/

@SahibYar
Copy link

SahibYar commented May 7, 2023

Okay in configure.ac file I replaced (hardcoded JNI_INCLUDE_DIRS) following lines

AX_JNI_INCLUDE_DIR

for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
do
    CFLAGS="$CFLAGS -I$JNI_INCLUDE_DIR"
done

With

# Add JNI include paths
AC_MSG_CHECKING([for JNI include paths])
JNI_INCLUDE_DIRS="/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home/include/"
JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS -I/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home/include/darwin"
CFLAGS="$CFLAGS -I$JNI_INCLUDE_DIRS"
AC_MSG_RESULT([$JNI_INCLUDE_DIRS])

And it compiled successfully

@ets
Copy link
Collaborator

ets commented Oct 20, 2023

Thanks for the guidance here, I used this thread to get up and running initially on a M1. I kept running with it and just opened a PR for better support on Mac (and just about everywhere else as well). This project doesn't appear too active and it's unclear when or if that PR will be merged. If you're interested, feel free to hit our fork directly: https://github.com/Qualytics/jpostal

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

No branches or pull requests

3 participants