-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix contrib/build_sysimg.jl
#27629
Fix contrib/build_sysimg.jl
#27629
Conversation
15a3cdf
to
4718cd5
Compare
I believe PackageCompiler.jl is the more general way to do this. But of course if we ship a script, we should make sure it works. |
If this script is no longer the recommended way to accomplish this, can we simply delete the script and tell people to use PackageCompiler? |
end | ||
else | ||
run(`$cc $FLAGS -o $sysimg_file $sysimg_path.o`) | ||
if success(pipeline(cc_cmd; stdout=stdout, stderr=stderr)) |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Looks good on FreeBSD now 👍 |
Getting this on macOS:
I think something like this should fix it: --- a/contrib/build_sysimg.jl
+++ b/contrib/build_sysimg.jl
@@ -161,8 +161,16 @@ function link_sysimg(sysimg_path=nothing, cc=find_system_compiler(), debug=false
push!(FLAGS, "-lssp")
end
+ if Sys.isapple()
+ whole_archive = "-Xlinker -all_load"
+ no_whole_archive = ""
+ else
+ whole_archive = "-Wl,--whole-archive"
+ no_whole_archive = "-Wl,--no-whole-archive"
+ end
+
sysimg_file = "$sysimg_path.$(Libdl.dlext)"
- cc_cmd = `$cc $FLAGS -o $sysimg_path.tmp -Wl,--whole-archive $sysimg_path.o -Wl,--no-whole-archive`
+ cc_cmd = `$cc $FLAGS -o $sysimg_path.tmp $whole_archive $sysimg_path.o $no_whole_archive`
@info("Linking sys.$(Libdl.dlext) with $cc_cmd")
# Windows has difficulties overwriting a file in use so we first link to a temp file
if success(pipeline(cc_cmd; stdout=stdout, stderr=stderr)) |
e70e9e9
to
d52b4de
Compare
480fcbf
to
5b1ec9c
Compare
… custom system images.
contrib/build_sysimg.jl
contrib/build_sysimg.jl
I always wondered why this needs to be a script and is not a regular function within julia. But I tend to agree with @ararslan that if |
Just a quick note on this. In the past I compiled custom sysimages to get things like fma operations to use native instructions when they were supported. First, this no longer seems to be needed. But second, the way I did this was: I get the
This is on linux with both julia 0.7.0 and julia 1.0.0 (after I modified the script to use @info and using Libdl) |
this PR works well(I forgot to checkout this PR before testing). |
If someone more familiar with correctly linking + outputting the shared libraries etc helps to keep PackageCompiler up to date, I'd very much welcome to just use PackageCompiler instead ;) Otherwise it'd be nice to keep this script as a reference implementation! |
I think we should just remove |
Please delete. |
What? PackageCompiler.jl doesn't build post 1.0. I'm getting Libdl errors just trying to run default_sysimg_path() . I'm on Linux Mint 19. Are there any work arounds? |
I suggest you open an issue against |
The
contrib/build_sysimg.jl
script had bitrotted a bit with the 0.7 changes. This PR also incorporates @RalphAS's changes to address #27201 and #27451.Marking this as WIP until testing is done on all major OS's:
@ararslan could I ask you to test this out on FreeBSD? I create the "user image" file:
Then I compile it into a custom sysimg:
Finally, I test it: