dhoegh / buildexecutable.jl Goto Github PK
View Code? Open in Web Editor NEWBuild a standalone executables from a Julia script
License: Other
Build a standalone executables from a Julia script
License: Other
when using @generated
in conjunction with @nloops
, i get an UndefVarError(symbol("@nloops"))
error when the built executable is run on the command line. the code runs fine when (a) either macro is used alone, or (b) the source is evaluated in the REPL. any ideas? see code below.
importall Base.Cartesian
# this does NOT work
@generated function foo{T,N}(A::Array{T,N})
println(N)
quote
@nloops $N i A begin
println(@nref($N,A,i))
end
end
end
#= but this DOES work
@generated function foo(A)
println(A)
quote
println(A)
end
end
# and so DOES this
function foo(A)
@nloops 3 i A begin
println(@nref(3,A,i))
end
end
=#
function main()
println("hello world!")
foo(rand(3,3,3))
end
this blog seems relevant, but i don't entirely understand it.
Sorry, if this is a dumb question, but is there any way to have the ARGS constant set at runtime rather than compile time? I have a script that takes cmd line args and when I compile my script my arguments are being ignored when I try to run it, I'm assuming because the ARGS constant is set at compile time and doesn't change at runtime?
Thanks for making this package.
I am relatively new to Julia and am trying to get rid of the JIT overhead in my application.
Is it true, if I use BuildExecutable
and upon using the executable, I should get no JIT overhead ? So basically mimic a 2nd time call to the script (like we do for benchmarking) ?
thanks!
I have a .juliarc.jl
which pushes a folder to LOAD_PATH
. When I try to build_executable
a script which uses a package in that folder I get a
LoadError("C:\\Users\\amellnik\\Documents\\Julia libraries\\Foo\\src\\build.jl",
1,ArgumentError("Module Foo not found in current path.\nRun `Pkg.add(\"Foo\")`
to install the Foo package."))))
error, although using Foo
works when running the script or in the REPL.
I'm trying to build my Julia script into executable , but the build always hangs when processing
INFO: Building sys.o...
/home/peter/work/julia-903644385b/bin/julia -C native --output-ji /home/peter/work/julia-903644385b/lib/lib2584.ji --output-o /
home/peter/work/julia-903644385b/lib/lib2584.o -J /home/peter/work/julia-903644385b/lib/inference.ji --startup-file=no sysimg.jl
the build hangs, and also there are some defunct julia process when use ps -a
Any idea?
This env var is significant to the Julia runtime, and BuildExecutable should not be touching it.
The failure on linux master. some info about a possible fix see: libgit2/pygit2#134
I get the following error when I try to run BuildExecutable on my Julia script:
julia> build_executable("driver","monroe21_exp.jl","./betgt","native")
running: /Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia /Users/a598124/.julia/v0.6/BuildExecutable/src/build_sysimg.jl /Applications/Julia-0.6.app/Contents/Resources/julia/lib/libdriver native /var/folders/wt/z_hyfy7j6gnd73twq8cx_mw9lbx_3s/T/tmpdDKW3R/userimg.jl --force
ERROR: LoadError: UndefVarError: @unix_only not defined
Stacktrace:
[1] include_from_node1(::String) at ./loading.jl:576
[2] include(::String) at ./sysimg.jl:14
[3] process_options(::Base.JLOptions) at ./client.jl:305
[4] start() at ./client.jl:371
while loading /Users/a598124/.julia/v0.6/BuildExecutable/src/build_sysimg.jl, in expression starting on line 8
ERROR: failed process: Process(setenv(/Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia /Users/a598124/.julia/v0.6/BuildExecutable/src/build_sysimg.jl /Applications/Julia-0.6.app/Contents/Resources/julia/lib/libdriver native /var/folders/wt/z_hyfy7j6gnd73twq8cx_mw9lbx_3s/T/tmpdDKW3R/userimg.jl --force
,String["TERM_PROGRAM=Apple_Terminal", "SHELL=/bin/bash", "TERM=xterm-256color", "TMPDIR=/var/folders/wt/z_hyfy7j6gnd73twq8cx_mw9lbx_3s/T/", "Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.GHPI5Pgme3/Render", "TERM_PROGRAM_VERSION=388.1.1", "TERM_SESSION_ID=5B363BEB-0CA5-4E72-9C48-CD96BC1E1DE6", "USER=a598124", "LD_LIBRARY_PATH=/Users/a598124/Applications/IBM/ILOG/CPLEX_Studio1271/cplex/bin/x86-64_osx/:", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.a99GU9F1th/Listeners", "__CF_USER_TEXT_ENCODING=0x66BEA879:0x0:0x0", "PATH=/Applications/Julia-0.6.app/Contents/Resources/julia/bin:/Applications/Julia-0.6.app/Contents/Resources/julia/bin:/Users/a598124/anaconda2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin", "PWD=/Users/a598124", "LANG=en_US.UTF-8", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "SHLVL=1", "HOME=/Users/a598124", "LOGNAME=a598124", "=/Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia", "OPENBLAS_MAIN_FREE=1", "FONTCONFIG_PATH=/Applications/Julia-0.6.app/Contents/Resources/julia/etc/fonts", "TK_LIBRARY=/System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts"]), ProcessExited(1)) [1]
Stacktrace:
[1] pipeline_error(::Base.Process) at ./process.jl:682
[2] run(::Cmd) at ./process.jl:651
[3] #build_executable#1(::Bool, ::Bool, ::Function, ::String, ::String, ::String, ::String) at /Users/a598124/.julia/v0.6/BuildExecutable/src/BuildExecutable.jl:137
[4] build_executable(::String, ::String, ::String, ::String) at /Users/a598124/.julia/v0.6/BuildExecutable/src/BuildExecutable.jl:57
In build_sysimg.jl and in BuildExecutable.jl you build inference0...
the code from inference0 is identical with code from inference
but whats the point in building it?
You already build inference from coreimg. why do you need to build it twice?
Even if you would need inference0, wouldn't it be better to just copy & paste & rename inference.jii and inference.o?
i removed inference0 lines in build_sysimg.jl and in BuildExecutable.jl and my compiling went through without problems (system: windows 10 - x64).
Hi,
I am using Julia to compile a simple code.
function main()
println("It works")
end
Seems like it does not work.
There are two errors:
ERROR: LoadError: failed process: Process('C:\Users\bpng\.julia\v0.4\WinRPM\dep s\usr\x86_64-w64-mingw32\sys-root\mingw\bin\gcc.exe' '-LC:\Users\bpng\Julia-0.4. 6\bin' -shared -ljulia -lssp -o 'C:\Users\bpng\Julia-0.4.6\bin\libtryexe.exe.dll ' 'C:\Users\bpng\Julia-0.4.6\bin\libtryexe.exe.o'
, ProcessExited(1)) [1]
in run at process.jl:531
while loading C:\Users\bpng.julia\v0.4\BuildExecutable\src\build_sysimg.jl, in
expression starting on line 187
ERROR: failed process: Process('C:\Users\bpng\Julia-0.4.6\bin\julia' 'C:\Users\ bpng\.julia\v0.4\BuildExecutable\src\build_sysimg.jl' 'C:\Users\bpng\Julia-0.4.6 \bin\libtryexe.exe' native 'C:\Users\bpng\AppData\Local\Temp\julE00F.tmp\userimg .jl' --force
, ProcessExited(1)) [1]
in run at process.jl:531
May I know how can I solve them?
Thanks.
When I run the script:
using BuildExecutable
build_executable("neapolitan", "src/neapolitan-command.jl", "bin", "native")
I get this error:
ERROR: LoadError: Unable to modify /usr/lib/x86_64-linux-gnu/libneapolitan.ji
So it is trying to write to /usr/lib
! How to fix?
Test Failed under julia 0.6
As described in https://discourse.julialang.org/t/ann-plans-for-removing-packages-that-do-not-yet-support-1-0-from-the-general-registry/ we are planning on removing packages that do not support 1.0 from the General registry. This package has been detected to not support 1.0 and is thus slated to be removed. The removal of packages from the registry will happen approximately a month after this issue is open.
To transition to the new Pkg system using Project.toml
, see https://github.com/JuliaRegistries/Registrator.jl#transitioning-from-require-to-projecttoml.
To then tag a new version of the package, see https://github.com/JuliaRegistries/Registrator.jl#via-the-github-app.
If you believe this package has erroneously been detected as not supporting 1.0 or have any other questions, don't hesitate to discuss it here or in the thread linked at the top of this post.
Hi!
I am running Pkg.test("BuildExecutable")
after starting Julia with admin privileges sudo Julia
and using the latest clone:
julia> Pkg.status()
20 required packages:
- ArrayViews 0.6.4
- Atom 0.5.10
- BuildExecutable 0.1.2+ master
and I get the error,
Error During Test
Test threw an exception of type ArgumentError
Expression: build_executable(exename,script,targetdir,"native"; force=false) == 0
ArgumentError: '/home/loic/.julia/v0.5/BuildExecutable/test/test_dir/libssh2.so.1' exists. `remove_destination=true` is required to remove '/home/loic/.julia/v0.5/BuildExecutable/test/test_dir/libssh2.so.1' before copying.
which is odd since, as far as I can tell, that directory is not even created prior to running the test (in reference to a comment from #5 that make sure to delete files from targetdir beforehand)
What am I missing?
Thanks!
Loic
I'm guessing that BuildExecutable.jl should probably install patchelf on linux distros?
Julia v0.6 @ Win10 64bit. I got the following error message.
C:\Users\chbian\.julia\v0.6\BuildExecutable\test\test_dir\test_executable.exe successfully created.
ERROR: LoadError: failed process: Process(`'C:\Users\chbian\.julia\v0.6\BuildExecutable\test\test_dir1\test_executable.exe' -arg1 arg2 -arg3 arg4`, ProcessExited(3221225725)) [3221225725]
Stacktrace:
[1] pipeline_error(::Base.Process) at .\process.jl:682
[2] read(::Cmd, ::Base.DevNullStream) at .\process.jl:629
[3] readstring at .\process.jl:634 [inlined] (repeats 2 times)
[4] macro expansion at C:\Users\chbian\.julia\v0.6\BuildExecutable\test\runtests.jl:13 [inlined]
[5] anonymous at .\<missing>:?
[6] include_from_node1(::String) at .\loading.jl:569
[7] include(::String) at .\sysimg.jl:14
[8] process_options(::Base.JLOptions) at .\client.jl:305
[9] _start() at .\client.jl:371
while loading C:\Users\chbian\.julia\v0.6\BuildExecutable\test\runtests.jl, in expression starting on line 9
=========================================================================================================[ ERROR: BuildExecutable ]==========================================================================================================
failed process: Process(`'C:\Users\chbian\AppData\Local\Julia-0.6.0\bin\julia.exe' -Cx86-64 '-JC:\Users\chbian\AppData\Local\Julia-0.6.0\lib\julia\sys.dll' --compile=yes --depwarn=yes --check-bounds=yes --code-coverage=none --color=yes --compilecache=yes 'C:\Users\chbian\.julia\v0.6\BuildExecutable\test\runtests.jl'`, ProcessExited(1)) [1]
=============================================================================================================================================================================================================================================
Might be good to tag a new release on METADATA. Also, would you be interested in a co-maintainer?
Sorry to bug you folks again, but would it be possible to give build_executable
an option to bundle julia and all its dependencies into the executable for distributing to other machines that don't have julia installed?
For example, if I build my playground script on my host machine and try to transfer the build directory to a vm I get the following error.
$ ./playground
dyld: Library not loaded: @rpath/libjulia.dylib
Referenced from: /Volumes/Playground.jl/deps/usr/build/./playground
Reason: image not found
Trace/BPT trap: 5
From what I can tell the julia rpath is hard coded to the machine the executable was built on
otool -l playground
...
Load command 15
cmd LC_RPATH
cmdsize 96
path /Users/rory/.playground/src/julia-0.4_2015-11-30/Contents/Resources/julia/lib/julia (offset 12)
...
Hello,
I encountered a issue when trying to build an executable from 'zela.jl'
zela.jl : " f = open("input.txt")
lines = readlines(f)
print(lines[2])
close(f) "
for a simple input.txt : " 100
11
12 "
Below is the result of the running in Julia with error:
julia> build_executable("Zela","Zela.jl","/Dada","native")
running: C:\julia\bin\julia C:\Users\1.julia\v0.4\BuildExecutable\src\build_sysimg.jl C:\julia\bin\libZela native C:\Users\1\AppData\Local\Temp\jul1069.tmp\userimg.jl --force
INFO: Building inference0.o...
C:\julia\bin\julia -C native --output-ji C:\julia\bin\inference0.ji --output-o C:\julia\bin\inference0.o coreimg.jl
essentials.jl
reflection.jl
options.jl
promotion.jl
tuple.jl
range.jl
expr.jl
error.jl
bool.jl
number.jl
int.jl
operators.jl
pointer.jl
abstractarray.jl
array.jl
hashing.jl
nofloat_hashing.jl
functors.jl
reduce.jl
intset.jl
dict.jl
iterator.jl
inference.jl
INFO: Building inference.o...
C:\julia\bin\julia -C native --output-ji C:\julia\bin\inference.ji --output-o C:\julia\bin\inference.o coreimg.jl
essentials.jl
reflection.jl
options.jl
promotion.jl
tuple.jl
range.jl
expr.jl
error.jl
bool.jl
number.jl
int.jl
operators.jl
pointer.jl
abstractarray.jl
array.jl
hashing.jl
nofloat_hashing.jl
functors.jl
reduce.jl
intset.jl
dict.jl
iterator.jl
inference.jl
INFO: Building sys.o...
C:\julia\bin\julia -C native --output-ji C:\julia\bin\libZela.ji --output-o C:\julia\bin\libZela.o -J C:\julia\bin\inference.ji --startup-file=no sysimg.jl
exports.jl
essentials.jl
docs/bootstrap.jl
base.jl
reflection.jl
build_h.jl
version_git.jl
c.jl
options.jl
promotion.jl
tuple.jl
range.jl
expr.jl
error.jl
bool.jl
number.jl
int.jl
operators.jl
pointer.jl
refpointer.jl
functors.jl
abstractarray.jl
subarray.jl
array.jl
hashing.jl
rounding.jl
float.jl
complex.jl
rational.jl
abstractarraymath.jl
arraymath.jl
simdloop.jl
reduce.jl
bitarray.jl
intset.jl
dict.jl
set.jl
iterator.jl
osutils.jl
char.jl
ascii.jl
iobuffer.jl
string.jl
strings/types.jl
strings/basic.jl
strings/search.jl
strings/util.jl
strings/io.jl
unicode.jl
unicode/UnicodeError.jl
unicode/types.jl
unicode/checkstring.jl
unicode/utf8.jl
unicode/utf16.jl
unicode/utf32.jl
unicode/utf8proc.jl
parse.jl
shell.jl
regex.jl
pcre.jl
base64.jl
io.jl
iostream.jl
libc.jl
libdl.jl
env.jl
path.jl
intfuncs.jl
nullable.jl
task.jl
lock.jl
show.jl
stream.jl
uv_constants.jl
socket.jl
stat.jl
fs.jl
process.jl
multimedia.jl
grisu.jl
file.jl
methodshow.jl
floatfuncs.jl
math.jl
float16.jl
cartesian.jl
multidimensional.jl
primes.jl
reducedim.jl
ordering.jl
collections.jl
sort.jl
version.jl
gmp.jl
mpfr.jl
combinatorics.jl
hashing2.jl
dSFMT.jl
random.jl
printf.jl
meta.jl
Enums.jl
serialize.jl
channels.jl
multi.jl
managers.jl
loading.jl
poll.jl
mmap.jl
sharedarray.jl
datafmt.jl
deepcopy.jl
interactiveutil.jl
replutil.jl
test.jl
i18n.jl
Terminals.jl
LineEdit.jl
REPLCompletions.jl
REPL.jl
client.jl
util.jl
linalg.jl
broadcast.jl
statistics.jl
sparse.jl
irrationals.jl
dft.jl
dsp.jl
sysinfo.jl
quadgk.jl
fastmath.jl
pkg.jl
profile.jl
Dates.jl
markdown/Markdown.jl
docs/Docs.jl
deprecated.jl
require.jl
docs/helpdb.jl
docs/basedocs.jl
C:\julia\share\julia\base\precompile.jl
error during bootstrap:
LoadError(at "sysimg.jl" line 319: LoadError(at "C:\julia\share\julia\base\userimg.jl" line 1: LoadError(at "C:\julia\Zela.jl" line 1: Base.SystemError(prefix="opening file input.txt", errnum=2))))
jl_unprotect_stack at C:\julia\bin\libjulia.dll (unknown line)
jl_throw at C:\julia\bin\libjulia.dll (unknown line)
jl_throw_with_superfluous_argument at C:\julia\bin\libjulia.dll (unknown line)
open at iostream.jl:90
open at iostream.jl:99
jl_apply_generic at C:\julia\bin\libjulia.dll (unknown line)
jl_interpret_toplevel_expr at C:\julia\bin\libjulia.dll (unknown line)
jl_interpret_toplevel_thunk_with at C:\julia\bin\libjulia.dll (unknown line)
jl_interpret_toplevel_thunk_with at C:\julia\bin\libjulia.dll (unknown line)
jl_interpret_toplevel_expr_in at C:\julia\bin\libjulia.dll (unknown line)
jl_toplevel_eval_body at C:\julia\bin\libjulia.dll (unknown line)
jl_eval_with_compiler_p at C:\julia\bin\libjulia.dll (unknown line)
jl_parse_eval_all at C:\julia\bin\libjulia.dll (unknown line)
jl_load_ at C:\julia\bin\libjulia.dll (unknown line)
include at boot.jl:261
jl_apply_generic at C:\julia\bin\libjulia.dll (unknown line)
include_from_node1 at loading.jl:304
jl_apply_generic at C:\julia\bin\libjulia.dll (unknown line)
jl_interpret_toplevel_expr at C:\julia\bin\libjulia.dll (unknown line)
jl_interpret_toplevel_thunk_with at C:\julia\bin\libjulia.dll (unknown line)
jl_eval_with_compiler_p at C:\julia\bin\libjulia.dll (unknown line)
jl_parse_eval_all at C:\julia\bin\libjulia.dll (unknown line)
jl_load_ at C:\julia\bin\libjulia.dll (unknown line)
include at boot.jl:261
jl_apply_generic at C:\julia\bin\libjulia.dll (unknown line)
include_from_node1 at loading.jl:304
jl_apply_generic at C:\julia\bin\libjulia.dll (unknown line)
jl_interpret_toplevel_expr at C:\julia\bin\libjulia.dll (unknown line)
jl_interpret_toplevel_thunk_with at C:\julia\bin\libjulia.dll (unknown line)
jl_interpret_toplevel_expr_in at C:\julia\bin\libjulia.dll (unknown line)
jl_toplevel_eval_body at C:\julia\bin\libjulia.dll (unknown line)
jl_eval_with_compiler_p at C:\julia\bin\libjulia.dll (unknown line)
jl_parse_eval_all at C:\julia\bin\libjulia.dll (unknown line)
jl_load at C:\julia\bin\libjulia.dll (unknown line)
unknown function (ip: 00000000004015BE)
unknown function (ip: 0000000000401AE5)
unknown function (ip: 00000000004028AB)
unknown function (ip: 000000000040140C)
unknown function (ip: 000000000040153B)
BaseThreadInitThunk at C:\WINDOWS\system32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
ERROR: LoadError: failed process: Process('C:\julia\bin\julia' -C native --output-ji 'C:\julia\bin\libZela.ji' --output-o 'C:\julia\bin\libZela.o' -J 'C:\julia\bin\inference.ji' --startup-file=no sysimg.jl
, ProcessExited(1)) [1]
in run at process.jl:531
while loading C:\Users\1.julia\v0.4\BuildExecutable\src\build_sysimg.jl, in expression starting on line 187
ERROR: failed process: Process('C:\julia\bin\julia' 'C:\Users\1\.julia\v0.4\BuildExecutable\src\build_sysimg.jl' 'C:\julia\bin\libZela' native 'C:\Users\1\AppData\Local\Temp\jul1069.tmp\userimg.jl' --force
, ProcessExited(1)) [1]
in run at process.jl:531
WARNING: `@windows_only` is deprecated, use `@static if is_windows()` instead
I guess that's easy to fix.
After compiling the system image, the compiler crashes a little after GCC starts.
INFO: Linking sys.dll
INFO: System image successfully built at C:\Program Files\Julia-0.6.2\bin\libwalkers.dll
INFO: To run Julia with this image loaded, run: julia -J C:\Program Files\Julia-0.6.2\bin\libwalkers.dll
running: C:\Users\LeMinaw\.julia\v0.6\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\gcc.exe -g `-D_WIN32_WINNT=0x0502` -IC:\Program Files\Julia-0.6.2\include\julia -IC:\Program Files\src -IC:\Program Files\src/support -IC:\Program Files\usr/include -IC:\Users\LeMinaw\.julia\v0.6\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\include C:\Users\LeMinaw\AppData\Local\Temp\jl_7076.tmp\start_func.c -o C:\Program Files\Julia-0.6.2\bin\walkers.exe -Wl,-rpath,C:\Program Files\Julia-0.6.2\bin -LC:\Program Files\Julia-0.6.2\bin -ljulia -lwalkers
C:\Users\LeMinaw\AppData\Local\Temp\jl_7076.tmp\start_func.c: In function 'main':
C:\Users\LeMinaw\AppData\Local\Temp\jl_7076.tmp\start_func.c:55:9: warning: implicit declaration of function 'jl_show'; did you mean 'jl_throw'? [-Wimplicit-function-declaration]
jl_show(jl_stderr_obj(), jl_exception_occurred());
^~~~~~~
jl_throw
C:\Users\LeMinaw\AppData\Local\Temp\ccrKmEKI.o: In function `main':
C:/Users/LeMinaw/AppData/Local/Temp/jl_7076.tmp/start_func.c:55: undefined reference to `jl_show'
collect2.exe: error: ld returned 1 exit status
Hi.
I've used build_executable
to compile a very simple program:
function main()
for x in ARGS
println("Hi: $x")
end
end
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?
Hi,
I've been having a lot of trouble trying to compile a julia program to a standalone binary. I want to do this in order to run a program on a cluster that does not have Julia installed. Perhaps you have some advice.
I keep getting an error:
ERROR: LoadError: failed process: Process(`/usr/bin/julia -C native --output-ji /usr/lib/julia/lib..ji --output-o /usr/lib/julia/lib..o -J /usr/lib/julia/inference.ji --startup-file=no sysimg.jl`, ProcessExited(1)) [1]
in anonymous at /usr/share/julia/build_sysimg.jl:66
in build_sysimg at /usr/share/julia/build_sysimg.jl:27
while loading /usr/share/julia/build_sysimg.jl, in expression starting on line 175
ERROR: LoadError: failed process: Process(`/usr/bin/julia /usr/share/julia/build_sysimg.jl /usr/lib/julia/lib. native /tmp/tmpdemsq8/userimg.jl --force`, ProcessExited(1)) [1]
in build_executable at /usr/share/julia/build_executable.jl:109
in build_executable at /usr/share/julia/build_executable.jl:58
while loading /usr/share/julia/build_executable.jl, in expression starting on line 277
This is my program:
function main()
println("HELLO WORLD")
end
And the command I'm running is
julia /usr/share/julia/build_executable.jl helloworld /home/gideon/hello_world/hello_world.jl --force
Thanks!
Are there any plans to support binary dependencies at any time in the future? (Like by sharing the dependencies for all OS together packed into the executable file and then extracted to a temp directory)
I met UndefVarError(:alk) error after I run the built binary.
alk() is definied by my module, and I've import the module before main()
If I call main() in REPL everything works well, but it fails if I run the executable
OS: Mac OSX
Julia v0.5
Hi All,
Anyone can compile added packages? I am using the package "interpolations" but it seems that the system will not link this package into the executable.
Also, can I use "include("filename.jl")" in the executable?
Thanks for your advice.
Just tried this on OS X and hit a wall when trying to compile this test:
mkdir julia
julia
...
julia> build_executable("brainfuck.jl.exe", "brainfuck.jl", "julia", "native")
running: /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/bin/julia /Users/username/.julia/v0.4/BuildExecutable/src/build_sysimg.jl /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/libbrainfuck.jl.exe native /var/folders/9d/8nhvlfxn1yscm28dwfcdkjm40000gn/T/tmpSEMbG8/userimg.jl --force
INFO: Building inference0.o...
/opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/bin/julia -C native --output-ji /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/inference0.ji --output-o /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/inference0.o coreimg.jl
essentials.jl
reflection.jl
options.jl
promotion.jl
tuple.jl
range.jl
expr.jl
error.jl
bool.jl
number.jl
int.jl
operators.jl
pointer.jl
abstractarray.jl
array.jl
hashing.jl
nofloat_hashing.jl
functors.jl
reduce.jl
intset.jl
dict.jl
iterator.jl
inference.jl
INFO: Building inference.o...
/opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/bin/julia -C native --output-ji /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/inference.ji --output-o /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/inference.o coreimg.jl
essentials.jl
reflection.jl
options.jl
promotion.jl
tuple.jl
range.jl
expr.jl
error.jl
bool.jl
number.jl
int.jl
operators.jl
pointer.jl
abstractarray.jl
array.jl
hashing.jl
nofloat_hashing.jl
functors.jl
reduce.jl
intset.jl
dict.jl
iterator.jl
inference.jl
INFO: Building sys.o...
/opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/bin/julia -C native --output-ji /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/libbrainfuck.jl.exe.ji --output-o /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/libbrainfuck.jl.exe.o -J /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/inference.ji --startup-file=no sysimg.jl
exports.jl
essentials.jl
docs/bootstrap.jl
base.jl
reflection.jl
build_h.jl
version_git.jl
c.jl
options.jl
promotion.jl
tuple.jl
range.jl
expr.jl
error.jl
bool.jl
number.jl
int.jl
operators.jl
pointer.jl
refpointer.jl
functors.jl
abstractarray.jl
subarray.jl
array.jl
hashing.jl
rounding.jl
float.jl
complex.jl
rational.jl
abstractarraymath.jl
arraymath.jl
simdloop.jl
reduce.jl
bitarray.jl
intset.jl
dict.jl
set.jl
iterator.jl
osutils.jl
char.jl
ascii.jl
iobuffer.jl
string.jl
strings/types.jl
strings/basic.jl
strings/search.jl
strings/util.jl
strings/io.jl
unicode.jl
unicode/UnicodeError.jl
unicode/types.jl
unicode/checkstring.jl
unicode/utf8.jl
unicode/utf16.jl
unicode/utf32.jl
unicode/utf8proc.jl
parse.jl
shell.jl
regex.jl
pcre.jl
base64.jl
io.jl
iostream.jl
libc.jl
libdl.jl
env.jl
path.jl
intfuncs.jl
nullable.jl
task.jl
lock.jl
show.jl
stream.jl
uv_constants.jl
socket.jl
stat.jl
fs.jl
process.jl
multimedia.jl
grisu.jl
file.jl
methodshow.jl
floatfuncs.jl
math.jl
float16.jl
cartesian.jl
multidimensional.jl
primes.jl
reducedim.jl
ordering.jl
collections.jl
sort.jl
version.jl
gmp.jl
mpfr.jl
combinatorics.jl
hashing2.jl
dSFMT.jl
random.jl
printf.jl
meta.jl
Enums.jl
serialize.jl
channels.jl
multi.jl
managers.jl
loading.jl
poll.jl
mmap.jl
sharedarray.jl
datafmt.jl
deepcopy.jl
interactiveutil.jl
replutil.jl
test.jl
i18n.jl
Terminals.jl
LineEdit.jl
REPLCompletions.jl
REPL.jl
client.jl
util.jl
linalg.jl
broadcast.jl
statistics.jl
sparse.jl
irrationals.jl
dft.jl
dsp.jl
sysinfo.jl
quadgk.jl
fastmath.jl
pkg.jl
profile.jl
Dates.jl
markdown/Markdown.jl
docs/Docs.jl
deprecated.jl
require.jl
docs/helpdb.jl
docs/basedocs.jl
/opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/share/julia/base/precompile.jl
error during bootstrap:
LoadError(at "sysimg.jl" line 319: LoadError(at "/opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/share/julia/base/userimg.jl" line 1: LoadError(at "/Users/username/Developer/misc/benchmarks/brainfuck/brainfuck.jl" line 88: BoundsError(a=Array{UTF8String, 1}[], i=(1,)))))
rec_backtrace at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/task.c:658
jl_bounds_error_ints at /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/libjulia.dylib (unknown line)
main at /Users/username/Developer/misc/benchmarks/brainfuck/brainfuck.jl:83
jlcall_main_21722 at (unknown line)
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:1691
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:55
eval at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:213
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:527
jl_parse_eval_all at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:577
jl_load at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:620
include at boot.jl:261
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1325
include_from_node1 at loading.jl:304
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1325
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:55
eval at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:213
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:527
jl_parse_eval_all at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:577
jl_load at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:620
include at boot.jl:261
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1325
include_from_node1 at loading.jl:304
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1325
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:55
eval at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:213
eval_body at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:561
jl_toplevel_eval_body at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:525
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:521
jl_parse_eval_all at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:577
jl_load at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:620
exec_program at /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/bin/julia (unknown line)
true_main at /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/bin/julia (unknown line)
main at /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/bin/julia (unknown line)
ERROR: LoadError: failed process: Process(`/opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/bin/julia -C native --output-ji /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/libbrainfuck.jl.exe.ji --output-o /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/libbrainfuck.jl.exe.o -J /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/inference.ji --startup-file=no sysimg.jl`, ProcessExited(1)) [1]
in run at /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in anonymous at /Users/username/.julia/v0.4/BuildExecutable/src/build_sysimg.jl:77
in cd at /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in build_sysimg at /Users/username/.julia/v0.4/BuildExecutable/src/build_sysimg.jl:38
in include at /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in include_from_node1 at /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in process_options at /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in _start at /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
while loading /Users/username/.julia/v0.4/BuildExecutable/src/build_sysimg.jl, in expression starting on line 187
ERROR: failed process: Process(`/opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/bin/julia /Users/username/.julia/v0.4/BuildExecutable/src/build_sysimg.jl /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/libbrainfuck.jl.exe native /var/folders/9d/8nhvlfxn1yscm28dwfcdkjm40000gn/T/tmpSEMbG8/userimg.jl --force`, ProcessExited(1)) [1]
in run at /opt/homebrew-cask/Caskroom/julia/0.4.2/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in build_executable at /Users/username/.julia/v0.4/BuildExecutable/src/BuildExecutable.jl:116
Fails with @unix_only not defined
on:
i work on 3 operating systems and 3 computers .
from all operating systems ,
compiling on windows 7 doesn't work beyond 'native'
*** on windows 7 , i tried, 'core2', 'i386', 'i686', 'generic',
all produce the 'rint' error (on the same computer complied)
*** the 'corei7' did progress a bit ,
yet there was error message after 5 second run
with long error message
*** the 'core-avx2' and 'core-avx-i' did not compile at all
(the same computer with ubuntu , the 'core2' did work)
(the same computer with windows 10 , the 'core2' did work, yet the 'core-avx-i' did not compile)
preparing the 'core-avx-i' on windows 8 (different computer),
the exe file did not work on windows 7 (worked just on windows 8 computer) .
that was not surprised, yet the 'corei7' exe from windows 7 did work on the second computer with windows 8 .
The cpu where the windows 7 (& windows 10 and ubuntu 16.04.2) is : core intel, E8500
The cpu where the windows 8 (& ubuntu 16.04.2) is : core intel, i5 4200
how to solve the problem with windows 7??
(the computer cpu with the windows 7 in the category SSE4.1 and the target for that is 'core-avx-i' yet that produced the error during compilation )
I have created this repository because the build_executable.jl
in base is left alone in broken condition for long periods. The test of the script pressure the CI and hence is untested in base. I have gotten the scripts in working condition locally on both Windows and Ubuntu. Appveyor is setup to run weakly and as of now the test are passing on both 0.4 and master.
The Plan is to:
BuildExecutable.jl
at METADATA.jl
build_executable.jl
from Basecc @tkelman
This repository are the actions we discussed in: JuliaLang/julia#11101. Could you take a look at Travis, I cannot seem to get Travis working?
When use this package in Julia 1.0, build failed
using BuildExecutable
[ Info: Precompiling BuildExecutable [eaca7b4f-722b-5502-8392-1e2735fc81dc]
ERROR: LoadError: syntax: extra token "Executable" after end of expression
Stacktrace:
[1] include at ./boot.jl:317 [inlined]
[2] include_relative(::Module, ::String) at ./loading.jl:1038
[3] include(::Module, ::String) at ./sysimg.jl:29
[4] top-level scope at none:2
[5] eval at ./boot.jl:319 [inlined]
[6] eval(::Expr) at ./client.jl:389
[7] top-level scope at ./none:3
in expression starting at /Users/daxiawj/.julia/packages/BuildExecutable/371eK/src/BuildExecutable.jl:17
ERROR: Failed to precompile BuildExecutable [eaca7b4f-722b-5502-8392-1e2735fc81dc] to /Users/daxiawj/.julia/compiled/v1.0/BuildExecutable/vpEFu.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
[4] macro expansion at ./logging.jl:311 [inlined]
[5] _require(::Base.PkgId) at ./loading.jl:941
[6] require(::Base.PkgId) at ./loading.jl:852
[7] macro expansion at ./logging.jl:311 [inlined]
[8] require(::Module, ::Symbol) at ./loading.jl:834
I have successfully compiled all my programs and used them in my computer (windows 10). But I am having portability issues.
When I compile on my "windows 10 64bits core i7-5500U" with cpu_target="core2"
it works on all other i7 I could test on. However, when I use that on an amazon "Windows Server2012-R2 with Intel Xeon E5-2670 v2" I get the following error:
LLVM ERROR: Program used external function 'rint' which could not be resolved!
rint
seems to be from openlibm
.
If I compile on the amazon windows server with cpu_target="native"
everything works smoothly. However, I could not compile it with no other cpu_target
, I tried: core2
, i686
, generic
, i386
.
Any Ideas?
Which cpu_target
is used for the julia distribution?
Note that the same julia distribution (0.5.1 64bits) works perfectly on all the machines mentioned here, I copied and pasted the whole folder to confirm.
@ViralBShah recently posted a different approach to building binaries from Julia code on Discourse. See this comment for some differences. Should the functionality of https://github.com/JuliaComputing/static-julia (which is currently more of a tech demo than a full-fledged utility) be incorporated into BuildExecutable?
I was just trying to see if it was possible to use this to compile a simple mathematical optimization problem, and found that the example Sudoku solver on the JuMP.jl website does not compile. The error reported is a problem with not be able to find the STDERR variable. I've checked and this runs when I just call main from julia.
I'm using Julia version 0.4.5, and BuildExecutable version 0.0.3.
Here is my attempt:
import JuMP
function main()
# Create a model
sudoku = JuMP.Model()
# Create our variables
@JuMP.defVar(sudoku, x[i=1:9, j=1:9, k=1:9], Bin)
for i = 1:9, j = 1:9 # Each row and each column
# Sum across all the possible digits
# One and only one of the digits can be in this cell,
# so the sum must be equal to one
@JuMP.addConstraint(sudoku, sum{x[i,j,k],k=1:9} == 1)
end
for ind = 1:9 # Each row, OR each column
for k = 1:9 # Each digit
# Sum across columns (j) - row constraint
@JuMP.addConstraint(sudoku, sum{x[ind,j,k],j=1:9} == 1)
# Sum across rows (i) - column constraint
@JuMP.addConstraint(sudoku, sum{x[i,ind,k],i=1:9} == 1)
end
end
for i = 1:3:7, j = 1:3:7, k = 1:9
# i is the top left row, j is the top left column
# We'll sum from i to i+2, e.g. i=4, r=4, 5, 6
@JuMP.addConstraint(sudoku, sum{x[r,c,k], r=i:i+2, c=j:j+2} == 1)
end
init_sol = [ 5 3 0 0 7 0 0 0 0;
6 0 0 1 9 5 0 0 0;
0 9 8 0 0 0 0 6 0;
8 0 0 0 6 0 0 0 3;
4 0 0 8 0 3 0 0 1;
7 0 0 0 2 0 0 0 6;
0 6 0 0 0 0 2 8 0;
0 0 0 4 1 9 0 0 5;
0 0 0 0 8 0 0 7 9]
for i = 1:9, j = 1:9
# If the space isn't empty
if init_sol[i,j] != 0
# Then the corresponding variable for that digit
# and location must be 1
@JuMP.addConstraint(sudoku, x[i,j,init_sol[i,j]] == 1)
end
end
JuMP.solve(sudoku)
# Extract the values of x
x_val = JuMP.getValue(x)
# Create a matrix to store the solution
sol = zeros(Int,9,9) # 9x9 matrix of integers
for i in 1:9, j in 1:9, k in 1:9
# Integer programs are solved as a series of linear programs
# so the values might not be precisely 0 and 1. We can just
# round them to the nearest integer to make it easier
if iround(x_val[i,j,k]) == 1
sol[i,j] = k
end
end
# Display the solution
println(sol)
end
Here's the error:
LoadError(at "sysimg.jl" line 319: LoadError(at "/Applications/Julia-0.4.5.app/Contents/Resources/julia/share/julia/base/userimg.jl" line 1: LoadError(at "/Users/davidlittle/main.jl" line 67: UndefVarError(var=:STDERR))))
rec_backtrace at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/task.c:658
eval at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:322
jl_parse_eval_all at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:577
jl_load at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:620
include at boot.jl:261
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1331
include_from_node1 at loading.jl:320
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1331
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:56
eval at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:230
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:527
jl_parse_eval_all at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:577
jl_load at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:620
include at boot.jl:261
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1331
include_from_node1 at loading.jl:320
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1331
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:56
eval at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:230
eval_body at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:581
jl_toplevel_eval_body at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:545
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:521
jl_parse_eval_all at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:577
jl_load at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:620
exec_program at /Applications/Julia-0.4.5.app/Contents/Resources/julia/bin/julia (unknown line)
true_main at /Applications/Julia-0.4.5.app/Contents/Resources/julia/bin/julia (unknown line)
main at /Applications/Julia-0.4.5.app/Contents/Resources/julia/bin/julia (unknown line)
Hi
I've been trying to build a small form project which uses:
https://github.com/JuliaGraphics/Gtk.jl
I've tried a simple test project which isn't using Gtk and that builds just fine, so I'm assuming its down to paths maybe or BuildExecutable probably wont work with it?
Any insight would be great
using Gtk.ShortNames
function main()
win = Window("My window")
setproperty!(win, :title, "New title")
f = Frame("A frame")
push!(win, f)
ok = Button("OK")
push!(f, ok)
showall(win)
id = signal_connect(ok, "clicked") do widget
println(widget, " was clicked!")
end
end
main()
thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.