Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative property location is invalid when building in top-level dirs on linux #442

Closed
wants to merge 1 commit into from

Conversation

layus
Copy link

@layus layus commented Jan 26, 2019

Trying to build lwjgl on linux failed for me because src.main.rel was improperly set to ../../modules/opengl/[...] when it was supposed to be ../../../../modules/opengl/[...] where the four .. come from

<property name="module.lwjgl.rel" value="../../../../${module.lwjgl}"/>

This happens because src.main.rel is set with a relative property location in

<property name="src.main.rel" location="${module.lwjgl.rel}/@{module}/src/main/c" relative="true"/>

and finally used after going two directories deeper (@{dest}) at

<arg value="-I${src.main.rel}" if:true="@{simple}"/>

Now, if you happen to build in /build/lwjgl-xxx/, the relative path will be truncated (because in /build/lwjgl-xxx/ ../../../.. is the same as ../.. so some kind of canonicalization occurs.)

Proposed solution in this PR. Tested and working by only changing src.main.rel. This PR is more a POC than something to be merged as-is.

This fixes an issue when building too close to the root on linux
@Spasi
Copy link
Member

Spasi commented Feb 6, 2019

Hey @layus,

I'm not sure what this means:

if you happen to build in /build/lwjgl-xxx/, the relative path will be truncated

The Ant build is meant to be executed from the repository root. What are you doing differently exactly?

@layus
Copy link
Author

layus commented Feb 6, 2019

What I am saying is that building from the repository root, when that repository root is not deep enough in the filesystem tree, fails.

For example, assuming the repository root is in a dir named lwjgl-xxx, building with the repository root in /home/user/projects/lwjgl-xxx will work, and building in /build/lwjgl-xxx will not. Most probably, building in /lwjgl-xxx or /var/test/lwjgl-xxx will not. The build is somehow dependent of the (filesystem) depth where the checkout is made.

I of course always start the build in the checkout root.

@layus
Copy link
Author

layus commented Feb 6, 2019

Or said differently, that the ../../../.. in module.lwjgl.rel was meant to be used in a different cwd than where it is defined. It was not ported correctly in the build system refactoring and was not intended to be used in a <property name="..." location="..." relative="true"/>

@Spasi Spasi added the Type: Bug label Feb 7, 2019
@Spasi Spasi closed this in f2319b6 Feb 7, 2019
@Spasi
Copy link
Member

Spasi commented Feb 7, 2019

Thank you @layus!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants