# Build failure in jvmpkg

**URL:** <https://discuss.tvm.apache.org/t/build-failure-in-jvmpkg/9897>\
**Category:** Development\
**Created:** [May 5, 2021, 8:07pm UTC](https://discuss.tvm.apache.org/t/build-failure-in-jvmpkg/9897 "2021-05-05T20:07:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![emma-mens](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/emma-mens/32/2598_2.png) [@emma-mens](https://discuss.tvm.apache.org/u/emma-mens)\
**Post date:** [May 5, 2021, 8:07pm UTC](https://discuss.tvm.apache.org/t/build-failure-in-jvmpkg/9897/1 "2021-05-05T20:07:38Z")

</div>

Hi, I’m currently trying to setup TVM RPC for Android on my mac (Big Sur, Apple M1 chip) but I’m failing to successfully run `make jvmpkg`. I am using Maven 3.6.0 and Oracle JDK 8. The exception is below

```auto
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for TVM4J Package - Parent 0.0.1-SNAPSHOT:
[INFO] 
[INFO] TVM4J Package - Parent ............................. SUCCESS [2.050 s]
[INFO] TVM4J Package - Core ............................... SUCCESS [9.302 s]
[INFO] TVM4J Package - Native Parent ...................... SUCCESS [0.061 s]
[INFO] TVM4J Package - Native OSX-x86_64 .................. FAILURE [0.242 s]
[INFO] TVM4J Package - Full Parent ........................ SKIPPED
[INFO] TVM4J Package - Full OSX-x86_64 .................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.346 s
[INFO] Finished at: 2021-04-21T15:29:50-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:native-maven-plugin:1.0-alpha-7:javah (javah) on project libtvm4j-osx-x86_64: Error running javah command: Error executing command line. Exit code:1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:native-maven-plugin:1.0-alpha-7:javah (javah) on project libtvm4j-osx-x86_64: Error running javah command
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error running javah command
    at org.codehaus.mojo.natives.plugin.NativeJavahMojo.execute (NativeJavahMojo.java:183)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.codehaus.mojo.natives.NativeBuildException: Error executing command line. Exit code:1
    at org.codehaus.mojo.natives.util.CommandLineUtil.execute (CommandLineUtil.java:34)
    at org.codehaus.mojo.natives.javah.JavahExecutable.compile (JavahExecutable.java:46)
    at org.codehaus.mojo.natives.plugin.NativeJavahMojo.execute (NativeJavahMojo.java:179)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :libtvm4j-osx-x86_64
make: *** [jvmpkg] Error 1

```

And a potentially useful info in the logs is

```auto
[INFO] /bin/sh -c cd /Users/emazuh/gitdir/tvm/jvm/native/osx-x86_64 && c++ -shared -o/Users/emazuh/gitdir/tvm/jvm/native/osx-x86_64/target/libtvm4j-osx-x86_64.jnilib target/objs/org_apache_tvm_native_c_api.o -framework JavaVM '-Wl,-exported_symbol,_Java_*' -undefined dynamic_lookup -Wl,-x
ld: framework not found JavaVM

```

Does anyone have pointers on how to debug this?

---

<div class="post-metadata">

**Author:** ![max1996](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@max1996](https://discuss.tvm.apache.org/u/max1996)\
**Post date:** [May 10, 2021, 10:48am UTC](https://discuss.tvm.apache.org/t/build-failure-in-jvmpkg/9897/2 "2021-05-10T10:48:10Z")

</div>

Hi Emma,

did you find a solution yet?

I am currently experiencing the same problem…

Thanks in advance

---

<div class="post-metadata">

**Author:** ![emma-mens](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/emma-mens/32/2598_2.png) [@emma-mens](https://discuss.tvm.apache.org/u/emma-mens)\
**Post date:** [May 12, 2021, 7:18pm UTC](https://discuss.tvm.apache.org/t/build-failure-in-jvmpkg/9897/3 "2021-05-12T19:18:31Z")

</div>

Not yet actually… still waiting for a response.

---

<div class="post-metadata">

**Author:** ![areusch](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/areusch/32/2118_2.png) [@areusch](https://discuss.tvm.apache.org/u/areusch)\
**Post date:** [May 13, 2021, 7:05pm UTC](https://discuss.tvm.apache.org/t/build-failure-in-jvmpkg/9897/4 "2021-05-13T19:05:27Z")

</div>

maybe try this? I don’t really know how maven works but perhaps updating `jvm/native/osx-x86_64/pom.xml` would solve this problem. feel free to send a PR if this can be done in a generic/cross-platform way!

[https://stackoverflow.com/questions/64844595/javacpp-builds-failing-on-macos-after-xcode-12-2-update-due-to-missing-javavm-fr](https://stackoverflow.com/questions/64844595/javacpp-builds-failing-on-macos-after-xcode-12-2-update-due-to-missing-javavm-fr)

---

<div class="post-metadata">

**Author:** ![max1996](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@max1996](https://discuss.tvm.apache.org/u/max1996)\
**Post date:** [May 17, 2021, 9:39am UTC](https://discuss.tvm.apache.org/t/build-failure-in-jvmpkg/9897/5 "2021-05-17T09:39:14Z")

</div>

I found a workaround by going back to a really old version of the OpenJDK and redoing everything.

The problem seems to be the “javah” command that would be required by the codehaus module during the build process. javah has been deprecated and removed from the JDK a while ago.

Edit: According to this documentation piece [Oracle Docs](https://docs.oracle.com/javase/9/tools/javah.htm#JSWOR687) Oracle JDK 8 should be fine. But your error was the same as mine with Kubuntu 20.04 LTS and a newer openJDK version

---

<div class="post-metadata">

**Author:** ![emma-mens](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/emma-mens/32/2598_2.png) [@emma-mens](https://discuss.tvm.apache.org/u/emma-mens)\
**Post date:** [May 24, 2021, 6:08pm UTC](https://discuss.tvm.apache.org/t/build-failure-in-jvmpkg/9897/6 "2021-05-24T18:08:16Z")

</div>

> [@emma-mens](#):
>
> make jvmpkg

" You can safely replace `-framework JavaVM` with `-framework JavaNativeFoundation`" This worked. @areusch will I need to add some conditional in the pom.xml since I’m not sure if `JavaNativeFoundation` will work for other environments?

---

<div class="post-metadata">

**Author:** ![areusch](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/areusch/32/2118_2.png) [@areusch](https://discuss.tvm.apache.org/u/areusch)\
**Post date:** [May 24, 2021, 6:22pm UTC](https://discuss.tvm.apache.org/t/build-failure-in-jvmpkg/9897/7 "2021-05-24T18:22:55Z")

</div>

cc @yzhliu who may know more about the jvm bindings
