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

[native-image] confusing error message when output file name matches existing directory #530

Closed
tednaleid opened this issue Jul 7, 2018 · 4 comments
Assignees

Comments

@tednaleid
Copy link

I've got a demo repo that shows this issue with graal 1.0.0-rc3 on OSX: https://github.com/tednaleid/graal-issue Just check that out and run https://github.com/tednaleid/graal-issue/blob/master/show-issue.sh

If I run the following command to try to compile a jar in a subdirectory that has the same name as the jar's base name:

native-image -jar graal-issue-core/build/libs/graal-issue-core.jar

it fails with a confusing error message that says

fatal error: java.lang.RuntimeException: java.lang.RuntimeException: host C compiler or linker does not seem to work: java.lang.RuntimeException: returned 1

Buried in a bunch of other stack traces, it eventually says:

ld: can't open output file for writing: /private/tmp/graal-issue/graal-issue-core, errno=21 for architecture x86_64

Which took me far longer to realize than it should have that it was because it was trying to generate a file with the same path as an existing subdirectory in my current directory.

As far as I can tell, there isn't an option in native-image to output the file to a different name. I think there should be clearer upfront detection that the path it is trying to write the binary to isn't valid.

my environment:

java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
GraalVM 1.0.0-rc3 (build 25.71-b01-internal-jvmci-0.45, mixed mode)
sw_vers
ProductName:	Mac OS X
ProductVersion:	10.13.5
BuildVersion:	17F77
@tednaleid
Copy link
Author

Just discovered that you can customize the output file name with -H:Name=my-native-app

@olpaw
Copy link
Member

olpaw commented Jul 9, 2018

@tednaleid I agree. I will make this error message more reasonable.

@olpaw
Copy link
Member

olpaw commented Jul 9, 2018

Fixed in 473c771

@olpaw olpaw closed this as completed Jul 9, 2018
@tednaleid
Copy link
Author

Thanks for the quick fix! I appreciate that the error message also includes the -H:Name suggestion, I bet that'll save some people some time :).

zakkak added a commit to zakkak/mandrel that referenced this issue Jul 21, 2023
Sync 22.3 upstream branch with mandrel/22.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants