maven-nar / nar-maven-plugin

Native ARchive plugin for Maven
https://maven-nar.github.io/
Apache License 2.0
232 stars 160 forks source link

Plugin assumes completely wrong AOL #242

Open Selbi182 opened 8 years ago

Selbi182 commented 8 years ago

Hey there,

so I've recently tried to include this plugin in my project, but so far had a big headache over how exactly it's supposed to be configured. Specifically, I'm struggling to make the damn thing know the correct AOL.

I've tried to see how it would work with one of the included example projects:

$ mvn install [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Examples :: nar-maven-plugin JNI Project 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- nar-maven-plugin:3.2.3:nar-validate (default-nar-validate) @ nar-maven-plugin-jni-example --- [INFO] Using AOL: amd64-Windows-msvc [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.211 s [INFO] Finished at: 2016-08-12T14:32:54+02:00 [INFO] Final Memory: 10M/309M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.2.3:nar-validate (default-nar-validate) on project nar-maven-plugin-jni-example: Cannot deduce version number from: -> [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 articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

It assumes I'm running amd64-Windows-msvc, apparently, which isn't remotely correct. It should be x86.Windows.g++, as per this page. Unfortunately, I don't know where to find that configuration file, and the page makes no mention of it either, so I don't know how to manually override it. I don't even have Visual Studio installed, so I don't know where that MSVC came from either.

Chances are this is an issue on my end, but I just don't know what's causing this.

Selbi182 commented 8 years ago

Things got a little more interesting with another sample project (without JNI, just a plain C-File):

$ mvn install [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.github.maven-nar.its.nar:it0001-executable:nar:1.0-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for com.github.maven-nar:nar-maven-plugin is missing. @ line 49, column 15 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building NAR Executable Test 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- nar-maven-plugin:3.5.0:nar-validate (default-nar-validate) @ it0001-executable --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.327 s [INFO] Finished at: 2016-08-12T15:12:53+02:00 [INFO] Final Memory: 12M/309M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.5.0:nar-validate (default-nar-validate) on project it0001-executable: msvc.version not specified and no VSCOMNTOOLS environment variable can be found -> [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 articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

It still assumes I want to use MSVC, which is wrong, but at least the error looks less generic.

ctrueden commented 8 years ago

Have you tested with the latest nar-maven-plugin snapshot from master? There was a recent bug-fix commit which may address these problems for you: https://github.com/maven-nar/nar-maven-plugin/commit/ad48e49187d09ce291e8f2c3a8dcd5a1fd2b1ddb

If the problems are solved by the latest snapshot version, I can cut a release for you; just let me know.

If the most recent snapshot does not work, you could try with an older version (perhaps 3.2.0), and if that works, then git bisect to determine which commit broke things for you.

dproteus13 commented 8 years ago

Also, as a last resort, you can specify the AOL via the tag inside the plugin's , I think. Not ideal by any means, but it might be worth knowing as a backup...

On Fri, Aug 12, 2016, 1:34 PM Curtis Rueden notifications@github.com wrote:

Have you tested with the latest nar-maven-plugin snapshot from master? There was a recent bug-fix commit which may address these problems for you: ad48e49 https://github.com/maven-nar/nar-maven-plugin/commit/ad48e49187d09ce291e8f2c3a8dcd5a1fd2b1ddb

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/maven-nar/nar-maven-plugin/issues/242#issuecomment-239510253, or mute the thread https://github.com/notifications/unsubscribe-auth/ACgBs2jgUsaAqGdCNvpL0Xbw8QCEScqPks5qfK6pgaJpZM4JjCxH .

Selbi182 commented 8 years ago

Nope, none of these approaches worked. Cloned the recent SNAPSHOT to my machine (and verified its existence in the .m2 folder), but I got the following error:

[ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.5.1-SNAPSHOT:nar-validate (default-nar-validate) on project nar-maven-plugin-jni-example: Execution default-nar-validate of goal com.github.maven-nar:nar-maven-plugin:3.5.1-SNAPSHOT:nar-validate failed. NullPointerException -> [Help 1]

Interestingly to note here, it didn't suggest the wrong AOL this time. Instead, it suggested no AOL at all.

Using 3.2.0 gives me the exact same problem as the version I used to start this topic, unfortuantely.

As for the tag... Call me ignorant, but I don't seem to find any documentation how to use that tag properly. Tried to write my AOL using dashes and dots (i.e. "x86-Windows-g++" vs. "x86.Windows.g++"), but neither approaches worked. Once again, though, I didn't get the wrong AOL suggested, but instead none at all.

Error message:

[ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.5.1-SNAPSHOT:nar-validate (default-nar-validate) on project nar-maven-plugin-jni-example: Execution default-nar-validate of goal com.github.maven-nar:nar-maven-plugin:3.5.1-SNAPSHOT:nar-validate failed. NullPointerException -> [Help 1]

In other words, quite literally the same as the one above. Tried it with 3.2.0 as well, and got the same error.

To be honest, all I would like to see right now is an example NAR-file so I can get my head over how an expected output file looks like. There are many example projects, but none of them seem to work on my machine, and I do believe it's a problem on my end after all these fixing attempts.

dproteus13 commented 8 years ago

The null pointer exception is probably because I told you the wrong place to put the <aol> tag, I'm sorry about that!

Per this discussion, it should be inside <configuration> <linker> : https://github.com/maven-nar/nar-maven-plugin/issues/56

Pardon if my markup is wrong, I'm mostly on BitBucket :(

On Mon, Aug 15, 2016, 3:06 AM Selbi182 notifications@github.com wrote:

Nope, none of these approaches worked. Cloned the recent SNAPSHOT to my machine (and verified its existence in the .m2 folder), but I got the following error:

[ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.5.1-SNAPSHOT:nar-validate (default-nar-validate) on project nar-maven-plugin-jni-example: Execution default-nar-validate of goal com.github.maven-nar:nar-maven-plugin:3.5.1-SNAPSHOT:nar-validate failed. NullPointerException -> [Help 1]

Interestingly to note here, it didn't suggest the wrong AOL this time. Instead, it suggested no AOL at all.

Using 3.2.0 gives me the exact same problem as the version I used to start this topic, unfortuantely.

As for the tag... Call me ignorant, but I don't seem to find any documentation how to use that tag properly. Tried to write my AOL using dashes and dots (i.e. "x86-Windows-g++" vs. "x86.Windows.g++"), but neither approaches worked. Once again, though, I didn't get the wrong AOL suggested, but instead none at all.

Error message:

[ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.5.1-SNAPSHOT:nar-validate (default-nar-validate) on project nar-maven-plugin-jni-example: Execution default-nar-validate of goal com.github.maven-nar:nar-maven-plugin:3.5.1-SNAPSHOT:nar-validate failed. NullPointerException -> [Help 1]

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/maven-nar/nar-maven-plugin/issues/242#issuecomment-239741412, or mute the thread https://github.com/notifications/unsubscribe-auth/ACgBs7YwK2VGbW6Q4HdjkFCEQfTISbQyks5qgA_ugaJpZM4JjCxH .

Selbi182 commented 8 years ago

Okay, at least I got a more sensible error message:

[ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.5.1-SNAPSHOT:nar-validate (default-nar-validate) on project nar-maven-plugin-jni-example: Unable to parse configuration of mojo com.github.maven-nar:nar-maven-plugin:3.5.1-SNAPSHOT:nar-validate for parameter aol: Cannot find 'aol' in class com.github.maven_nar.Linker -> [Help 1]

Was this correct?

     <plugins>
      <plugin>
        <groupId>com.github.maven-nar</groupId>
        <artifactId>nar-maven-plugin</artifactId>
        <version>3.5.1-SNAPSHOT</version>
        <extensions>true</extensions>
        <configuration>
          <linker>
            <aol>x86-Windows-g++</aol>
          </linker>
          <libraries>
            <library>
              <type>executable</type>
              <run>true</run>
            </library>
          </libraries>
        </configuration>
      </plugin>
    </plugins>

EDIT: I GOT IT TO WORK! WOOOOOO! Should've read your link before posting, sorry for that. This was the correct configuration:

          <aol>x86-Windows-g++</aol>
          <linker>
            <name>g++</name>
          </linker>

It'd be cool if this was mentioned somewhere in the documentation. I had no idea to manually setup the AOL before this was mentioned.

Question though, why do I manually need to set the Linker if it's already in the ?

dproteus13 commented 8 years ago

Good! Sorry I think I hadn't had it quite right again :-/

As to why you have to set the linker, I suspect it's related to the fact that this is really not the way things are supposed to work. The AOL should be derived during the validate state, and that process is probably what sets the linker. I'll be honest though, I only touch Windows to get into a Linux VM, so I'm not much help in figuring out why that part isn't working :-/

Selbi182 commented 8 years ago

Meanwhile, I use Linux once in a blue moon, so there's that. :laughing:

And no need to apologize, I'm just glad I got help at all!

@ctrueden If you'd still like to have some information in regards to the auto-detection not working properly, I'll gladly assist you.

ctrueden commented 8 years ago

@Selbi182 wrote:

It'd be cool if this was mentioned somewhere in the documentation. I had no idea to manually setup the AOL before this was mentioned.

Could you please add it to the FAQ?

If you'd still like to have some information in regards to the auto-detection not working properly, I'll gladly assist you.

Unfortunately, I have zero bandwidth at the moment to investigate. (And I am not a Windows user, so I am not the best person to be digging on those issues.) But if you have time and energy to solve it, PRs are always welcome.