Incorrect link order when resolving nearest dependencies.

19 views
Skip to first unread message

Adam Ciaccio

unread,
Mar 14, 2017, 4:38:03 PM3/14/17
to NAR Maven plugin

As advertised, Maven will pull in all the 'nearest' dependencies of a given project however the link order is not always correct. For example if project A-1.0 specifies B-1.1 and C-1.0 as dependencies IN THAT ORDER (i.e. in A's pom.xml) the build fails to link because C-1.0 depends on B for symbols that are optimized out of the build. The resulting link line looks like the following:
-lB1.1 -lC1.0


The correct link line should be the following:
-lC1.0 -lB1.1


If however I list A's dependencies with C-1.0 first (i.e. C-1.0 B-1.1) then the build succeeds because B-1.1 will be placed in the link line AFTER C-1.0 and therefore satisfies all symbols needed by both A and C. Inspection of the maven NAR code shows that NAR pulls the 'reduced graph' of dependencies required for the build. That is, when NAR makes a call to DependencyGraphBuilder.buildDependencyGraph (...), the resulting graph does not include C-1.0's dependency on B-1.0 so the NAR plug-in will not have sufficient information on how much further down in the link order B-1.1 must be placed.


One implementation to solve this problem would be to pull both the dependency graph and the dependency tree (DependencyTreeBuilder.buildDependencyTree(...)) in AbstractDependencyMojo's methods for parsing the dependencies and constructing the dependency string. The NAR plug-in could use the set of dependencies from the reduced graph as the source of truth for which library versions to use and could then parse the 'full dependency tree' to identify how far down the link line to place those libraries in the methods of AbstractDependencyMojo.

Curtis Rueden

unread,
Mar 15, 2017, 11:53:57 AM3/15/17
to Adam Ciaccio, NAR Maven plugin
Hi Adam,

Thanks for the report. I see that you already filed this issue on GitHub:

So I'm mainly replying here to cross-link that for completeness, in case others come across this thread. Unfortunately, I have no bandwidth to think about this issue or pursue a solution. But as always, PRs are warmly welcome, if this is itchy enough that you need to scratch it now.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden


--
You received this message because you are subscribed to the Google Groups "NAR Maven plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maven-nar+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages