-
Notifications
You must be signed in to change notification settings - Fork 15
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
tracking: Building an application that uses Blink.jl
#5
Comments
@ranjanan: Regarding your comment about Is this what you're seeing, too?:
|
Okay!! I think i've fixed most of the problems! I've just uploaded Here is the whole command I used to build the app (including signing it so I could share it here): $ julia ~/.julia/v0.6/ApplicationBuilder/build_app.jl \
-R ~/.julia/v0.6/Blink/deps/Julia.app \
-R ~/.julia/v0.6/Blink/src/AtomShell/main.js \
-R ~/.julia/v0.6/Blink/src/content/main.html \
-R ~/.julia/v0.6/Blink/res \
-L ~/.julia/v0.6/HttpParser/deps/usr/lib/libhttp_parser.dylib \
-L ~/.julia/v0.6/MbedTLS/deps/usr/lib/libmbedcrypto.2.7.1.dylib \
--bundle_identifier "com.nhdalyMadeThis.HelloBlink" --app_version=0.1 --certificate "Developer ID Application: nhdalyMadeThis, LLC" \
examples/blink.jl "HelloBlink" && ./builddir/HelloBlink.app/Contents/MacOS/blink
|
So that's good news! The one remaining problem I'm having is that the OS seems to forget the application is open, so if you double-click it again while it's already open, a second version of the app will open and then hang forever. It even refused to Force Quit (I had to restart to get it to quit). :( I'm assuming it's something to do with the fact that the application opens the embedded Julia.app after starting, and it's then running two Mac Applications, and this somehow bothers the OS. Interestingly, it shows up in Activity Monitor as two different apps: |
So actually, reading a bit more, I wonder if the right way to do this for apps using That is, perhaps instead of embedding a prebuilt Electron app inside our application, maybe we should be building a new Electron app which contains our compiled code? Figuring that out seems like a fair amount of work, though.... |
@NHDaly thank you for all your work and progress. Yes, that is indeed what I was referring to when I said I ran into another problem with Blink: I have made some progress on Windows, and I have a Blink app that works whenever you double click on the As for the electron builder stuff, that's a complete tangent. I think people only care about having their Julia code be packaged and shipped in as easy a manner as possible, and I think what we have now for Blink is good enough. More soon, along with my PR! |
:D That all sounds excellent! Thanks for your help! I'm excited to see a windows build!!
Great! I'm glad we got that figured out.
!! Yes please! :D
Yeah i think that's a good idea. I've been thinking it would make sense to follow the format of https://github.com/JuliaLang/PackageCompiler.jl, where all the functionality is in |
sounds good! |
Hey, @ranjanan. Are you still able to statically compile a Blink application using this package? I've found that when I try now, I can't get it to work. See this branch for the failing test: ApplicationBuilder.jl/test/BuildApp.jl Line 65 in c1e5a54
I'm testing that it is in fact working without julia installed -- and sadly, it isn't. I am currently planning on using a Blink example in my talk, but I'm sad that I can't show it fully self-contained. :( Are you able to get this to work? The problem I'm currently stuck on is that MacroTools uses this |
@NHDaly you could try to go back in history with |
Hi @NHDaly, do you happen to have the error trace in a gist somewhere? |
@lucatrv thanks that's a good idea. Sadly, the problem isn't with this package, it's that Blink and all of its dependent packages have changed. We might still be able to get it to work, but my suspicion is that it's joined GTK and TK and the other packages whose So I think this class of problems can only be solved by modifying the packages themselves, and/or BinDeps, BinaryProvider, etc, which actually set those hard-coded paths. |
@ranjanan No, i don't yet.. I'll put something together to share! :) |
@NHDaly, I think we should be able to send PRs to make generic changes to every package we need to make them statically compilable (and therefore shippable). Packages will definitely have an interest in being shippable. |
@ranjanan Okay, it's not a gist, but will this do? I've pushed up a commit with a new 74d8667 But tl;dr, it builds Blink using the current example build file here, and then renames 17:48:32 $ mv ~/.julia ~/.julia.bak
17:48:33 $ /var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmp9mz15V/HelloBlink.app/Contents/MacOS/blink
WARNING: redefining constant JULIA_HOME
fatal: error thrown and no exception handler available.
Base.InitError(mod=:MacroTools, error=Base.SystemError(prefix="opening file /Users/daly/.julia/v0.6/MacroTools/src/../animals.txt", errnum=2, extrainfo=nothing))
rec_backtrace at /private/var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmp9mz15V/HelloBlink.app/Contents/MacOS/libjulia.dylib (unknown line)
jl_throw at /private/var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmp9mz15V/HelloBlink.app/Contents/MacOS/libjulia.dylib (unknown line)
systemerror at /private/var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmp9mz15V/HelloBlink.app/Contents/MacOS/blink.dylib (unknown line)
open at /private/var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmp9mz15V/HelloBlink.app/Contents/MacOS/blink.dylib (unknown line)
open at /private/var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmp9mz15V/HelloBlink.app/Contents/MacOS/blink.dylib (unknown line)
__init__ at /private/var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmp9mz15V/HelloBlink.app/Contents/MacOS/blink.dylib (unknown line)
jlcall___init___4507 at /private/var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmp9mz15V/HelloBlink.app/Contents/MacOS/blink.dylib (unknown line)
jl_module_run_initializer at /private/var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmp9mz15V/HelloBlink.app/Contents/MacOS/libjulia.dylib (unknown line)
_julia_init at /private/var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmp9mz15V/HelloBlink.app/Contents/MacOS/libjulia.dylib (unknown line)
julia_init at /private/var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmp9mz15V/HelloBlink.app/Contents/MacOS/libjulia.dylib (unknown line)
main at /var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmp9mz15V/HelloBlink.app/Contents/MacOS/blink (unknown line)
17:48:43 $ mv ~/.julia.bak ~/.julia You can see it's trying to open a missing file from inside So then, I tried adding But the problem now is that it still can't find Base.InitError(mod=:MacroTools, error=Base.SystemError(prefix="opening file animals.txt", errnum=2, extrainfo=nothing)) So I think the takeaway here is that -- in order to be shippable -- a Package cannot do any initialization that references the filesystem in their |
Yeah, I agree. I think you're right. Figuring out the best way to do that, though, is maybe something we can talk to people about this week! :) |
Yes, the right fix is to put |
Or, maybe we could somehow disable running the module initializers when compiling, and then just manually call them all after doing the In fact, we could even do all that in C... which could be easier. |
Yeah that would be excellent!! :) I'll be in london tomorrow (monday) morning!!!!! :D |
Oh! Okay cool! With ranjan's help offline, i've fixed it! :) It required making this change to MacroTools, which i'll send a PR for later: yay |
Hi Guys, Nice discussion. @NHDaly thank you for putting so much effort on this. I had a lot of problems to run my executable in another computer with the HTTP package because of MbedTLS on Windows 10 and Julia 1.1.0. i solved by injecting this code inside my MbedTLS = HTTP.Servers.MbedTLS
if get(ENV, "COMPILING_APPLE_BUNDLE", "false") == "true"
# i had to clear out this const depsjl_path because
# it points to deps.jl which sets the lib paths in runtime
Core.eval(MbedTLS, :(const depsjl_path = ""))
# set lib path relative to PROGRAM_FILE path
# p.s. single \ or double \\ won't work.
# joinpath, abspath, dirname, etc will resolve to wrong paths and will break runtime
# thankfully julia works well with \\\\ and its possible to have
# relative paths to the executable installation
Core.eval(MbedTLS, :(const libmbedcrypto = "..\\\\lib\\\\$(basename(libmbedcrypto))"))
Core.eval(MbedTLS, :(const libmbedtls = "..\\\\lib\\\\$(basename(libmbedtls))"))
Core.eval(MbedTLS, :(const libmbedx509 = "..\\\\lib\\\\$(basename(libmbedx509))"))
else
# Check if PROGRAM_FILE is my program and not PackageCompiler
if occursin("MyOwnProgramName", PROGRAM_FILE)
this_path = abspath(dirname(PROGRAM_FILE))
cd(this_path) # cd there otherwise it won't find the libraries
end
end and my libraries array looks like this build_app_bundle(app_path,
appname="MyOwnProgramName",
snoopfile="call_functions.jl",
verbose=true,
create_installer=true,
libraries=[HTTP.Servers.MbedTLS.libmbedcrypto,
HTTP.Servers.MbedTLS.libmbedtls,
HTTP.Servers.MbedTLS.libmbedx509]) BTW, i think Cheers. |
I'm pulling out this issue to track our attempt to build and distribute an App that uses
Blink.jl
.Things we still need to solve:
Blink.jl
#5 (comment))juliac
fails to compile Blink.jl:JULIA_HOME not defined
JuliaLang/PackageCompiler.jl#47) (Fixed: Fix JULIA_HOME manually for all builds. JuliaLang/PackageCompiler.jl#55)Blink.resources
doesn't seem to change (Generalisable package? #1 (comment)) (Fixed: tracking: Building an application that usesBlink.jl
#5 (comment))Blink.jl
#5 (comment))change_dir_if_bundle()
can't find binary path ifJULIA_HOME
is overriden #4)The text was updated successfully, but these errors were encountered: