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

Static compilation fails on Compose.jl #221

Closed
bmharsha opened this issue Sep 16, 2016 · 9 comments
Closed

Static compilation fails on Compose.jl #221

bmharsha opened this issue Sep 16, 2016 · 9 comments

Comments

@bmharsha
Copy link

bmharsha commented Sep 16, 2016

I’m trying to create a system image of Julia with Compose.jl embedded, I encountered following error while building Julia (using release-0.5 branch).

â  make -j 4
    JULIA usr/lib/julia/sys.o
coreio.jl
exports.jl
essentials.jl
base.jl
generator.jl
reflection.jl
options.jl
promotion.jl
tuple.jl
range.jl
expr.jl
error.jl
bool.jl
number.jl
int.jl
operators.jl
pointer.jl
refpointer.jl
WARNING: Method definition (::Type{#T<:Any})(Any) in module Inference at coreimg.jl:39 overwritten in module Base at sysimg.jl:53.
checked.jl
abstractarray.jl
subarray.jl
array.jl
hashing.jl
rounding.jl
float.jl
complex.jl
rational.jl
multinverses.jl
abstractarraymath.jl
arraymath.jl
float16.jl
simdloop.jl
reduce.jl
reshapedarray.jl
bitarray.jl
intset.jl
dict.jl
set.jl
iterator.jl
build_h.jl
version_git.jl
osutils.jl
c.jl
sysinfo.jl
io.jl
iostream.jl
iobuffer.jl
char.jl
intfuncs.jl
strings/strings.jl
strings/errors.jl
strings/string.jl
strings/types.jl
strings/basic.jl
strings/search.jl
strings/util.jl
strings/io.jl
strings/utf8proc.jl
parse.jl
shell.jl
regex.jl
pcre.jl
show.jl
base64.jl
nullable.jl
version.jl
libc.jl
libdl.jl
env.jl
libuv.jl
uv_constants.jl
event.jl
task.jl
lock.jl
threads.jl
weakkeydict.jl
stream.jl
socket.jl
filesystem.jl
process.jl
multimedia.jl
grisu/grisu.jl
methodshow.jl
floatfuncs.jl
math.jl
cartesian.jl
multidimensional.jl
permuteddimsarray.jl
reducedim.jl
ordering.jl
collections.jl
sort.jl
WARNING: Method definition searchsortedfirst(AbstractArray{T<:Any, 1}, Any) in module Sort at sort.jl:184 overwritten at sort.jl:187.
WARNING: Method definition searchsortedlast(AbstractArray{T<:Any, 1}, Any) in module Sort at sort.jl:184 overwritten at sort.jl:187.
WARNING: Method definition searchsorted(AbstractArray{T<:Any, 1}, Any) in module Sort at sort.jl:184 overwritten at sort.jl:187.
gmp.jl
mpfr.jl
combinatorics.jl
hashing2.jl
dSFMT.jl
random.jl
printf.jl
meta.jl
Enums.jl
serialize.jl
channels.jl
clusterserialize.jl
multi.jl
workerpool.jl
pmap.jl
managers.jl
asyncmap.jl
loading.jl
mmap.jl
sharedarray.jl
datafmt.jl
deepcopy.jl
interactiveutil.jl
replutil.jl
test.jl
i18n.jl
initdefs.jl
Terminals.jl
LineEdit.jl
REPLCompletions.jl
REPL.jl
client.jl
util.jl
linalg/linalg.jl
broadcast.jl
statistics.jl
irrationals.jl
dft.jl
dsp.jl
quadgk.jl
fastmath.jl
libgit2/libgit2.jl
pkg/pkg.jl
stacktraces.jl
profile.jl
dates/Dates.jl
sparse/sparse.jl
threadcall.jl
deprecated.jl
docs/helpdb.jl
docs/helpdb/Base.jl
docs/basedocs.jl
markdown/Markdown.jl
docs/Docs.jl
/home/julia/JuliaUserImage_image/julia/base/precompile.jl
WARNING: could not import StructIO.pack into COFF
WARNING: could not import Base.lastidx into LegacyStrings
WARNING: Method definition XML_ErrorString(Any) in module LibExpat at /home/julia/JuliaUserImage_packages/v0.5/LibExpat/src/lX_common_h.jl:4 overwritten at /home/julia/JuliaUserImage_packages/v0.5/LibExpat/src/lX_common_h.jl:4.
WARNING: Method definition abs2(DualNumbers.Dual4) in module DualNumbers at /home/julia/JuliaUserImage_packages/v0.5/DualNumbers/src/dual_n.jl:78 overwritten at /home/julia/JuliaUserImage_packages/v0.5/DualNumbers/src/dual_n.jl:154.
WARNING: requiring "Dates" in module "Main" did not define a corresponding module.
WARNING: Method definition info(Any...) in module Base at util.jl:320 overwritten in module Logging at /home/julia/JuliaUserImage_packages/v0.5/Logging/src/Logging.jl:61.
WARNING: Method definition warn(Any...) in module Base at util.jl:350 overwritten in module Logging at /home/julia/JuliaUserImage_packages/v0.5/Logging/src/Logging.jl:61.
WARNING: Method definition pvalue(HypothesisTests.FisherTLinearAssociation) in module HypothesisTests at /home/julia/JuliaUserImage_packages/v0.5/HypothesisTests/src/circular.jl:139 overwritten at /home/julia/JuliaUserImage_packages/v0.5/HypothesisTests/src/circular.jl:139.
WARNING: Method definition #pvalue(Array{Any, 1}, HypothesisTests.#pvalue, HypothesisTests.FisherTLinearAssociation) in module HypothesisTests overwritten.
WARNING: Method definition pvalue(HypothesisTests.FisherTLinearAssociation) in module HypothesisTests at /home/julia/JuliaUserImage_packages/v0.5/HypothesisTests/src/circular.jl:139 overwritten at /home/julia/JuliaUserImage_packages/v0.5/HypothesisTests/src/circular.jl:139.
WARNING: Method definition #pvalue(Array{Any, 1}, HypothesisTests.#pvalue, HypothesisTests.FisherTLinearAssociation) in module HypothesisTests overwritten.
WARNING: `@unix_only` is deprecated, use `@static if is_unix()` instead
 in depwarn(::String, ::Symbol) at ./deprecated.jl:64
 in @unix_only(::Any) at ./deprecated.jl:492
 in include_from_node1(::String) at ./loading.jl:488
 in eval(::Module, ::Any) at ./boot.jl:234
 in require(::Symbol) at ./loading.jl:415
 in include_from_node1(::String) at ./loading.jl:488
 in exec_program at /home/julia/JuliaUserImage_image/julia/ui/repl.c:66
 in true_main at /home/julia/JuliaUserImage_image/julia/ui/repl.c:119
 in main at /home/julia/JuliaUserImage_image/julia/ui/repl.c:232
while loading /home/julia/JuliaUserImage_packages/v0.5/Zlib/src/Zlib.jl, in expression starting on line 28
LoadError("sysimg.jl",381,LoadError("/home/julia/JuliaUserImage_image/julia/base/userimg.jl",2,LoadError("/home/julia/JuliaUserImage_packages/v0.5/Compose/src/Compose.jl",174,BoundsError(String[],(1,)))))
*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***
make[1]: *** [/home/julia/JuliaUserImage_image/julia/usr/lib/julia/sys.o] Error 1
make: *** [julia-sysimg-release] Error 2 

OS = Ubuntu 14.04
Compose version = 0.4.4

@tkelman
Copy link
Contributor

tkelman commented Sep 16, 2016

some more info at JuliaLang/julia#16970. Compose should not be trying to use Pkg at load time to deal with optional dependencies. Optional dependencies should be moved to separate packages to work properly with precompilation.

@tlnagy
Copy link
Member

tlnagy commented Sep 17, 2016

@tkelman Is this what FileIO.jl does to handle optional dependencies?

@tkelman
Copy link
Contributor

tkelman commented Sep 17, 2016

FileIO is more about dispatching to whichever of multiple possible packages are installed. It does import packages to do so, but into Main rather than itself. Possibly dodgy to eval things that way, not sure.

@tlnagy
Copy link
Member

tlnagy commented Sep 17, 2016

Would the best course of action be to wait for extern?

@tkelman
Copy link
Contributor

tkelman commented Sep 17, 2016

No, the issue should be fixed for 0.4 and 0.5 supporting versions of the package if at all possible.

@shashi shashi mentioned this issue Oct 19, 2016
@bjarthur
Copy link
Member

bjarthur commented Dec 3, 2017

as a workaround, i tried commenting out the conditional dependencies before building a new system image with Compose in userimg.jl, but i get a seg fault.

here are the changes i made to Compose. when using the default sysimg that is bundled with julia 0.6, these work fine.

$ git diff
diff --git a/src/Compose.jl b/src/Compose.jl
index 8925b0b..eb0a1f5 100644
--- a/src/Compose.jl
+++ b/src/Compose.jl
@@ -153,25 +153,25 @@ macro missing_cairo_error(backend)
     string(msg1, msg2)
 end
 
-if isinstalled("Cairo")
+#if isinstalled("Cairo")
     include("cairo_backends.jl")
     include("immerse_backend.jl")
-else
-    global PNG
-    global PS
-    global PDF
-
-    PNG(args...) = error(@missing_cairo_error "PNG")
-    PS(args...) = error(@missing_cairo_error "PS")
-    PDF(args...) = error(@missing_cairo_error "PDF")
-end
+#else
+#    global PNG
+#    global PS
+#    global PDF
+#
+#    PNG(args...) = error(@missing_cairo_error "PNG")
+#    PS(args...) = error(@missing_cairo_error "PS")
+#    PDF(args...) = error(@missing_cairo_error "PDF")
+#end
 include("svg.jl")
 include("pgf_backend.jl")
 
 # If available, pango and fontconfig are used to compute text extents and match
 # fonts. Otherwise a simplistic pure-julia fallback is used.
 
-if isinstalled("Fontconfig")
+#if isinstalled("Fontconfig")
     pango_cairo_ctx = C_NULL
     include("pango.jl")
 
@@ -185,9 +185,9 @@ if isinstalled("Fontconfig")
                                  Ptr{Void}, (Ptr{Void},), pango_cairo_fm)
         pangolayout = PangoLayout()
     end
-else
-    include("fontfallback.jl")
-end
+#else
+#    include("fontfallback.jl")
+#end
 
 show(io::IO, m::MIME"text/html", ctx::Context) =
     draw(SVGJS(io, default_graphic_width, default_graphic_height, false,

here's how i built the new sysimg. the build process returns no errors or warnings:

$ cat userimg.jl 
using Compose

julia> include(joinpath(JULIA_HOME, Base.DATAROOTDIR, "julia", "build_sysimg.jl"))
julia> build_sysimg("/Users/arthurb/sys.ji", "native", "/Users/arthurb/userimg.jl")

and here's the error i get upon starting julia with the customized sysimg:

$ julia -J /Users/arthurb/sys.ji.dylib

signal (11): Segmentation fault: 11
while loading no file, in expression starting on line 0
Segmentation fault: 11

any ideas?

@tlnagy
Copy link
Member

tlnagy commented Dec 3, 2017 via email

@bjarthur
Copy link
Member

bjarthur commented Dec 4, 2017

the problem is the __init__ used if Fontconfig is installed. if that's commented out and fontfallback.jl is used instead, then a custom userimg.jl with using Gadfly compiles and runs without errors. sadly, the time to render the first plot is just as slow :(

@tlnagy
Copy link
Member

tlnagy commented Sep 27, 2018

This is likely to be resolved since we removed our hacky Pkg loading and started using Requires in #282. Please open a new issue if you still run into issues.

@tlnagy tlnagy closed this as completed Sep 27, 2018
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

Successfully merging a pull request may close this issue.

4 participants