Open Brushguy opened 7 years ago
By default the yara-java build process will look for the libyara source and libraries in the parent directory of yara-java. You can modify src/main/native-package/m4/custom.m4 if you have libyara somewhere else.
Alternatively, you could try building from some unmerged tara isolation changes in my forked version. https://github.com/siddharthTyagi/yara-java
Both vcbuild and msbuild have a command line option/property "useenv" which allows you to specify additional include and lib folders but looking a hawtjni's code (what yara-java uses for native build) is not set.
One thing you can try is build yara for windows following their instructions, build yara-java (mvn clean build) then modify the visual studio project from yara-java/target/native-build with your additional include/lib and build again (without a clean).
Since most of the problems people are running into seem build related in the future I will look at providing prebuilt packages.
Thanks.
Did any of the above suggestions work ?
@p8a I have got the same problem on building libyara through the maven install.
Hello,
I have got the same problem when building the maven.
Hello,
I have got the same problem when building the maven.
"[INFO]
[INFO] --- hawtjni:1.12:generate (default) @ libyara-api ---
[INFO] Analyzing classes...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] libyara 3.4.0-SNAPSHOT ............................. SUCCESS [ 0.725 s]
[INFO] Java API 3.4.0-SNAPSHOT ............................ FAILURE [ 2.200 s]
[INFO] Platform specific yara library 3.4.0-SNAPSHOT-Windows 11-amd64 SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.052 s
[INFO] Finished at: 2024-07-16T21:33:42+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.fusesource.hawtjni:maven-hawtjni-plugin:1.12:generate (default) on project libyara-api: Native source code generation failed: java.lang.RuntimeException: java.lang.RuntimeException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.fusesource.hawtjni:maven-hawtjni-plugin:1.12:generate (default) on project libyara-api: Native source code generation failed: java.lang.RuntimeException: java.lang.RuntimeException
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke (Method.java:580)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: org.apache.maven.plugin.MojoExecutionException: Native source code generation failed: java.lang.RuntimeException: java.lang.RuntimeException
at org.fusesource.hawtjni.maven.GenerateMojo.generateNativeSourceFiles (GenerateMojo.java:215)
at org.fusesource.hawtjni.maven.GenerateMojo.execute (GenerateMojo.java:180)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke (Method.java:580)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException
at org.fusesource.hawtjni.generator.HawtJNI.findClasses (HawtJNI.java:299)
at org.fusesource.hawtjni.generator.HawtJNI.generate (HawtJNI.java:211)
at org.fusesource.hawtjni.maven.GenerateMojo.generateNativeSourceFiles (GenerateMojo.java:213)
at org.fusesource.hawtjni.maven.GenerateMojo.execute (GenerateMojo.java:180)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke (Method.java:580)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: java.lang.RuntimeException
at org.objectweb.asm.MethodVisitor.visitParameter (Unknown Source)
at org.objectweb.asm.ClassReader.b (Unknown Source)
at org.objectweb.asm.ClassReader.accept (Unknown Source)
at org.objectweb.asm.ClassReader.accept (Unknown Source)
at org.apache.xbean.finder.AbstractFinder.readClassDef (AbstractFinder.java:581)
at org.apache.xbean.finder.AbstractFinder.readClassDef (AbstractFinder.java:576)
at org.apache.xbean.finder.AbstractFinder.readClassDef (AbstractFinder.java:562)
at org.apache.xbean.finder.ClassFinder.
Alternatively, you could try building from some unmerged tara isolation changes in my forked version. https://github.com/siddharthTyagi/yara-java
Merged these changes but still encountering an issue with mvn 3.8.7:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.fusesource.hawtjni:maven-hawtjni-plugin:1.8:generate (default) on project libyara: Native source code generation failed: java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: Index 5416 out of bounds for length 209 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following
update-hawtjni-add-yara-home.patch.gz
I have added a patch that adds support for YARA_HOME (per @siddharthTyagi 's fork) and also updates the version and plugin references to HawtJNI. Unfortunately, it still fails with a non descriptive error, but it;s a step in the right direction.
I'm building yara-java on a 64-bit Windows 7 machine. Following the instructions on the main Github page, I get stuck at "mvn clean install":
I essentially understand the "No such file or directory" errors - it can't locate the rest of the YARA C++ files it needs to build the wrapper project - but I'm not sure what to try debugging from here. It just looks like some of the C++ source files aren't getting copied, or maybe the yara-wrapper header can't locate the source files in their original locations.
I'm not an expert with Maven or C++ compilers, but I noticed that there's no profile in the pom file for Windows... does this need to be added?
Let me know if I can provide any additional information.