Closed pron closed 7 years ago
This is a follow up from this reddit post
The issue is that the output of BuildExecutable does not actually load the associated precompiled image, so everything must be JIT'd again before the app can do anything. You can get normal (faster) startup by specifying the image manually:
JULIA_SYSIMAGE=libapp.dylib ./app Hello
(from the build directory, using the build command from your reddit post)
It works! Thank you very much. You may want to consider adding it to the README. Could this be automatically done by the executable?
P.S.
I'm very new to Julia. Where is the best place to ask questions? Reddit? SO? discourse.julialang.org?
Hi, I am also very new to Julia (have been using Matlab/Python for many years). I am using Julia 0.5.0 64bit on Windows and have tried to compile a simple program using build_executable, but I have not been successful - the process always breaks with a Load Error:
ERROR: LoadError: failed process: Process('C:\Users\merdmann\.julia\v0.5\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\gcc.exe' '-LC:\Julia-0.5.0\bin' -shared -ljulia -lssp -o 'C:\Julia-0.5.0\bin\libapp.dll' 'C:\Julia-0.5.0\bin\libapp.o'
, ProcessExited(1)) [1]
in pipeline_error(::Base.Process) at .\process.jl:616
in run at .\process.jl:592 [inlined]
in link_sysimg(::String, ::String, ::Bool) at C:\Users\merdmann.julia\v0.5\BuildExecutable\src\build_sysimg.jl:151
in (::##2#3{Bool,String})() at C:\Users\merdmann.julia\v0.5\BuildExecutable\src\build_sysimg.jl:80
in cd(::##2#3{Bool,String}, ::String) at .\file.jl:48
in #build_sysimg#1(::Bool, ::Bool, ::Function, ::String, ::String, ::String) at C:\Users\merdmann.julia\v0.5\BuildExecutable\src\build_sysimg.jl:38
in (::#kw##build_sysimg)(::Array{Any,1}, ::#build_sysimg, ::String, ::String, ::String) at .\
Would you mind to help me with this problem? Thanks a lot!
Julia just says that the command has failed and does not give more info.
Could you run the command (i.e. C:\Users\merdmann\.julia\v0.5\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\gcc.exe' '-LC:\Julia-0.5.0\bin' -shared -ljulia -lssp -o 'C:\Julia-0.5.0\bin\libapp.dll' 'C:\Julia-0.5.0\bin\libapp.o
) in a terminal and tell us the output ?
Unfortunately, the command does not produce any output - the command syntax seems to be incorrect.
The final Julia error message is:
LoadError: failed process: Process('C:\Julia-0.5.0\bin\julia' 'C:\Users\merdmann\.julia\v0.5\BuildExecutable\src\build_sysimg.jl' 'C:\Julia-0.5.0\bin\libapp' native 'C:\Users\merdmann\AppData\Local\Temp\jl_D63E.tmp\userimg.jl' --force
, ProcessExited(1)) [1]
in pipeline_error(::Base.Process) at .\process.jl:616
in run at .\process.jl:592 [inlined]
in #build_executable#1(::Bool, ::Bool, ::Function, ::String, ::String, ::String, ::String) at C:\Users\merdmann.julia\v0.5\BuildExecutable\src\BuildExecutable.jl:116
in build_executable(::String, ::String, ::String, ::String) at C:\Users\merdmann.julia\v0.5\BuildExecutable\src\BuildExecutable.jl:54
in include_string(::String, ::String) at .\loading.jl:441
in include_string(::Module, ::String, ::String) at C:\Users\merdmann.julia\v0.5\CodeTools\src\eval.jl:32
in (::Atom.##61#64{String,String})() at C:\Users\merdmann.julia\v0.5\Atom\src\eval.jl:81
in withpath(::Atom.##61#64{String,String}, ::String) at C:\Users\merdmann.julia\v0.5\CodeTools\src\utils.jl:30
in withpath(::Function, ::String) at C:\Users\merdmann.julia\v0.5\Atom\src\eval.jl:46
in macro expansion at C:\Users\merdmann.julia\v0.5\Atom\src\eval.jl:79 [inlined]
in (::Atom.##60#63{String,String})() at .\task.jl:60
while loading C:...\julia_sandbox\compilejulia.jl, in expression starting on line 2
My Julia version is 0.5.0 release x86_64-w64-mingw32 - but why mingw32? Does this point to a 64bit/32bit conflict?
What I meant is executing the gcc
command outside julia. If this commands has now output it means that it succeeded. Did you run
gcc.exe '-LC:\Julia-0.5.0\bin' -shared -ljulia -lssp -o 'C:\Julia-0.5.0\bin\libapp.dll' 'C:\Julia-0.5.0\bin\libapp.o
?
Ok - indeed, when leaving out all single quotation marks (but only then), gcc.exe -LC:\Julia-0.5.0\bin -shared -ljulia -lssp -o C:\Julia-0.5.0\bin\libapp.dll C:\Julia-0.5.0\bin\libapp.o does succeed (has no output).
Good catch ! Let's see what @dhoegh thinks about it. Could you use the "Insert code" button to format the codes in your posts ? it makes it a lot more readable ;)
Ok, By the way, I just tried compiling under Linux (Ubuntu 16.04) and got a similar error.
@MatthiasErdmann I have looked into the issue you are having and it is not related to this issue. The main issue you are having is probably related to the issue I am displaying below. If I am trying to run the command manually in CMD on windows I get the following error:
@MatthiasErdmann I suspect that when you execute the command manually you use a globally installed GCC while BuildExecutable
uses a local one, installed by WinRPM
in something like C:\Users\d-hoe\.julia\v0.5\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\gcc.exe
.
Do any one have an idea what is causing the build to fail with missing libwinpthread-1.dll
? I suspect it is caused by an newer GCC. Appveyor has just begun failing, while a month old build succeeded.
From http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_Factory/x86_64/ it seems the GCC version was updated 2016-12-30.
Actually, I have used the local gcc installed by WinRPM
- Pkg.add("BuildExecutable") leads to the installation of gcc version 6.3.0 under C:\Users\"me"\.julia\v0.5\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin
.
However, I get no error message concerning libwinpthread-1.dll
. I don't know if this might give hint, but during installation of the BuildExecutable package there is an INFO: "Multiple package candidates found for mingw64-unistd-pthread-devel, picking newest".
Hi,
@MatthiasErdmann, I have the same problem.
You need to path your "C:\Users\"me".julia\v0.5\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin" in order to run the libwinpthread-1.dll. But after running, nothing happen.
Seem like the system execute the comment but there are no .exe file generated.
I'm experiencing the same problem as @MatthiasErdmann on Windows. I'll report more details tomorrow.
Good news, I have a fix for the windows issue in #30.
Thank you! Adding the bin dir of the local gcc (C:\Users\"me"\.julia\v0.5\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin
) to $PATH
works for me.
Thanks dhoegh.
I have now changed so BuildExecutable
to use precompiled image in #32. Please do a Pkg.checkout("BuildExecutable")
and verify it fixes the problem.
It works (at least on Mac). Thank you very much for the quick fix!
Hi. I've used
build_executable
to compile a very simple program:The produced executable takes over 6 seconds to run!
What is happening in those 6 seconds? Is it compilation? Is there a way to precompile everything I need?