# Building VTK for Mac M1+ARM : Undefined symbols: \_JAWT\_GetAWT

**URL:** https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181
**Category:** Support
**Created:** [November 15, 2021, 6:03pm UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181 "2021-11-15T18:03:54Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [November 15, 2021, 6:03pm UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/1 "2021-11-15T18:03:54Z")

</div>

Hi,

I am trying to build VTK 9.1.0-rc2 on a Mac M1 with an ARM64. I am blocked at

```auto
[38%] Linking CXX shared library ../../lib/java/vtk-Darwin-arm64/libvtkRenderingCoreJava.jnilib
Undefined symbols for architecture arm64:
  "_JAWT_GetAWT", referenced from:
      _Java_vtk_vtkPanel_RenderCreate in vtkRenderWindowJava.mm.o
      _Java_vtk_rendering_awt_vtkInternalAwtComponent_RenderCreate in vtkRenderWindowJava.mm.o
      _Java_vtk_vtkPanel_Lock in vtkRenderWindowJava.mm.o
      _Java_vtk_vtkPanel_UnLock in vtkRenderWindowJava.mm.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/java/vtk-Darwin-arm64/libvtkRenderingCoreJava.jnilib] Error 1
make[1]: *** [Wrapping/Java/CMakeFiles/vtkRenderingCoreJava.dir/all] Error 2
make: *** [all] Error 2

```

There are [old post saying that the AWT include path should be replaced](https://vtk.org/pipermail/vtkusers/2008-February/044826.html) by `-framework JavaVM`, Apple forums suggest to rather use `-framework JavaNativeFoundation` since a year ago, but none of this work :

```auto
[40%] Linking CXX shared library ../../lib/java/vtk-Darwin-arm64/libvtkRenderingCoreJava.jnilib
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks//JavaNativeFoundation.framework/JavaNativeFoundation.tbd, missing required architecture arm64 in file /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks//JavaNativeFoundation.framework/JavaNativeFoundation.tbd
Undefined symbols for architecture arm64:
  "_JAWT_GetAWT", referenced from:
      _Java_vtk_vtkPanel_RenderCreate in vtkRenderWindowJava.mm.o
      _Java_vtk_rendering_awt_vtkInternalAwtComponent_RenderCreate in vtkRenderWindowJava.mm.o
      _Java_vtk_vtkPanel_Lock in vtkRenderWindowJava.mm.o
      _Java_vtk_vtkPanel_UnLock in vtkRenderWindowJava.mm.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/java/vtk-Darwin-arm64/libvtkRenderingCoreJava.jnilib] Error 1
make[1]: *** [Wrapping/Java/CMakeFiles/vtkRenderingCoreJava.dir/all] Error 2
make: *** [all] Error 2

```

My CMake configuration is as follow. The chosen JVM is a Zulu 11 for ARM processors.

 ![Capture d’écran 2021-11-15 à 18.16.19](https://discourse.vtk.org/uploads/default/original/2X/8/81c816674f173ac4c91af05d76182d2e5df52140.png)

LD is supposed to support my processor

```auto
ld -v
@(#)PROGRAM:ld PROJECT:ld64-711
BUILD 14:59:28 Aug 21 2021
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 13.0.0, (clang-1300.0.29.3) (static support for 27, runtime is 27)
TAPI support using: Apple TAPI version 13.0.0 (tapi-1300.0.6.5)

```

Thanks in advance for your help!

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [November 15, 2021, 8:41pm UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/2 "2021-11-15T20:41:07Z")

</div>

Cc: @dgobbi @toddy

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [November 15, 2021, 9:22pm UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/3 "2021-11-15T21:22:47Z")

</div>

It looks like the JavaNativeFoundation being used is not built for arm64.

---

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [November 15, 2021, 9:45pm UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/4 "2021-11-15T21:45:33Z")

</div>

That is also my assumption.

However I think I should be able to build by referencing Azul JDK 11 as I did. To clarify, the first link error message refer to the CMake configuration screenshot where I do not use the `-framework` flag.

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [November 15, 2021, 9:58pm UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/5 "2021-11-15T21:58:14Z")

</div>

Why don’t you just try a JNF built for arm64. I believe xcode provides one.

---

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [November 15, 2021, 10:02pm UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/6 "2021-11-15T22:02:15Z")

</div>

I could try to setup this. But what happens with this -framework flag? Isn’t it possible to link against any JDK by configuring via CMake as I did? Why would it work better with JNF?

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [November 15, 2021, 10:23pm UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/7 "2021-11-15T22:23:47Z")

</div>

You could try command line  
`arch -arm64 cmake`

---

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [November 16, 2021, 11:11am UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/8 "2021-11-16T11:11:06Z")

</div>

This was due to erroneous Java path definition pointing to folders instead of dylib **files**.

Here is the correct configuration

 ![cmake-java-settings](https://discourse.vtk.org/uploads/default/original/2X/3/373b71644d7e58c89926d21c374abe657ef1d77f.png)

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [November 16, 2021, 11:26am UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/9 "2021-11-16T11:26:01Z")

</div>

There really should be a **cmake** warning about the missing lib file names.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [November 16, 2021, 1:59pm UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/10 "2021-11-16T13:59:28Z")

</div>

Feel free to submit patches to sanity check the Java variables in use. Erroring is fine too if we know they’re not OK.

---

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [November 16, 2021, 2:06pm UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/11 "2021-11-16T14:06:01Z")

</div>

There were warning about not readable libraries but stupidly missed them because of minimizing the output panel from CMake GUI.

Anyway, build is OK but will halt a bit further while creating the jar, so I followed your [suggestions here](https://discourse.vtk.org/t/vtk-9-and-java-vtk-jar-not-automatically-generated-also-location-of-wrapper-dlls/3354/16) and manually did

```auto
cd Wrapping/Java/CMakeFiles/vtkjava.dir/
jar --create -f ../../../../lib/java/vtk-9.1.0.jar vtk

```

And then I can run Java wrapper \o/ thanks for your help and your posts about Java 🙂

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [November 16, 2021, 9:11pm UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/12 "2021-11-16T21:11:51Z")

</div>

Just out of interest which compiler are you using to build for ARM architecture? Clang?

---

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [November 17, 2021, 11:18am UTC](https://discourse.vtk.org/t/building-vtk-for-mac-m1-arm-undefined-symbols-jawt-getawt/7181/13 "2021-11-17T11:18:25Z")

</div>

Yes I think.

If you are also willing to run VTK for Java on ARM, then you might be interested by this JOGL release adding support for ARM : [GitHub - jzy3d/jogl-maven-deployer: Scripts to make a maven distribution out of JOGL 2.4](https://github.com/jzy3d/jogl-maven-deployer#getting-jogl-24-rc-4-for-macos-bigsur-20211116). It is not an official one, I just hacked gluegen and jogl and left other projects for latter.
