After compiling Tomcat Native (that comes with Tomcat 9.0.62, version 1.2.32)
on a (ARM) M1 Mac (with Amazon Coretto 11 JDK, APR, and OpenSSL 1.1.1n), I get
the following error in Catalina.out:
05-Apr-2022 11:10:32.307 WARNING [main]
org.apache.catalina.core.AprLifecycleListener.init The Apache Tomcat Native
library failed to load. The error reported was
[/Library/Java/Extensions/libtcnative-1.0.dylib:
dlopen(/Library/Java/Extensions/libtcnative-1.0.dylib, 0x0001): tried:
'/Library/Java/Extensions/libtcnative-1.0.dylib' (mach-o file, but is an
incompatible architecture (have 'arm64', need 'x86_64')),
'/usr/lib/libtcnative-1.0.dylib' (no such file)]
java.lang.UnsatisfiedLinkError:
/Library/Java/Extensions/libtcnative-1.0.dylib:
dlopen(/Library/Java/Extensions/libtcnative-1.0.dylib, 0x0001): tried:
'/Library/Java/Extensions/libtcnative-1.0.dylib' (mach-o file, but is an
incompatible architecture (have 'arm64', need 'x86_64')),
'/usr/lib/libtcnative-1.0.dylib' (no such file)
Note: After I compiled Native, I did the following (we did this in the past but
I don’t know if it is still required):
1. cp
/usr/local/tomcat/bin/tomcat-native-1.2.32-src/native/.libs/libtcnative-1.0.dylib
/Library/Java/Extensions
2. cd /Library/Java/Extensions
3. ln -sfhv libtcnative-1.0.dylib libtcnative-1.dylib
4. ln -sfhv libtcnative-1.dylib libtcnative-1.jnilib
(Not sure if this is needed anymore…)
Does anyone have instructions for compiling Native on an ARM-based Mac? Or
suggestions around this issue?
Thank you,
Brian