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

Problems with Blink.jl #58

Open
srgk26 opened this issue May 3, 2019 · 0 comments
Open

Problems with Blink.jl #58

srgk26 opened this issue May 3, 2019 · 0 comments

Comments

@srgk26
Copy link

srgk26 commented May 3, 2019

Hi! Thanks for this great package first of all. But I'm having problems in opening the app.

I'm building a stats plotting GUI app, whose executable also automatically installs required softwares and packages, attempting to use the user's packages for the app instead of bundled libraries and resources from within the app. Partly because I'm having too many problems in identifying and changing the relative paths of all the libraries and dependencies to relative paths. I'm aware you're working on this issue too, I saw your PR. But for now, I'm keeping the app simple.

The problem is, when I click the app icon, it opens the Blink window momentarily and closes, regardless if the libraries and dependencies are bundled within the app. This might be relevant to #JuliaGizmos/Blink.jl#195.

As per the suggestion, I added readline()to the back of the code. It then works when I execute the script by $ exec julia test.jl. It also works when I open the executable from within the test.app/Contents/MacOS folder. But it doesn't work when I click the test.app icon.

Here is the full code and command line commands to build the app:

Command line:

$ exec julia /Users/srgk26/.julia/packages/ApplicationBuilder/cTrYQ/build_app.jl --bundle-identifier "com.srgk26.test" --app-version=0.1 --certificate "Developer ID Application: srgk26, LLC" ~/test.jl  "test" ~/builddir/

test.jl file:

using Blink

Base.@ccallable function julia_main(args::Vector{String})::Cint
    Blink.port[] = get(ENV, "BLINK_PORT", rand(2_000:10_000))

    sleep(2)
    w = Window()
    body!(w, "Hello, world!")
    readline()  ## To keep Julia process active

    return 0
end

Also, if you have some spare time, I also did try to bundle the resources together and change the paths to relative paths like your Blink.jl example. This is the error message:

Gokuls-MacBook-Pro:~ srgk26$ /Users/srgk26/MacOS_exec/hello-test.app/Contents/MacOS/hello-test ; exit;
cd_to_bundle_resources(): Changed to new pwd: /Users/srgk26/MacOS_exec/hello-test.app/Contents/Resources
fatal: error thrown and no exception handler available.
ErrorException("Cannot find Electron. Try `Blink.AtomShell.install()`.")
rec_backtrace at /Users/srgk26/MacOS_exec/hello-test.app/Contents/MacOS/libjulia.dylib (unknown line)
jl_throw at /Users/srgk26/MacOS_exec/hello-test.app/Contents/MacOS/libjulia.dylib (unknown line)
error at /Users/srgk26/MacOS_exec/hello-test.app/Contents/MacOS/hello-test.dylib (unknown line)
electron at /Users/srgk26/.julia/packages/Blink/6QR5U/src/AtomShell/process.jl:62 [inlined]
#init#8 at /Users/srgk26/.julia/packages/Blink/6QR5U/src/AtomShell/process.jl:80
unknown function (ip: 0x1202e33d7)
jl_fptr_trampoline at /Users/srgk26/MacOS_exec/hello-test.app/Contents/MacOS/libjulia.dylib (unknown line)
#init at ./none:0 [inlined]
#shell#11 at /Users/srgk26/.julia/packages/Blink/6QR5U/src/AtomShell/process.jl:123
unknown function (ip: 0x1202e2ce7)
jl_fptr_trampoline at /Users/srgk26/MacOS_exec/hello-test.app/Contents/MacOS/libjulia.dylib (unknown line)
helloFromBlink at /Users/srgk26/MacOS_exec/hello-test.app/Contents/MacOS/hello-test.dylib (unknown line)
julia_main at /Users/srgk26/MacOS_exec/hello-test.app/Contents/MacOS/hello-test.dylib (unknown line)
julia_main at /Users/srgk26/MacOS_exec/hello-test.app/Contents/MacOS/hello-test.dylib (unknown line)
main at /Users/srgk26/MacOS_exec/hello-test.app/Contents/MacOS/hello-test (unknown line)
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

It raised that it couldn't find Electron. But I do have electron browser installed and is working fine when I run it locally. I also tried to install the Electron app manually and keep the name Electron.app. But it was still raising errors.

This was my command line command:

$ exec julia /Users/srgk26/.julia/packages/ApplicationBuilder/cTrYQ/build_app.jl \
-R /Users/srgk26/.julia/packages/Blink/6QR5U/deps/Julia.app/ \
-R /Users/srgk26/.julia/packages/Blink/6QR5U/src/AtomShell/main.js \
-R /Users/srgk26/.julia/packages/Blink/6QR5U/src/content/main.html \
-R /Users/srgk26/.julia/packages/Blink/6QR5U/res/ \
-L /Users/srgk26/.julia/packages/HttpParser/yGK3a/deps/usr/lib/libhttp_parser.dylib \
-L /Users/srgk26/.julia/packages/MbedTLS/XkQiX/deps/usr/lib/libmbedcrypto.3.dylib \
--bundle-identifier "com.srgk26.hello-test" --app-version=0.1 --certificate "Developer ID Application: srgk26, LLC" \
/Users/srgk26/heatGUI_app/hello-test.jl  "hello-test" /Users/srgk26/MacOS_exec/

I would appreciate if you/anyone could help. Thanks!

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

1 participant