Giter Club home page Giter Club logo

applicationbuilder.jl's Introduction

Hello ๐Ÿ‘‹

I am a Software Engineer at RelationalAI, where I work on Julia, Rel, and our knowledge graph system.

๐Ÿ“ซ You can find me at:

Interests

  • ๐ŸŒ Climate
    • ๐ŸŒŽ Climate Justice
    • ๐ŸŒ Climate Policy
    • ๐ŸŒ Clean Tech
  • ๐Ÿงช Software for Science
    • JuliaLang
    • Rel
  • ๐Ÿ—ฃ Human Languages
    • Mandarin (I'm conversational at best)
    • Studying Malayalam
    • Linguistics

applicationbuilder.jl's People

Contributors

nhdaly avatar ranjanan avatar vpetukhov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

applicationbuilder.jl's Issues

ArgumentError: Package BuildApp not found in current path

Hi,

I tried to rebuild your example of the JuliaCon2018 and failed. I followed your installation instructions and the following two packages are installed:

[cc31668c] ApplicationBuilder v0.0.0 #master (https://github.com/NHDaly/ApplicationBuilder.jl.git)
[377060ff] ApplicationBuilderRuntimeUtils v0.0.0 #master (https://github.com/NHDaly/ApplicationBuilderRuntimeUtils.jl.git)

but if I run
using ApplicationBuilder; using BuildApp;
I get the following error:

ArgumentError: Package BuildApp not found in current path:
- Run `Pkg.add("BuildApp")` to install the BuildApp package.

What did I miss?

Thanks!

Complete Compilation: `autosnoop`? `--compile=all`? Disable compilation at runtime?

Figure out how to really, actually compile everything at build-time and do no compilation at runtime!!

There was some discussion in-person at JuliaCon around the fact that things aren't being compiled fully because we're only building with --compile=yes instead of --compile=all. (During the talk I incorrectly said that we were building with --compile=all.)

Therefore, the belief is that julia is only precompiling everything (parsing and lowering) rather than compiling to machine code. Some possible fixes we've discussed:

  • Use a snoopfile to force compilation.
    • I added autosnoop the day before my talk, which just creates a snoopfile with the contents julia_main([""]), causing the program to be executed during compilation, building a snoopfile, and compiling with it.
    • @JeffBezanson suggested offline, that maybe autosnoop should simply add the following line to your program: precompile(julia_main, (Array{String, 1},))
  • ACTUALLY set --compile=all
  • Set --compile=none at runtime (i guess this would be passed via the C api's jl_options to julia_init).

LoadError: UndefVarError: info not defined

I have two installations of Julia 1.0.2: one in MacOS, another in Windows 7x64.

Usage of build_app_bundle() in MacOS is successful, whereas in Windows compilation of the same source code fails with message: "<..> LoadError: UndefVarError: info not defined <..>\src\bundle.jl:16".

It seems, something related to @info macro works differently in Windows.

UndefVarError(var=:Vec3f0) when using Makie

All,

I was really excited to see that AB now supports Julia v1.0.0. :) I was able to build my first application this morning. Which is great progress.

Unfortunately, when I go to run the application via ./builddir/gitviz.app/Contents/MacOS/main ARGS I get the following error:

fatal: error thrown and no exception handler available.
UndefVarError(var=:Vec3f0)
rec_backtrace at /Users/jason/src/all/gitviz.git/builddir/gitviz.app/Contents/MacOS/libjulia.dylib (unknown line)
jl_throw at /Users/jason/src/all/gitviz.git/builddir/gitviz.app/Contents/MacOS/libjulia.dylib (unknown line)
jl_undefined_var_error at /Users/jason/src/all/gitviz.git/builddir/gitviz.app/Contents/MacOS/libjulia.dylib (unknown line)
jl_get_binding_or_error at /Users/jason/src/all/gitviz.git/builddir/gitviz.app/Contents/MacOS/libjulia.dylib (unknown line)
gv_render! at /Users/jason/src/all/gitviz.git/src/render.jl:75
unknown function (ip: 0x125eee96b)
jl_fptr_trampoline at /Users/jason/src/all/gitviz.git/builddir/gitviz.app/Contents/MacOS/libjulia.dylib (unknown line)
gv_main at /Users/jason/src/all/gitviz.git/builddir/gitviz.app/Contents/MacOS/main.dylib (unknown line)
julia_main at /Users/jason/src/all/gitviz.git/builddir/gitviz.app/Contents/MacOS/main.dylib (unknown line)
julia_main at /Users/jason/src/all/gitviz.git/builddir/gitviz.app/Contents/MacOS/main.dylib (unknown line)
main at /Users/jason/src/all/gitviz.git/builddir/gitviz.app/Contents/MacOS/main (unknown line)

An @show reveals that my ARGS are being passed properly, but it blows up when calling gv_render!(), which is in a separate file. That file is included in the primary, and it also declares using Makie. I've attempted using GeometryTypes and LinearAlgebra, without success.

Is this a bug in ApplicationBuilder?

`change_dir_if_bundle()` can't find binary path if `JULIA_HOME` is overriden

Currently, some packages require you to manually define JULIA_HOME in order to compile correctly.

This is because, currently, JULIA_HOME is not set to the normal value when compiling through juliac. The fix for this is found here:
JuliaLang/PackageCompiler.jl#47 (comment)

However, change_dir_if_bundle() is relying on this modified behavior to detect the location of the static binary during execution. Fixing JULIA_HOME, therefore, breaks change_dir_if_bundle().

This could be fixed if change_dir_if_bundle() was able to access argv[0], but that is not available when compiled with juliac: JuliaLang/PackageCompiler.jl#54.

"Unable to find compatible target in system image" when running compiled binary on other machine

Hi,

I'm trying to create portable binary of your commandline_hello example. It's built fine and works on the building machine. But when I copy binaries to the other computer, I get single line "ERROR: Unable to find compatible target in system image.". At the beginning I did it with julia built from source, but switching to portable julia build (either 0.7 or 1.0.2) doesn't help. Both computers have the same Ubuntu 14.04. I also tried third one with Gentoo, result is the same.

My building script is as simple as it can be:

using ApplicationBuilder
build_app_bundle("hello.jl", appname="Hello");

There was large discussion that julia portable requires cx16 CPU flag, and it's not set in some virtual machines, which cause the same problem. But I use real machine, not virtual. And I have this flag in my /proc/cpuinfo. Do you by chance have any suggestions on what can I check and where to look?

Build Android Applications

I have only the foggiest idea of the prerequisites here, but I thought I'd throw the idea out there as a potential long-term goal.

There's a thread on discourse on running Julia itself on Android. The Android half of this is probably something to do with Android NDK. Beyond that, we'd probably need some sort of GUI framework specifically designed with Android in mind (possibly based on JavaCall.jl?). Here's a guide from Mozilla on building/deploying a Rust (Julia brother in LLVM) library on Android: https://mozilla.github.io/firefox-browser-architecture/experiments/2017-09-21-rust-on-android.html

I was thinking that IOS might be an easier initial target than Android since I believe the Swift toolchain for IOS uses LLVM anyway, but in my brief digging I didn't find much efforts in that direction. There is this repo where Rust is built as a library for both Android and IOS though: https://github.com/kennytm/rust-ios-android.

Basically, I got curious about the viability of ever running Julia apps on mobile platforms and your repository seemed like the most relevant place to brain dump a bunch of relevant links. Sorry. Feel free to close.

Consider automating library renaming for `BinDeps` deps

If a Package or user code depends on binary dependencies managed through BinDeps, we should be able to automate the path-renaming.

Background:
Any file dependencies that are specified via absolute paths must be renamed to be relative paths before being referenced from the compiled code. Currently, this must be done manually in the user code, as in this example:

using SDL
if get(ENV, "COMPILING_APPLE_BUNDLE", "false") == "true"
  eval(SDL2, :(libSDL2 = "libSDL2.dylib"))
  eval(SDL2, :(libSDL2_ttf = "libSDL2_ttf.dylib"))
end

Proposal:
However, if (as in the above SDL example) the dependency is a binary dependency managed by BinDeps.jl, perhaps the above step could be performed automatically when the code is being compiled by ApplicationBuilder

As one simple strawman idea, we could submit a change to BinDeps.jl so that the generated deps.jl sets relative paths if it detects ENV["COMPILING_APPLE_BUNDLE"].

Perhaps a more elegant solution wouldn't require modifying BinDeps at all, but I can't think of how to do that right now.

tracking: Building an application that uses `Blink.jl`

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:

Travis kills tests a lot: I suspect OOMs

Travis builds are often failing while building Blink with a message something like this:

INFO: Loading HttpServer methods...
ERROR: LoadError: LoadError: LoadError: LoadError: LoadError: LoadError: InterruptException:
while loading /Users/travis/.julia/v0.6/BinDeps/src/dependencies.jl, in expression starting on line 148

Here is an example failure:
https://travis-ci.org/NHDaly/ApplicationBuilder.jl/jobs/406659222

My guess is that it's running out of memory, but that's just a guess. Since it's getting an InterruptException, it seems likely that it's being killed, probably for too many resources of some kind or another.

Sometimes, though, it will randomly succeed, such as here:
https://travis-ci.org/NHDaly/ApplicationBuilder.jl/jobs/406658572

Fully automatic Hermetic / Portable bundles

The current system for creating portable, self-contained, downloadable binaries is quite fragile.

The main problem is about embedding all non-code dependencies needed by your code and its package dependencies. The main two types of such dependencies are libraries and resources.

The current steps to bundle everything up are quite manual. For resources, and libraries, the steps include the following:

  • specify the path to the file, which gets copied into Libraries/ (or Resources/) (hopefully no name collisions!)
  • Then you have to manually find all references to that file (hopefully stored in some variable, usually in the package's deps.jl file, and change them to be relative paths from the binary's path.
    • But only do this if you're running as a compiled binary! to tell this, we set an environment variable "COMPILING_APPLE_BUNDLE"=>true.
  • And if those libraries have interdependencies, you need to make sure to update their rpaths to not point outside the binary, ...

It can be hard to even figure out which libraries to copy into the application, and this can change as your dependencies are updated. And then, even once you find them, it is very fragile to try to change the variables in the packages themselves to point to the new relative paths for the libraries/resources.


This Issue is to try to find a more robust, automatic, and complete solution.

Based on a conversation I had with @staticfloat at JuliaCon2018, and now with Pkg3, I think we can make this work by re-instantiating the entire .julia directory inside the application bundle before building (by simply pointing JULIA_DEPOT_PATH inside the application bundle and running Pkg.instantiate()).

The problem then is that the libraries will still be specified via absolute paths, but based on conversations with @rbvermaa, I think we can get around this via a pass over the directory tree that attempts to replace all such absolute paths with relative paths. Fortunately, most of these paths are generated via only a few tools (BinaryBuilder/BinaryProvider, BinDeps, and a few others), so they should be fairly regular. In the long term, perhaps we can even have an option or environment variable or something that can cause those tools to emit paths in the format we want directly.

This is the basic idea that I am going to try exploring over the next couple days:

  • Instantiate an entire .julia tree (inside the App bundle) before compiling.
  • Do a find/replace pass to replace all absolute paths within that tree to relative paths.
  • Do the static compilation, pointing at that tree (via JULIA_DEPOT_PATH), so that all the relative paths are compiled into the binary
  • Delete everything in the tree except the library and resource dependencies (deps/ directories) [at simplest, just delete the src/ and test/ dirs].
  • Bundle and Ship.

There are likely to be some remaining problems, but maybe we can follow the wizard approach used in BinaryProvider to create a script based on an interactive session with the user that can target any irregular paths that need to be fixed, or detect them via some other automation (such as running the final binary, detecting dynamic loads outside the app, fixing them, rebuilding, and repeat).

The relative paths we use to replace the absolute paths for loading libraries will need to be relative to the executable path, so that the user can move the application bundle around after installing it on their system. On Macs, there is built-in support for this: Julia's Base.DL_LOAD_PATH loads relative to the executable load path via "@loader_path". On Linux, we'll probably have to push the path to the binary into DL_LOAD_PATH manually before building and as the first step of loading the binary before running julia_main() (which we can get from argv[0], and already set as PROGRAM_FILE in ApplicationBuilder).

What wrong ?

f my_code() is simply and wroking ;)
But :
After 1 step no my_julia_main.jl file in my disk.
Dir /src is created in second step but is empty .
What wrong ? (ARGS::Vector{String})::Cint must be edited ?

# my_julia_main.jl
include("my_code.jl")
Base.@ccallable function julia_main(ARGS::Vector{String})::Cint
    return my_code()
end

# build.jl
using ApplicationBuilder
build_app_bundle("src/my_julia_main.jl", appname="MyCode");

julia> build_app_bundle("src/my_julia_main.jl", appname="MyCode")
[ Info: Building at path D:\...\instalacja\src\builddir\MyCode
[ Info: Copying resources:
[ Info: Copying libraries
ERROR: Cannot find file: "D:\...\instalacja\src\my_julia_main.jl"
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] #static_julia#5(::Nothing, ::Bool, ::Bool, ::String, ::Nothing, ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool,
::Bool, ::Bool, ::Bool, ::Bool, ::Nothing, ::Bool, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing
, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing,
::Nothing, ::Nothing, ::typeof(PackageCompiler.static_julia), ::String) at C:\Users\PC\.julia\packages\PackageCo
mpiler\oT98U\src\static_julia.jl:106
 [3] #static_julia at .\none:0 [inlined]
 [4] #build_executable#31 at C:\Users\PC\.julia\packages\PackageCompiler\oT98U\src\api.jl:104 [inlined]
 [5] #build_executable at .\none:0 [inlined] (repeats 2 times)
 [6] #build_app_bundle#4(::Array{String,1}, ::Array{String,1}, ::String, ::String, ::Bool, ::Function, ::String)
 at C:\Users\PC\.julia\packages\ApplicationBuilder\PzBv2\src\bundle.jl:20
 [7] (::getfield(ApplicationBuilder, Symbol("#kw##build_app_bundle")))(::NamedTuple{(:appname,),Tuple{String}},
::typeof(build_app_bundle), ::String) at .\none:0
 [8] top-level scope at none:0

Paul

Add ability to only rebuild things that actually need to be rebuilt.

Maybe integration with something like make?

Or maybe we can use julia's Pkg manager to do this?

Been thinking about hermetically including dependencies by recreating a .julia structure inside the .app (via JULIA_DEPOT_PATH), and if we do that, maybe we could wrap the user's code all up in a Package inside there, and only re-run things if it's modified somehow?

Getting Gtk to work

Hey @NHDaly , I'm trying to make this work with Gtk but I'm getting stuck.

I've done something a bit similar to your SDL example. I first manually copy all the folders from Homebrew that I need in Libraries/... (I preserve Homebrew folder hierarchy instead of copying all the dylib in a single folder).

Then list all the libraries and fix the paths with install_name_tool (I'm using @loader_path instead of @rpath).

The problem is that I'm getting version error, I don't understand why:

dyld: Library not loaded: @loader_path/../Libraries/Cellar/glib/2.58.1/lib/libglib-2.0.0.dylib
  Referenced from: /Users/jbieler/.julia/dev/GtkREPL/builddir/GtkREPL.app/Contents/Libraries/opt/glib/lib/libgobject-2.0.0.dylib
  Reason: Incompatible library version: libgobject-2.0.0.dylib requires version 5801.0.0 or later, but libglib-2.0.0.dylib provides version 5201.0.0
fatal: error thrown and no exception handler available.

otool for libgobject-2.0.0.dylib gives me:

/Users/jbieler/.julia/dev/GtkREPL/builddir/GtkREPL.app/Contents/Libraries//opt/glib/lib/libgobject-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.1.0)
	@loader_path/../Libraries/Cellar/glib/2.58.1/lib/libglib-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.1.0)

And on libglib-2.0.0.dylib:

/Users/jbieler/.julia/dev/GtkREPL/builddir/GtkREPL.app/Contents/Libraries//Cellar/glib/2.58.1/lib/libglib-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.1.0)

Any idea what's going on here ?

My build script:

https://gist.github.com/jonathanBieler/6f4e078b9294470479a504180a8ef887

A lot of problems

Hello @NHDaly , thank you very much for this GREAT package, i am in love with Julialang

having said that ๐Ÿ‘ .

I had a couple of problems in Windows 10 using Julia 1.1.0

there is nothing special about my Windows installation or Julia installation or environment in general.

  • ERROR: Unable to find compatible target in system image. < this error was due to the following line, more specifically, the default value for cpu_target
function build_app_bundle(juliaprog_main;
        appname = splitext(basename(juliaprog_main))[1], builddir = "builddir",
        binary_name = splitext(basename(juliaprog_main))[1],
        resources = String[], libraries = String[], verbose = false,
        bundle_identifier = nothing, app_version = "0.1", icns_file = nothing,
        certificate = nothing, entitlements_file = nothing,
        snoopfile = nothing, autosnoop = false, cpu_target="x86-64",
        create_installer = false, commandline_app = false,
    )

i was not able to solve this by changing to cpu_target = string(Base.Sys.ARCH) but i was able to solve this by setting it to cpu_target = nothing. How it worked and why i had this problem is a mistery to me

  • I had some problems trying to create an installer as well
    i don't have the exact error message here now to copy and paste to you but i'll try to reproduce as faithfully as i can
    UndefVarError: win_installer is not defined < something like that

I managed to sort this out by adding the following lines to the top of ApplicationBuilder.jl just below the Sys.isapple() check

@static if Sys.isapple()
    include("sign_mac_app.jl")
    include("mac_commandline_app.jl")
end

""" THIS """
@static if Sys.iswindows() 
    include("win-installer.jl") 
end

After being able to access the win_installer method, i had another error

UndefVarError: JULIA_HOME is not defined

I managed to fix that by changing these lines

function win_installer(builddir; name = "nothing",
				license = "$JULIA_HOME/../License.md")

to these lines

JULIA_HOME = get(ENV, "JULIA_HOME", "")
LICENSE_PATH = joinpath(abspath(JULIA_HOME, ".."), "License.md")

function win_installer(builddir; name = "nothing",
				license = LICENSE_PATH)

BTW, in Windows at least, "$JULIA_HOME/../License.md" this doesn't seem to resolve to a valid path
so i also had to change the nsis_file path from

# this resolves to "$builddir/../$name.nsi" which doesn't exist anywhere
nsis_file = joinpath(builddir, "..", "$name.nsi") 

to

nsis_file = joinpath(abspath(builddir, ".."), "$name.nsi")

I'm not sure why you build your paths this way joinpath(builddir, "..", "$name.nsi") or "$JULIA_HOME/../License.md" because i'm new to Julia and arrived on Version 1.1.0 already, maybe that's the way it used to work before, i don't know.

This doesn't resolve to parent folder

joinpath(builddir, "..")

this does

abspath(builddir, "..")
  • Also, for some reason makensis kept throwing not file or directory [ENOENT] at me even though the file was there so i had to download a NSIS software, load the script and build the installer manually.

After those fixes i made everything work and managed to build a Windows Executable Application with an Installer but let me know your thoughts about this, i will be making a Pull Request with the above changes because it definitely will crash on other Windows 10 users.

Unify Windows, Linux, and Mac APIs

Currently there are two totally separate interfaces for build_app_bundle, one defined for Mac and one for Windows/Linux.

We should fix that!

I'm going to try to unify them together. For the most part, at first i think this will mostly just entail adding dummy arguments to the windows/linux version so that at least using the same build script on all three systems won't be an Error.

Build hangs

I've successfully used ApplicationBuilder on MacOS and Linux Mint using a couple of different source files. (Success meaning the build process completes and I'm able to run the resulting app.) I'm now trying to use the build function on an AWS instance of Linux (Ubuntu 18), but it hangs. (I've let this run for an hour or two). The results below are for the example file commandline_hello.jl.

Any suggestions on how to get this to work?

           _

_ _ ()_ | Documentation: https://docs.julialang.org
() | () () |
_ _ | | __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ ` | |
| | |
| | | | (
| | | Version 1.1.1 (2019-05-16)
/ |_'|||_'_| | Official https://julialang.org/ release
|__/ |

julia> using ApplicationBuilder

julia> build_app_bundle("/home/ubuntu/Documents/Software/Julia/Commandline_Hello/commandline_hello.jl", appname="hello")
[ Info: Building at path /home/ubuntu/Documents/Software/Julia/Commandline_Hello/builddir/hello
[ Info: Copying resources:
[ Info: Copying libraries
Julia program file:
"/home/ubuntu/Documents/Software/Julia/Commandline_Hello/commandline_hello.jl"
C program file:
"/home/ubuntu/.julia/packages/PackageCompiler/CJQcs/examples/program.c"
Build directory:
"/home/ubuntu/Documents/Software/Julia/Commandline_Hello/builddir/hello/core"

Might fail because of missing Compat

This code

using Compat
Base.@ccallable function cd_to_bundle_resources()::Compat.Nothing
full_binary_name = PROGRAM_FILE # PROGRAM_FILE is set manually in program.c
if Compat.Sys.isapple()
m = match(r".app/Contents/MacOS/[^/]+$", full_binary_name)
if m != nothing
resources_dir = joinpath(dirname(dirname(full_binary_name)), "Resources")
cd(resources_dir)
end
println("cd_to_bundle_resources(): Changed to new pwd: $(pwd())")
end
end
precompile(cd_to_bundle_resources, ()) # Compile it for the binary.
might fail because nothing ensures that Compat is available when the code is run by PackageCompiler. That was indeed the case for me. Maybe this can be fixed with

using ApplicationBuilder: Compat

instead. However, PackageCompiler doesn't pass the project file information to the subprocess so it might also be the case that my suggested solution fails.

Consider renaming modules after #9

PR #9 splits the Package into two main Modules, and (probably) a submodule. Here are some naming questions:

  • what should we call the top-level module / package?
    • Does ApplicationBuilder still make sense? Should it just be Application? Applications?
  • what should we call the submodule for application utilities?
    • ApplicationBuilder.App? Application.Util? Applications.Utils? ApplicationBuilder.AppUtils?
  • what should we call the second module, which contains the build code?
    • BuildApp? AppBuilder?

Here are some possible examples of how those could look:

# build.jl
using ApplicationBuilder; using BuildApp
build_app_bundle("hello.jl"; appname="Hello World")

# hello.jl
using ApplicationBuilder;
function Base.@ccallable julia_main(ARGS)
 ApplicationBuilder.Utils.chdir_if_bundle()
 ...
end
# build.jl
using Application; using AppBuilder;
build_app_bundle("hello.jl"; appname="Hello World")

# hello.jl
using Application;
function Base.@ccallable julia_main(ARGS)
 Application.AppUtils.chdir_if_bundle()
 ...
end

Relative linkage path prevents run script from any directory except "core"

Hi,

I'm trying to build an app, which depends on RMath package. Building script is the following:

using ApplicationBuilder
using Rmath
import SpecialFunctions

lib_deps = [Rmath.libRmath, SpecialFunctions.openspecfun, SpecialFunctions.openspecfun * ".1.3",
            "/lib64/libgfortran.so.4", "/lib64/libgfortran.so.4.0.0"];

build_app_bundle("segment_data.jl", appname="Segmentation", libraries=lib_deps);

Is creates "builddir/Segmentation/" folder, which contains "core", "res" and "lib" folders. "lib" directory contains "libRmath-julia.so" library and several others.

When I run script from "core" folder, it works well. Though, if I change path (e.g. calling it from "builddir" with ./core/segment_data command), I get error:

fatal: error thrown and no exception handler available.
InitError(mod=:Rmath, error=ErrorException("could not load library "../lib/libRmath-julia.so"
../lib/libRmath-julia.so: cannot open shared object file: No such file or directory"))
rec_backtrace at /julia/src/stackwalk.c:94
record_backtrace at /julia/src/task.c:246
jl_throw at /julia/src/task.c:577
jl_errorf at /julia/src/rtutils.c:77
jl_dlerror at /julia/src/dlload.c:74 [inlined]
jl_load_dynamic_library_ at /julia/src/dlload.c:196
jl_get_library at /julia/src/runtime_ccall.cpp:48
jl_get_library at /julia/src/runtime_ccall.cpp:56 [inlined]
jl_load_and_lookup at /julia/src/runtime_ccall.cpp:59
__init__ at /home/vp/.julia/packages/Rmath/Py9gH/src/Rmath.jl:47
jfptr___init___27581 at /d0-mendel/home/viktor_petukhov/spatial/SpatialRNA/src/builddir/Segmentation/core/segment_data.so (unknown line)
jl_apply_generic at /julia/src/gf.c:2182
jl_apply at /julia/src/julia.h:1538 [inlined]
jl_module_run_initializer at /julia/src/toplevel.c:90
_julia_init at /julia/src/init.c:820
julia_init__threading at /julia/src/task.c:302
main at ./core/segment_data (unknown line)
__libc_start_main at /build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:287
_start at ./core/segment_data (unknown line)

Problems with Blink.jl

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!

Error with ???") What is possible

Very usefull pacake, thanks,
Now Itraying use ReadStat.jl packages
Code is simply :

using StatFiles, DataFrames, ReadStat, DelimitedFiles, JLD2,FileIO, Dates
Base.@ccallable function julia_main(ARGS::Vector{String})::Cint
df=DataFrame(load("File_data.sav"))
dane=convert(Matrix, df)
k,l=size(dane)
danes=read_sav("File_data.sav");
save("dane.jld2","dane",dane)
# save("danes.jld2","danes",danes)
readline()
end

Builder works without line : danes=read_sav("File_data.sav");
but strenge is line :

ErrorException("error compiling handle_variable!: could not load library "C:\Users\PC\.julia\packages\ReadStat\J
nXAZ\deps\usr\bin\libreadstat-0.dll"
???")

file libreadstat-0.dll exist in this localization but was no copied !!! I copied it manulay to destination dir , but in next comilation error is the same . What is the fliper ;

???

after line

ErrorException("error compiling handle_variable!: could not load library "C:\Users\PC\.julia\packages\ReadStat\J
nXAZ\deps\usr\bin\libreadstat-0.dll"

?

Full Error:

julia> @time build_app_bundle("sav_czytam.py", appname="sav_czytam")
[ Info: Building at path D:\pawel\rynek\IRCENTER\Dane_test\instalacja\builddir\sav_czytam
[ Info: Copying resources:
[ Info: Copying libraries
Julia program file:
  "D:\pawel\rynek\IRCENTER\Dane_test\instalacja\sav_czytam.py"
C program file:
  "C:\Users\PC\.julia\packages\PackageCompiler\oT98U\examples\program.c"
Build directory:
  "D:\pawel\rynek\IRCENTER\Dane_test\instalacja\builddir\sav_czytam\core"
fatal: error thrown and no exception handler available.
ErrorException("error compiling handle_metadata!: could not load library "C:\Users\PC\.julia\packages\ReadStat\J
nXAZ\deps\usr\bin\libreadstat-0.dll"
???")
rec_backtrace at /home/Administrator/buildbot/worker/package_win64/build/src\stackwalk.c:94
record_backtrace at /home/Administrator/buildbot/worker/package_win64/build/src\task.c:246
jl_throw at /home/Administrator/buildbot/worker/package_win64/build/src\task.c:577
jl_rethrow_with_add at /home/Administrator/buildbot/worker/package_win64/build/src/home/Administrator/buildbot/w
orker/package_win64/build/src\codegen.cpp:816
jl_compile_linfo at /home/Administrator/buildbot/worker/package_win64/build/src/home/Administrator/buildbot/work
er/package_win64/build/src\codegen.cpp:1173
jl_compile_hint at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:1936
jl_compile_specializations at /home/Administrator/buildbot/worker/package_win64/build/src\precompile.c:357 [inli
ned]
jl_precompile at /home/Administrator/buildbot/worker/package_win64/build/src\precompile.c:366 [inlined]
jl_write_compiler_output at /home/Administrator/buildbot/worker/package_win64/build/src\precompile.c:34
jl_atexit_hook at /home/Administrator/buildbot/worker/package_win64/build/src/home/Administrator/buildbot/worker
/package_win64/build/src\init.c:233
wmain at /home/Administrator/buildbot/worker/package_win64/build/ui\repl.c:234
__tmainCRTStartup at /usr/src/debug/mingw64-x86_64-runtime-5.0.3-1/crt\crtexe.c:329
mainCRTStartup at /usr/src/debug/mingw64-x86_64-runtime-5.0.3-1/crt\crtexe.c:212
BaseThreadInitThunk at C:\Windows\system32\kernel32.dll (unknown line)
RtlUserThreadStart at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
ERROR: failed process: Process(`'C:\Users\PC\AppData\Local\Julia-0.7.0\bin\julia.exe' --output-o=sav_czytam.a --
track-allocation=none --code-coverage=none --history-file=yes --inline=yes --math-mode=ieee --compile=yes --trac
k-allocation=none --sysimage-native-code=yes '--sysimage=C:\Users\PC\AppData\Local\Julia-0.7.0\lib\julia\sys.dll
' --compiled-modules=yes --optimize=2 'C:\Users\PC\.julia\packages\PackageCompiler\oT98U\sysimg\run_julia_code.j
l'`, ProcessExited(1)) [1]
Stacktrace:
 [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at .\error.jl:42
 [2] pipeline_error at .\process.jl:712 [inlined]
 [3] #run#509(::Bool, ::Function, ::Cmd) at .\process.jl:670
 [4] #run_julia#1 at .\process.jl:668 [inlined]
 [5] #run_julia at .\none:0 [inlined]
 [6] (::getfield(PackageCompiler, Symbol("##13#14")){Base.Iterators.Pairs{Symbol,Nothing,NTuple{14,Symbol},Named
Tuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_over
write, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),NTuple{14,Nothing}}},
String})() at C:\Users\PC\.julia\packages\PackageCompiler\oT98U\src\static_julia.jl:262
 [7] cd(::getfield(PackageCompiler, Symbol("##13#14")){Base.Iterators.Pairs{Symbol,Nothing,NTuple{14,Symbol},Nam
edTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_ov
erwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),NTuple{14,Nothing}}
},String}, ::String) at .\file.jl:85
 [8] #build_object#12(::Base.Iterators.Pairs{Symbol,Nothing,NTuple{14,Symbol},NamedTuple{(:sysimage, :startup_fi
le, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target,
 :optimize, :debug_level, :inline, :check_bounds, :math_mode),NTuple{14,Nothing}}}, ::Function, ::String, ::Stri
ng, ::String, ::Bool) at C:\Users\PC\.julia\packages\PackageCompiler\oT98U\src\static_julia.jl:261
 [9] #build_object at .\none:0 [inlined]
 [10] build_object(::String, ::String, ::String, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing,
::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing) at
 C:\Users\PC\.julia\packages\PackageCompiler\oT98U\src\static_julia.jl:240
 [11] #static_julia#5(::Nothing, ::Bool, ::Bool, ::String, ::Nothing, ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool,
 ::Bool, ::Bool, ::Bool, ::Bool, ::Nothing, ::Bool, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothin
g, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing,
 ::Nothing, ::Nothing, ::typeof(PackageCompiler.static_julia), ::String) at C:\Users\PC\.julia\packages\PackageC
ompiler\oT98U\src\static_julia.jl:161
 [12] #static_julia at .\none:0 [inlined]
 [13] #build_executable#31 at C:\Users\PC\.julia\packages\PackageCompiler\oT98U\src\api.jl:104 [inlined]
 [14] #build_executable at .\none:0 [inlined] (repeats 2 times)
 [15] #build_app_bundle#4(::Array{String,1}, ::Array{String,1}, ::String, ::String, ::Bool, ::Function, ::String
) at C:\Users\PC\.julia\packages\ApplicationBuilder\PzBv2\src\bundle.jl:20
 [16] (::getfield(ApplicationBuilder, Symbol("#kw##build_app_bundle")))(::NamedTuple{(:appname,),Tuple{String}},
 ::typeof(build_app_bundle), ::String) at .\none:0
 [17] top-level scope at util.jl:156

julia> @time build_app_bundle("sav_czytam.py", appname="sav_czytam")
[ Info: Building at path D:\pawel\rynek\IRCENTER\Dane_test\instalacja\builddir\sav_czytam
[ Info: Copying resources:
[ Info: Copying libraries
Julia program file:
  "D:\pawel\rynek\IRCENTER\Dane_test\instalacja\sav_czytam.py"
C program file:
  "C:\Users\PC\.julia\packages\PackageCompiler\oT98U\examples\program.c"
Build directory:
  "D:\pawel\rynek\IRCENTER\Dane_test\instalacja\builddir\sav_czytam\core"
fatal: error thrown and no exception handler available.
ErrorException("error compiling handle_variable!: could not load library "C:\Users\PC\.julia\packages\ReadStat\J
nXAZ\deps\usr\bin\libreadstat-0.dll"
???")
rec_backtrace at /home/Administrator/buildbot/worker/package_win64/build/src\stackwalk.c:94
record_backtrace at /home/Administrator/buildbot/worker/package_win64/build/src\task.c:246
jl_throw at /home/Administrator/buildbot/worker/package_win64/build/src\task.c:577
jl_rethrow_with_add at /home/Administrator/buildbot/worker/package_win64/build/src/home/Administrator/buildbot/w
orker/package_win64/build/src\codegen.cpp:816
jl_compile_linfo at /home/Administrator/buildbot/worker/package_win64/build/src/home/Administrator/buildbot/work
er/package_win64/build/src\codegen.cpp:1173
jl_compile_hint at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:1936
jl_compile_specializations at /home/Administrator/buildbot/worker/package_win64/build/src\precompile.c:357 [inli
ned]
jl_precompile at /home/Administrator/buildbot/worker/package_win64/build/src\precompile.c:366 [inlined]
jl_write_compiler_output at /home/Administrator/buildbot/worker/package_win64/build/src\precompile.c:34
jl_atexit_hook at /home/Administrator/buildbot/worker/package_win64/build/src/home/Administrator/buildbot/worker
/package_win64/build/src\init.c:233
wmain at /home/Administrator/buildbot/worker/package_win64/build/ui\repl.c:234
__tmainCRTStartup at /usr/src/debug/mingw64-x86_64-runtime-5.0.3-1/crt\crtexe.c:329
mainCRTStartup at /usr/src/debug/mingw64-x86_64-runtime-5.0.3-1/crt\crtexe.c:212
BaseThreadInitThunk at C:\Windows\system32\kernel32.dll (unknown line)
RtlUserThreadStart at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
ERROR: failed process: Process(`'C:\Users\PC\AppData\Local\Julia-0.7.0\bin\julia.exe' --output-o=sav_czytam.a --
track-allocation=none --code-coverage=none --history-file=yes --inline=yes --math-mode=ieee --compile=yes --trac
k-allocation=none --sysimage-native-code=yes '--sysimage=C:\Users\PC\AppData\Local\Julia-0.7.0\lib\julia\sys.dll
' --compiled-modules=yes --optimize=2 'C:\Users\PC\.julia\packages\PackageCompiler\oT98U\sysimg\run_julia_code.j
l'`, ProcessExited(1)) [1]
Stacktrace:
 [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at .\error.jl:42
 [2] pipeline_error at .\process.jl:712 [inlined]
 [3] #run#509(::Bool, ::Function, ::Cmd) at .\process.jl:670
 [4] #run_julia#1 at .\process.jl:668 [inlined]
 [5] #run_julia at .\none:0 [inlined]
 [6] (::getfield(PackageCompiler, Symbol("##13#14")){Base.Iterators.Pairs{Symbol,Nothing,NTuple{14,Symbol},Named
Tuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_over
write, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),NTuple{14,Nothing}}},
String})() at C:\Users\PC\.julia\packages\PackageCompiler\oT98U\src\static_julia.jl:262
 [7] cd(::getfield(PackageCompiler, Symbol("##13#14")){Base.Iterators.Pairs{Symbol,Nothing,NTuple{14,Symbol},Nam
edTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_ov
erwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),NTuple{14,Nothing}}
},String}, ::String) at .\file.jl:85
 [8] #build_object#12(::Base.Iterators.Pairs{Symbol,Nothing,NTuple{14,Symbol},NamedTuple{(:sysimage, :startup_fi
le, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target,
 :optimize, :debug_level, :inline, :check_bounds, :math_mode),NTuple{14,Nothing}}}, ::Function, ::String, ::Stri
ng, ::String, ::Bool) at C:\Users\PC\.julia\packages\PackageCompiler\oT98U\src\static_julia.jl:261
 [9] #build_object at .\none:0 [inlined]
 [10] build_object(::String, ::String, ::String, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing,
::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing) at
 C:\Users\PC\.julia\packages\PackageCompiler\oT98U\src\static_julia.jl:240
 [11] #static_julia#5(::Nothing, ::Bool, ::Bool, ::String, ::Nothing, ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool,
 ::Bool, ::Bool, ::Bool, ::Bool, ::Nothing, ::Bool, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothin
g, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing,
 ::Nothing, ::Nothing, ::typeof(PackageCompiler.static_julia), ::String) at C:\Users\PC\.julia\packages\PackageC
ompiler\oT98U\src\static_julia.jl:161
 [12] #static_julia at .\none:0 [inlined]
 [13] #build_executable#31 at C:\Users\PC\.julia\packages\PackageCompiler\oT98U\src\api.jl:104 [inlined]
 [14] #build_executable at .\none:0 [inlined] (repeats 2 times)
 [15] #build_app_bundle#4(::Array{String,1}, ::Array{String,1}, ::String, ::String, ::Bool, ::Function, ::String
) at C:\Users\PC\.julia\packages\ApplicationBuilder\PzBv2\src\bundle.jl:20
 [16] (::getfield(ApplicationBuilder, Symbol("#kw##build_app_bundle")))(::NamedTuple{(:appname,),Tuple{String}},
 ::typeof(build_app_bundle), ::String) at .\none:0
 [17] top-level scope at util.jl:156

Paul

package test fails

Hi,
I just added ApplicationBuilder by,
(v1.0) pkg> add ApplicationBuilder
Then,
(v1.0 pkg> test Applicationbuilder
produces several errors on Ubuntu 18.04, Julia 1.0 (see output below). I also failed to build any of the provided examples "manually".

(v1.0) pkg> test ApplicationBuilder
Testing ApplicationBuilder
Resolving package versions...
Status /tmp/tmpRJOPpr/Manifest.toml
[f9309374] ApplicationBuilder v0.2.1
[c7e460c6] ArgParse v0.6.1
[bf4720bc] AssetRegistry v0.1.0
[9e28174c] BinDeps v0.8.10
[b99e7846] BinaryProvider v0.5.3
[ad839575] Blink v0.9.0
[e1450e63] BufferedStreams v1.0.0
[34da2185] Compat v1.4.0
[864edb3b] DataStructures v0.14.0
[de31a74c] FunctionalCollections v0.4.0
[c27321d9] Glob v1.2.0
[cd3eb016] HTTP v0.7.1
[0862f596] HTTPClient v0.2.1
[9fb69e20] Hiccup v0.2.2
[83e8ac13] IniFile v0.5.0
[97c1335a] JSExpr v0.4.0
[682c06a0] JSON v0.20.0
[50d2b5c4] Lazy v0.13.2
[b27032c2] LibCURL v0.4.1
[522f3ed2] LibExpat v0.5.0
[2ec943e9] Libz v1.0.0
[1914dd2f] MacroTools v0.4.4
[739be429] MbedTLS v0.6.6
[ffc61752] Mustache v0.5.8
[a975b10e] Mux v0.5.3
[510215fc] Observables v0.2.3
[bac558e1] OrderedCollections v1.0.2
[9b87118b] PackageCompiler v0.5.1
[fa939f87] Pidfile v1.1.0
[189a3867] Reexport v0.2.0
[ae029012] Requires v0.5.2
[aa65fe97] SnoopCompile v0.3.1
[bd369af6] Tables v0.1.11
[b718987f] TextWrap v0.3.0
[30578b45] URIParser v0.4.0
[0f1e0344] WebIO v0.6.1
[104b5d7c] WebSockets v1.1.0
[cc8bc4a8] Widgets v0.4.3
[c17dfb99] WinRPM v0.4.2
[2a0f44e3] Base64 [@stdlib/Base64]
[ade2ca70] Dates [@stdlib/Dates]
[8bb1440f] DelimitedFiles [@stdlib/DelimitedFiles]
[8ba89e20] Distributed [@stdlib/Distributed]
[7b1f6079] FileWatching [@stdlib/FileWatching]
[b77e0a4c] InteractiveUtils [@stdlib/InteractiveUtils]
[76f85450] LibGit2 [@stdlib/LibGit2]
[8f399da3] Libdl [@stdlib/Libdl]
[37e2e46d] LinearAlgebra [@stdlib/LinearAlgebra]
[56ddb016] Logging [@stdlib/Logging]
[d6f4376e] Markdown [@stdlib/Markdown]
[a63ad114] Mmap [@stdlib/Mmap]
[44cfe95a] Pkg [@stdlib/Pkg]
[de0858da] Printf [@stdlib/Printf]
[3fa0cd96] REPL [@stdlib/REPL]
[9a3f8284] Random [@stdlib/Random]
[ea8e919c] SHA [@stdlib/SHA]
[9e88b42a] Serialization [@stdlib/Serialization]
[1a1011a3] SharedArrays [@stdlib/SharedArrays]
[6462fe0b] Sockets [@stdlib/Sockets]
[2f01184e] SparseArrays [@stdlib/SparseArrays]
[10745b16] Statistics [@stdlib/Statistics]
[8dfed614] Test [@stdlib/Test]
[cf7118a7] UUIDs [@stdlib/UUIDs]
[4ec0a83e] Unicode [@stdlib/Unicode]
make_bundle_identifier Utils: Error During Test at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:13
Test threw exception
Expression: occursin(#= /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:13 =# @r_str("^com.[a-z0-9]+.myappnamedthisapp22$"), ApplicationBuilder.make_bundle_identifier("My app named this_app22"))
UndefVarError: make_bundle_identifier not defined
Stacktrace:
[1] macro expansion at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:13 [inlined]
[2] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1083 [inlined]
[3] top-level scope at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:13
HelloWorld.app: Error During Test at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:19
Test threw exception
Expression: 0 == include("build_examples/hello.jl")
LoadError: ArgumentError: isdefined: too few arguments (expected 2)
Stacktrace:
[1] top-level scope at none:0
[2] include at ./boot.jl:317 [inlined]
[3] include_relative(::Module, ::String) at ./loading.jl:1041
[4] include(::Module, ::String) at ./sysimg.jl:29
[5] include(::String) at ./client.jl:388
[6] macro expansion at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:19 [inlined]
[7] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1083 [inlined]
[8] top-level scope at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:19
in expression starting at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/build_examples/hello.jl:9
HelloWorld.app: Test Failed at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:20
Expression: isdir("$(builddir)/HelloWorld.app")
Stacktrace:
[1] macro expansion at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:20 [inlined]
[2] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1083 [inlined]
[3] top-level scope at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:19
HelloWorld.app: Error During Test at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:21
Test threw exception
Expression: success(#= /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:21 =# @cmd("$builddir/HelloWorld.app/Contents/MacOS/hello"))
IOError: could not spawn /tmp/tmphMwh4B/HelloWorld.app/Contents/MacOS/hello: no such file or directory (ENOENT)
Stacktrace:
[1] _jl_spawn(::String, ::Array{String,1}, ::Cmd, ::Tuple{Base.DevNull,Base.DevNull,Base.DevNull}) at ./process.jl:367
[2] (::getfield(Base, Symbol("##494#495")){Cmd})(::Tuple{Base.DevNull,Base.DevNull,Base.DevNull}) at ./process.jl:509
[3] setup_stdio(::getfield(Base, Symbol("##494#495")){Cmd}, ::Tuple{Base.DevNull,Base.DevNull,Base.DevNull}) at ./process.jl:490
[4] #_spawn#493(::Nothing, ::Function, ::Cmd, ::Tuple{Base.DevNull,Base.DevNull,Base.DevNull}) at ./process.jl:508
[5] #_spawn at ./none:0 [inlined]
[6] #_spawn#499 at ./process.jl:548 [inlined]
[7] _spawn at ./process.jl:548 [inlined]
[8] success(::Cmd) at ./process.jl:701
[9] macro expansion at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:21 [inlined]
[10] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1083 [inlined]
[11] top-level scope at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:19
No external Dependencies: Error During Test at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:28
Test threw exception
Expression: !(success(pipeline(#= /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:29 =# @cmd("otool -l "$builddir/HelloWorld.app/Contents/MacOS/hello""),#= /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:30 =# @cmd("grep 'julia'"), #= /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:31 =# @cmd("grep -v '@rpath'"))))
IOError: could not spawn otool -l /tmp/tmphMwh4B/HelloWorld.app/Contents/MacOS/hello: no such file or directory (ENOENT)
Stacktrace:
[1] _jl_spawn(::String, ::Array{String,1}, ::Cmd, ::Tuple{Base.DevNull,RawFD,Base.DevNull}) at ./process.jl:367
[2] (::getfield(Base, Symbol("##494#495")){Cmd})(::Tuple{Base.DevNull,RawFD,Base.DevNull}) at ./process.jl:509
[3] setup_stdio(::getfield(Base, Symbol("##494#495")){Cmd}, ::Tuple{Base.DevNull,RawFD,Base.DevNull}) at ./process.jl:490
[4] #_spawn#493(::Base.ProcessChain, ::Function, ::Cmd, ::Tuple{Base.DevNull,RawFD,Base.DevNull}) at ./process.jl:508
[5] (::getfield(Base, Symbol("#kw##_spawn")))(::NamedTuple{(:chain,),Tuple{Base.ProcessChain}}, ::typeof(Base._spawn), ::Cmd, ::Tuple{Base.DevNull,RawFD,Base.DevNull}) at ./none:0
[6] #_spawn#491(::Base.ProcessChain, ::Function, ::Base.OrCmds, ::Tuple{Base.DevNull,RawFD,Base.DevNull}) at ./process.jl:411
[7] (::getfield(Base, Symbol("#kw##_spawn")))(::NamedTuple{(:chain,),Tuple{Base.ProcessChain}}, ::typeof(Base._spawn), ::Base.OrCmds, ::Tuple{Base.DevNull,RawFD,Base.DevNull}) at ./none:0
[8] #_spawn#491(::Nothing, ::Function, ::Base.OrCmds, ::Tuple{Base.DevNull,Base.DevNull,Base.DevNull}) at ./process.jl:411
[9] #_spawn at ./none:0 [inlined]
[10] #_spawn#499 at ./process.jl:548 [inlined]
[11] _spawn at ./process.jl:548 [inlined]
[12] success(::Base.OrCmds) at ./process.jl:701
[13] macro expansion at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:28 [inlined]
[14] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1083 [inlined]
[15] macro expansion at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:28 [inlined]
[16] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1083 [inlined]
[17] top-level scope at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:19
commandline_app: Error During Test at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:36
Test threw exception
Expression: 0 == include("build_examples/commandline_hello.jl")
LoadError: ArgumentError: isdefined: too few arguments (expected 2)
Stacktrace:
[1] top-level scope at none:0
[2] include at ./boot.jl:317 [inlined]
[3] include_relative(::Module, ::String) at ./loading.jl:1041
[4] include(::Module, ::String) at ./sysimg.jl:29
[5] include(::String) at ./client.jl:388
[6] macro expansion at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:36 [inlined]
[7] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1083 [inlined]
[8] top-level scope at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:36
in expression starting at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/build_examples/commandline_hello.jl:7
commandline_app: Test Failed at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:37
Expression: success(#= /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:37 =# @cmd("open $builddir/hello.app"))
Stacktrace:
[1] macro expansion at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:37 [inlined]
[2] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1083 [inlined]
[3] top-level scope at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/ApplicationBuilder.jl:36
Test Summary: | Pass Fail Error Total
Test ApplicationBuilder (by compiling examples/*.jl) | 1 2 5 8
make_bundle_identifier Utils | 1 1
HelloWorld.app | 1 1 3 5
No external Dependencies | 1 1
commandline_app | 1 1 2
ERROR: LoadError: Some tests did not pass: 1 passed, 2 failed, 5 errored, 0 broken.
in expression starting at /home/kahr/.julia/packages/ApplicationBuilder/gJLwU/test/runtests.jl:3
ERROR: Package ApplicationBuilder errored during testing

Can't sign and distribute bundled macOS app: `identity of the developer cannot be confirmed`

I still haven't managed to sign an app I created through this tool successfully such that macOS is satisfied. No matter what I've tried, I always end up with the familiar warning:

โ€œPaddle Battleโ€ canโ€™t be opened because the identity of the developer cannot be confirmed.
Your security preferences allow installation of only apps from the App Store and identified developers.

This is so surprising and frustrating because all the tools that you're supposed to be able to use to validate whether the OS will allow you to open your app are reporting that Everything is Okay, but it still fails:

$ spctl --assess --verbose /Users/daly/Downloads/Paddle\ Battle.app
/Users/daly/Downloads/Paddle Battle.app: accepted
source=Developer ID     # (โœ…)

$ codesign -dv --verbose=4 /Users/daly/Downloads/Paddle\ Battle.app
Executable=/Users/daly/Downloads/Paddle Battle.app/Contents/MacOS/main
Identifier=com.nhdalyMadeThis.Paddle-Battle
Format=app bundle with Mach-O thin (x86_64)
[...]
Hash choices=sha1,sha256
Page size=4096
Signature size=8926
Authority=Developer ID Application: nhdalyMadeThis, LLC (BBRHTPDKSH)     # (โœ…)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
[...]

And the above behavior is pretty consistent no matter what process I'm using:

manual code signing
I first tried using the signing code I wrote here, which uses the mac codesign utility to sign everything, following the guidance in the Apple Developer documentation:

You sign all the individual components of your app, leaving no gaps, including:

  • Nested Code. [...]
  • Mach-O executables. [...]
  • Resources. [...]

That does seem to satisfactorily sign everything, and it runs locally, and the tools verify it's been signed, but when I upload and redownload it from the internet, I get the above warning.

xcode
Same with xcode. I've also tried copying all the built files output from this script into a new project in xcode. (That is, the compiled binary, the julia runtime libraries, the supporting libs, my asset files, my Info.plist and icons.) Then I rebuilt the app through there, and archived, and exported. But I haven't had better luck. The behavior and output from the verification tools are identical.

Depreciation warnings causing failure on non-Julia platforms

Hi,

I am developing a code to run without Julia installed and this package is great for that. However, I have depreciation warning at the beginning of my code that is causing the executable to fail with exception handling. Is there a way to disable these warnings while building the executable?

Thanks,
Matthew

unsupported keyword argument "verbose" :/

julia> build_app_bundle("hello.jl", appname="HelloWorld", verbose=true)
ERROR: MethodError: no method matching build_app_bundle(::String; appname="HelloWorld", verbose=true)
Closest candidates are:
build_app_bundle(::String; resources, libraries, builddir, appname, create_installer) at C:\Users\PC.julia\pa
ckages\ApplicationBuilder\PzBv2\src\bundle.jl:13 got unsupported keyword argument "verbose"
Stacktrace:
[1] kwerr(::NamedTuple{(:appname, :verbose),Tuple{String,Bool}}, ::Function, ::String) at .\error.jl:97
[2] (::getfield(ApplicationBuilder, Symbol("#kw##build_app_bundle")))(::NamedTuple{(:appname, :verbose),Tuple{S
tring,Bool}}, ::typeof(build_app_bundle), ::String) at .\none:0
[3] top-level scope at none:0

julia> versioninfo()
Julia Version 0.7.0
Commit a4cb80f3ed (2018-08-08 06:46 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, sandybridge)

julia> readlines("hello.jl")
12-element Array{String,1}:
"# Create a temporary .html file, and open it to share the greetings."

"Base.@ccallable function julia_main(ARGS::Vector{String})::Cint"

" tmpdir = mktempdir()"

" filename = joinpath(tmpdir, "hello.html")"

" open(filename, "w") do io"

" println(io, "Hello, World!")"

" println(io, "
-- Love, $PROGRAM_FILE")"

" println(io, """

Current working directory: <a href="file://$(pwd())">$(pwd())""")
"
" end"

" run(open file://\$filename)"

" return 0"

"end"

error: Erreur du bus

hello

I am trying to compile this naive little program with Gtk/Luxor on Linux Mint 169 64bits
and I end with this code error

Build executable "alarmClock":
  `cc '-DJULIAC_PROGRAM_LIBNAME="alarmClock.so"' -o alarmClock /home/ygo/.julia/packages/PackageCompiler/oT98U/examples/program.c alarmClock.so -std=gnu9999999 -I/home/ygo/julia/julia-1.1.0/include/julia -DJULIA_ENABLE_THREADING=1 -fPIC -L/home/ygo/julia/julia-1.1.0/lib -Wl,--export-dynamic -Wl,-rpath,/hom/e///y/g/o/julia/julia-1.1.0/lib -Wl,-rpath,/home/ygo/julia/julia-1.1.0/lib/julia -ljulia -m64 -O3 '-Wl,-rpath,$ORIGIN'`
/home/ygo/.julia/packages/PackageCompiler/oT98U/examples/program.c: In function โ€˜mainโ€™:
/home/ygo/.julia/packages/PackageCompiler/oT98U/examples/program.c:43:5: internal compiler error: Erreur du bus
     for (i = 1; i < argc; i++) {
     ^~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
ERROR: failed process: Process(`cc '-DJULIAC_PROGRAM_LIBNAME="alarmClock.so"' -o alarmClock /home/ygo/.julia/packages/PackageCompiler/oT98U/examples/progrrrrrram.c alarmClock.so -std=gnu99 -I/home/ygo/julia/julia-1.1.0/include/julia -DJULIA_ENABLE_THREADING=1 -fPIC -L/home/ygo/julia/julia-1.1.0/lib -Wl,--e-x-p-o-r-t-dynamic -Wl,-rpath,/home/ygo/julia/julia-1.1.0/lib -Wl,-rpath,/home/ygo/julia/julia-1.1.0/lib/julia -ljulia -m64 -O3 '-Wl,-rpath,$ORIGIN'`, Pro(ce(ss(Ex(it(ed(1)) [1]

some idea ?
thanks for help

objdump says "not recognized as a valid object file"

All,

Please see the following output from my most recent build run. main is generated, and I can execute it. Albeit with a crash that I think is unrelated, but I'm new to all of this. :-P

$ rm -rf builddir/ && julia build.jl
  Using calculated bundle_identifier: 'com.jason.gitviz'
~~~~~~ Creating mac app in "/Users/jason/src/all/gitviz.git/builddir/gitviz.app" ~~~~~~~
~~~~~~ Compiling a binary from 'src/main.jl'... ~~~~~~~
Julia program file:
  "/Users/jason/src/all/gitviz.git/builddir/gitviz.app/Contents/MacOS/applicationbuilderutils.jl"
C program file:
  "/Users/jason/.julia/packages/ApplicationBuilder/gJLwU/src/program.c"
Build directory:
  "/Users/jason/src/all/gitviz.git/builddir/gitviz.app/Contents/MacOS"
All done
/opt/local/libexec/llvm-3.9/bin/llvm-objdump: '/Users/jason/src/all/gitviz.git/builddir/gitviz.app/Contents/MacOS/applicationbuilderutils.jl': The file was not recognized as a valid object file
fatal error: otool: internal objdump command failed
~~~~~~ Generating 'Info.plist' for 'com.jason.gitviz'... ~~~~~~~
~~~~~~ Cleaning up temporary files... ~~~~~~~
~~~~~~ Done building '/Users/jason/src/all/gitviz.git/builddir/gitviz.app'! ~~~~~~~

applicationbuilderutils.jl does not exist under builddir/, perhaps the objdump should occur before cleaning up the temp files?

Discussion: Flexible paths for binary dependencies generated in `deps.jl` files?

This is an open thread for discussing one of the big remaining problems with ApplicationBuilder/PackageCompiler: Handling binary dependencies.

The state of the world:

Many packages depend on external shared libraries, which will be referenced via ccall. Most of these packages handle the process of installing and locating these dependencies through BinDeps and friends. In these cases, they will have a build.jl that generates a deps.jl, such that the deps.jl defines const variables with hard-coded absolute paths to the libraries. e.g.:

# ~/.julia/v0.6/Gtk/deps/deps.jl:
...
@checked_lib libgtk "/Users/daly/.julia/v0.6/Homebrew/deps/usr/lib/libgtk-3.dylib"
@checked_lib libglib "/Users/daly/.julia/v0.6/Homebrew/deps/usr/opt/glib/lib/libglib-2.0.0.dylib"
...

In addition, some packages reference these libraries via ccall from their __init__ functions, which isn't overridable via the hacks we're currently using in ApplicationBuilder (eg in examples/blink.jl).


Problem statement:
Compiled and bundled apps need to copy these shared libraries into their bundle directory, so that they're self contained, and all code that references them must reference them via relative paths to their in-bundle locations. (The paths must be relative because the entire app bundle can be relocated after compilation.) There cannot be any references to the original installed Pkg directories evaluated while compiling, because the path provided to ccall is compiled-in, rather than reevaluated at runtime.


Potential solution ideas:

  1. Super simple/dumb: make build.jl aware of the ENV variables ApplicationBuilder is using when compiling, and generate deps.jl files that conditionally use a simpler relative path if that ENV variable is true.

  2. The newer deps.jl files generated by BinaryBuilder.jl generates variables whose paths are relative-ish: relative to the deps.jl file:

    # ~/.julia/v0.6/MbedTLS/deps/deps.jl:
    ...
    const libmbedcrypto = joinpath(dirname(@__FILE__), "usr/lib/libmbedcrypto.2.11.0.dylib")
    const libmbedtls = joinpath(dirname(@__FILE__), "usr/lib/libmbedtls.10.dylib")
    const libmbedx509 = joinpath(dirname(@__FILE__), "usr/lib/libmbedx509.0.dylib")
    ...

    So possibly, we can take advantage of this by somehow copying the deps.jl file into the bundle as well when compiling? As far as I know, though, this won't work because there's no way to copy only the deps file and trick a module into seeing that one when it runs include.
    EDIT: What I wrote above doesn't actually make sense, because EVEN IF we did all that, the resultant paths would STILL be absolute-paths: just absolutely pointing into the app bundle. But as soon as you move the app bundle anywhere, it breaks again. The ccalls MUST be providing a relative path relative to the application's cwd!

  3. Add in a hook that you can somehow define that, when provided, will cause all variables to have their paths defined relative to some other path you provide (which could simply be "" in our case)... This is vague..

    1. Maybe we can do the above via something like @checked_lib, which somehow looks for your hook and then creates one definition or the other.

ERROR: UndefVarError: build_executable not defined

I'm trying to learn how to use ApplicationBuilder.jl to build a standalone fully independent application for windows. for example, the following function could be the code for the app:

function Hello()
    println("Hello World")
end

then based on the ApplicationBuilder documentation the whole thing should be wrapped around a main function like this:

include("helloexe.jl") #address of the file containing the above Hello() function
Base.@ccallable function julia_main(ARGS::Vector{String})::Cint
    return Hello()
end

When I run the

using ApplicationBuilder
build_app_bundle("D:\\Julia\\my_julia_main.jl", appname="Hello")

it gives me the following error:

build_app_bundle("D:\\Julia\\my_julia_main.jl", appname="Hello")
[ Info: Building at path D:\Julia\builddir\Hello
[ Info: Copying resources:
[ Info: Copying libraries
ERROR: UndefVarError: build_executable not defined
Stacktrace:
 [1] build_app_bundle(::String; resources::Array{String,1}, libraries::Array{String,1}, builddir::String, appname::String, create_installer::Bool) at C:\Users\Reza\.julia\packages\ApplicationBuilder\kMUzZ\src\bundle.jl:44
 [2] top-level scope at REPL[25]:1

What does 'build_executable not defined' mean and how can I fix it? I asked the question on StackOverflow and someone said it is a dependency problem with "PackageCompiler". Is it so?

Unable to reproduce example

Setting up the files like:

#build.jl
build_app_bundle("./src/julia_main.jl", appname="MyCode");
#julia_main.jl
Base.@ccallable function julia_main(ARGS::Vector{String})::Cint
    return 0
end

throws the following error:

julia> include("build.jl")
  Using calculated bundle_identifier: 'com.lackner.mycode'
~~~~~~ Creating mac app in "/Users/lackner/Documents/Julia/Tests/AppBuilding/builddir/MyCode.app" ~~~~~~~
~~~~~~ Compiling a binary from './src/julia_main.jl'... ~~~~~~~
Julia program file:
  "/Users/lackner/Documents/Julia/Tests/AppBuilding/builddir/MyCode.app/Contents/MacOS/applicationbuilderutils.jl"
C program file:
  "/Users/lackner/.julia/packages/ApplicationBuilder/PzBv2/src/program.c"
Build directory:
  "/Users/lackner/Documents/Julia/Tests/AppBuilding/builddir/MyCode.app/Contents/MacOS"
ERROR: LoadError: LoadError: UndefVarError: include not defined
Stacktrace:
 [1] top-level scope at none:0 (repeats 3 times)
in expression starting at /Users/lackner/Documents/Julia/Tests/AppBuilding/builddir/MyCode.app/Contents/MacOS/applicationbuilderutils.jl:1
in expression starting at /Users/lackner/.julia/packages/PackageCompiler/oT98U/sysimg/run_julia_code.jl:10
ERROR: LoadError: failed process: Process(`/Users/lackner/Apps/Julia-1.1.app/Contents/Resources/julia/bin/julia --cpu-target=x86-64 --optimize=3 -g0 --output-o=julia_main.a --track-allocation=none --code-coverage=none --history-file=yes --inline=yes --math-mode=ieee --startup-file=no --compile=yes --track-allocation=none --sysimage-native-code=yes --sysimage=/Users/lackner/Apps/Julia-1.1.app/Contents/Resources/julia/lib/julia/sys.dylib --compiled-modules=yes --optimize=0 /Users/lackner/.julia/packages/PackageCompiler/oT98U/sysimg/run_julia_code.jl`, ProcessExited(1)) [1]
Stacktrace:
 [1] pipeline_error at ./process.jl:785 [inlined]
 [2] #run#515(::Bool, ::Function, ::Cmd) at ./process.jl:726
 [3] run at ./process.jl:724 [inlined]
 [4] #run_julia#1 at /Users/lackner/.julia/packages/PackageCompiler/oT98U/src/compiler_flags.jl:225 [inlined]
 [5] #run_julia at ./none:0 [inlined]
 [6] (::getfield(PackageCompiler, Symbol("##13#14")){Base.Iterators.Pairs{Symbol,Any,NTuple{14,Symbol},NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),Tuple{Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,String,String,String,Nothing,Nothing,Nothing}}},String})() at /Users/lackner/.julia/packages/PackageCompiler/oT98U/src/static_julia.jl:262
 [7] cd(::getfield(PackageCompiler, Symbol("##13#14")){Base.Iterators.Pairs{Symbol,Any,NTuple{14,Symbol},NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),Tuple{Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,String,String,String,Nothing,Nothing,Nothing}}},String}, ::String) at ./file.jl:96
 [8] #build_object#12(::Base.Iterators.Pairs{Symbol,Any,NTuple{14,Symbol},NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),Tuple{Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,String,String,String,Nothing,Nothing,Nothing}}}, ::Function, ::String, ::String, ::String, ::Bool) at /Users/lackner/.julia/packages/PackageCompiler/oT98U/src/static_julia.jl:261
 [9] #build_object at ./none:0 [inlined]
 [10] build_object(::String, ::String, ::String, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::String, ::String, ::String, ::Nothing, ::Nothing, ::Nothing) at /Users/lackner/.julia/packages/PackageCompiler/oT98U/src/static_julia.jl:240
 [11] #static_julia#5(::String, ::Bool, ::Bool, ::String, ::String, ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Nothing, ::Bool, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::String, ::String, ::String, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Cmd, ::typeof(PackageCompiler.static_julia), ::String) at /Users/lackner/.julia/packages/PackageCompiler/oT98U/src/static_julia.jl:161
 [12] #static_julia at ./tuple.jl:0 [inlined]
 [13] #build_executable#31 at /Users/lackner/.julia/packages/PackageCompiler/oT98U/src/api.jl:104 [inlined]
 [14] (::getfield(PackageCompiler, Symbol("#kw##build_executable")))(::NamedTuple{(:builddir, :verbose, :optimize, :snoopfile, :debug, :cpu_target, :cc_flags),Tuple{String,Bool,String,Nothing,String,String,Cmd}}, ::typeof(PackageCompiler.build_executable), ::String, ::String, ::String) at ./none:0
 [15] (::getfield(ApplicationBuilder, Symbol("##2#7")){Bool,String})() at /Users/lackner/.julia/packages/ApplicationBuilder/PzBv2/src/ApplicationBuilder.jl:164
 [16] withenv(::getfield(ApplicationBuilder, Symbol("##2#7")){Bool,String}, ::Pair{String,String}, ::Vararg{Pair{String,String},N} where N) at ./env.jl:148
 [17] #build_app_bundle#1(::String, ::String, ::Array{String,1}, ::Array{String,1}, ::Bool, ::Nothing, ::String, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Bool, ::Bool, ::typeof(build_app_bundle), ::String) at /Users/lackner/.julia/packages/ApplicationBuilder/PzBv2/src/ApplicationBuilder.jl:160
 [18] (::getfield(ApplicationBuilder, Symbol("#kw##build_app_bundle")))(::NamedTuple{(:appname,),Tuple{String}}, ::typeof(build_app_bundle), ::String) at ./none:0
 [19] top-level scope at none:0
 [20] include at ./boot.jl:326 [inlined]
 [21] include_relative(::Module, ::String) at ./loading.jl:1038
 [22] include(::Module, ::String) at ./sysimg.jl:29
 [23] include(::String) at ./client.jl:403
 [24] top-level scope at none:0
in expression starting at /Users/lackner/Documents/Julia/Tests/AppBuilding/build.jl:1
julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)
Environment:
  JULIA_EDITOR = atom  -a
  JULIA_NUM_THREADS = 2

"ERROR: Unable to find compatible target in system image" when building

I am trying to build the example on MacOS with Julia 1.1 (self-built). This does not work:

julia> build_app_bundle("/Users/eschnett/.julia/packages/ApplicationBuilder/kMUzZ/examples/hello.jl", appname="hello")
  Using calculated bundle_identifier: 'com.eschnett.hello'
~~~~~~ Creating mac app in "/Users/eschnett/src/jl/HelloWorld/builddir/hello.app" ~~~~~~~
~~~~~~ Compiling a binary from '/Users/eschnett/.julia/packages/ApplicationBuilder/kMUzZ/examples/hello.jl'... ~~~~~~~
Julia program file:
  "/Users/eschnett/src/jl/HelloWorld/builddir/hello.app/Contents/MacOS/applicationbuilderutils.jl"
C program file:
  "/Users/eschnett/.julia/packages/ApplicationBuilder/kMUzZ/src/program.c"
Build directory:
  "/Users/eschnett/src/jl/HelloWorld/builddir/hello.app/Contents/MacOS"
ERROR: Unable to find compatible target in system image.
ERROR: failed process: Process(`/Users/eschnett/julia-1.1/bin/julia --compiled-modules=yes --cpu-target=x86-64 --optimize=3 -g0 --output-o=hello.a --track-allocation=none --code-coverage=none --history-file=yes --inline=yes --math-mode=ieee --compile=yes --track-allocation=none --sysimage-native-code=yes --sysimage=/Users/eschnett/julia-1.1/lib/julia/sys.dylib --compiled-modules=yes --optimize=2 /Users/eschnett/.julia/packages/PackageCompiler/oT98U/sysimg/run_julia_code.jl`, ProcessExited(1)) [1]

Application destination directory and name

Why application on Linux is packaged into additional appname/core directories and why application binary name is not appname but the name of Julia file containing julia_main function? I think it makes sense for MacOS platform but not so much on Linux/Windows.

Why the builddir directory is put inside the same directory julia_main function file is located? For example build_app_bundle executed like this:

build_app_bundle("src/App.jl", appname="app", builddir="build")

put build directory inside src one which is not very intuitive I would say.

[error] type JLOptions has no filed outputjitbc

this is a very simple demo

Base.@ccallable function julia_main(ARGS::Vector{String})::Cint
  println("Hello World")
  return 0
end

and when calling build_app_bundle("src/parse_command.jl", appname = "MyCode")

Stacktrace:
  [1] jl_option_value(opts::Base.JLOptions, key::Symbol)
    @ PackageCompiler ~/.julia/packages/PackageCompiler/4yNnV/src/compiler_flags.jl:174
  [2] julia_code_cmd(code::String, jl_options::Base.JLOptions; kw::Base.Pairs{Symbol, Union{Nothing, String}, NTuple{17, Symbol}, NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode, :output_o, :track_allocation, :code_coverage), Tuple{Nothing, String, Nothing, Nothing, String, Nothing, Nothing, Nothing, String, String, String, Nothing, Nothing, Nothing, String, String, String}}})
    @ PackageCompiler ~/.julia/packages/PackageCompiler/4yNnV/src/compiler_flags.jl:258
  [3] #run_julia#1
    @ ~/.julia/packages/PackageCompiler/4yNnV/src/compiler_flags.jl:225 [inlined]  [4] (::PackageCompiler.var"#13#14"{Base.Pairs{Symbol, Union{Nothing, String}, NTuple{14, Symbol}, NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode), Tuple{Nothing, Nothing, Nothing, Nothing, String, Nothing, Nothing, Nothing, String, String, String, Nothing, Nothing, Nothing}}}, String})()
    @ PackageCompiler ~/.julia/packages/PackageCompiler/4yNnV/src/static_julia.jl:263
  [5] cd(f::PackageCompiler.var"#13#14"{Base.Pairs{Symbol, Union{Nothing, String}, NTuple{14, Symbol}, NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode), Tuple{Nothing, Nothing, Nothing, Nothing, String, Nothing, Nothing, Nothing, String, String, String, Nothing, Nothing, Nothing}}}, String}, dir::String)
    @ Base.Filesystem ./file.jl:110
  [6] build_object(juliaprog::String, o_file::String, builddir::String, verbose::Bool; julia_flags::Base.Pairs{Symbol, Union{Nothing, String}, NTuple{14, Symbol}, NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode), Tuple{Nothing, Nothing, Nothing, Nothing, String, Nothing, Nothing, Nothing, String, String, String, Nothing, Nothing, Nothing}}})
    @ PackageCompiler ~/.julia/packages/PackageCompiler/4yNnV/src/static_julia.jl:262
  [7] build_object(juliaprog::String, o_file::String, builddir::String, verbose::Bool, sysimage::Nothing, home::Nothing, startup_file::Nothing, handle_signals::Nothing, sysimage_native_code::Nothing, compiled_modules::String, depwarn::Nothing, warn_overwrite::Nothing, compile::Nothing, cpu_target::String, optimize::String, debug::String, inline::Nothing, check_bounds::Nothing, math_mode::Nothing)
    @ PackageCompiler ~/.julia/packages/PackageCompiler/4yNnV/src/static_julia.jl:241
  [8] static_julia(juliaprog::String; cprog::String, verbose::Bool, quiet::Bool, builddir::String, outname::String, snoopfile::Nothing, clean::Bool, autodeps::Bool, object::Bool, shared::Bool, init_shared::Bool, executable::Bool, rmtemp::Bool, copy_julialibs::Bool, copy_files::Nothing, release::Bool, Release::Bool, sysimage::Nothing, home::Nothing, startup_file::Nothing, handle_signals::Nothing, sysimage_native_code::Nothing, compiled_modules::String, depwarn::Nothing, warn_overwrite::Nothing, compile::Nothing, cpu_target::String, optimize::String, debug::String, inline::Nothing, check_bounds::Nothing, math_mode::Nothing, cc::Nothing, cc_flags::Nothing)
    @ PackageCompiler ~/.julia/packages/PackageCompiler/4yNnV/src/static_julia.jl:162
  [9] #build_executable#31
    @ ~/.julia/packages/PackageCompiler/4yNnV/src/api.jl:104 [inlined]
 [10] (::ApplicationBuilder.var"#3#7"{String, Bool, String, String, Nothing, String, String})()
    @ ApplicationBuilder ~/.julia/packages/ApplicationBuilder/sg0US/src/ApplicationBuilder.jl:146
 [11] withenv(::ApplicationBuilder.var"#3#7"{String, Bool, String, String, Nothing, String, String}, ::Pair{String, String}, ::Vararg{Pair{String, String}})
    @ Base ./env.jl:172
 [12] build_app_bundle(juliaprog_main::String; appname::String, builddir::String, binary_name::String, resources::Vector{String}, libraries::Vector{String}, verbose::Bool, bundle_identifier::Nothing, app_version::String, icns_file::Nothing, certificate::Nothing, entitlements_file::Nothing, snoopfile::Nothing, autosnoop::Bool, cpu_target::String, create_installer::Bool, commandline_app::Bool)
    @ ApplicationBuilder ~/.julia/packages/ApplicationBuilder/sg0US/src/ApplicationBuilder.jl:142
 [13] top-level scope
    @ REPL[14]:1

can u take a look ?

JuliaCon 2018 talk?

@ranjanan: I'm thinking about doing a talk at JuliaCon about this! I think there are many people who would be interested, and it could be useful!

I think I want it to be an interactive tutorial where we have the audience build their own tiny application.

I've written a draft proposal here:
https://docs.google.com/document/d/1gloLBKCgAj0DFnRR68CC7QchefDAZ0rUJgqvenQN-Ls/edit?usp=sharing

If you get time, would you look it over and let me know what you think? Thanks so much!! :)

Generalisable package?

I was wondering if this can be turned into a more generalizable package. Perhaps we can specify a dictionary of paths to non jl files including binaries, which we can use to preprocess the source files. I noticed that in your Paddle Battle, you included a code snippet to change the paths and an environment variable to control whether the paths get changed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.