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

build_sysimg (slightly) broken for Linux #27451

Closed
RalphAS opened this issue Jun 6, 2018 · 3 comments
Closed

build_sysimg (slightly) broken for Linux #27451

RalphAS opened this issue Jun 6, 2018 · 3 comments

Comments

@RalphAS
Copy link

RalphAS commented Jun 6, 2018

With the official binary distributions for v0.7-alpha on Linux-x86_64 (two Linux distributions tried so far), I find that the build_sysimg script does not work; the symptom is that using the result gives:

$ /opt/julia7a/bin/julia -J /tmp/newsys.so
ERROR: System image file failed consistency check: maybe opened the wrong version?

The script itself appears to run happily:

INFO: cc -L/opt/julia-22590d529d/bin/../lib -shared -ljulia -o /tmp/newsys.so /tmp/newsys.o
┌ Warning: `info()` is deprecated, use `@info` instead.
│   caller = link_sysimg(::String, ::String, ::Bool) at build_sysimg.jl:178
└ @ Main build_sysimg.jl:178
INFO: System image successfully built at /tmp/newsys.so

But the resulting DLL is tiny. The trouble is that the object file newsys.o is an ar archive, which the linker searches but does not copy into the DLL.

I think the appropriate patch is to replace the link command so that it expands to

$ gcc -L/opt/julia-22590d529d/bin/../lib -shared -ljulia -o /tmp/newsys.so \
     -Wl,--whole-archive /tmp/newsys.o -Wl,--no-whole-archive

Alternatively, one could use ar to extract the actual object files and link them directly.

I encountered this problem while working around #26314.

@SimonDanisch
Copy link
Contributor

related: #26672

@RalphAS
Copy link
Author

RalphAS commented Jun 6, 2018

Somehow I missed #27201 which this also duplicates. I can't say what would work on Windows or OSX.

In case it isn't clear from the above, after running the build_sysimg script (at least on Linux) one can copy the link command (which is conveniently echoed by the script), edit it as indicated above, and run it manually in a shell.

@RalphAS RalphAS closed this as completed Jun 6, 2018
@SimonDanisch
Copy link
Contributor

I think your issue is better ;) After all, you figured out the problem!

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

No branches or pull requests

2 participants