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

Build failure on ARM32 (Raspberry Pi 4B) plus proposed fix #297

Closed
wiremoons opened this issue Dec 28, 2019 · 0 comments · Fixed by #304
Closed

Build failure on ARM32 (Raspberry Pi 4B) plus proposed fix #297

wiremoons opened this issue Dec 28, 2019 · 0 comments · Fixed by #304

Comments

@wiremoons
Copy link

Bug found while compiling a test app on a Raspberry Pi 4B. The same code had previously compiled ok under Ubuntu in an x86 machine.

Bug is caused by additional source code that had been added to fix a problem with compiling for Windows 32bit, based on the comment left at the point of breakage. The comment was helpful however in locating the bug :)

I have provided a pull request with a proposed fix that works ok once applied.

Just for completeness:

The following Raspberry Pi operating system and kernel version is being used

Linux pi4mobi 4.19.79-v7l+ #1273 SMP Fri Oct 11 18:23:45 BST 2019 armv7l GNU/Linux

Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

The Julia version is the pre-complied version from Julia downloads, as follows:

Julia Version 1.3.0
Commit 46ce4d7933 (2019-11-26 06:09 UTC)
Platform Info:
  OS: Linux (arm-linux-gnueabihf)
  CPU: ARMv7 Processor rev 3 (v7l)
  WORD_SIZE: 32
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, cortex-a72)

Package versions being used are:

(v1.3) pkg> status
    Status `~/.julia/environments/v1.3/Project.toml`
  [c7e460c6] ArgParse v0.6.2
  [9b87118b] PackageCompiler v0.6.5

The source code of the test app is:

# hello_binary.jl
#

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

# Main : required PackageComplier boilerplate startup function
Base.@ccallable function julia_main(ARGS::Vector{String})::Cint
    SayHello()
    return 0
end

The build command is below, noting that juliac is a bash alias as: alias juliac='$HOME/.julia/packages/PackageCompiler/4yNnV/juliac.jl'

juliac ./hello_binary.jl -tavern hello_binary

The build output including the error and failure message is:

Julia program file:
  "/home/simon/projects/code/julia/hello_binary/hello_binary.jl"
C program file:
  "/home/simon/.julia/packages/PackageCompiler/4yNnV/examples/program.c"
Build directory:
  "/home/simon/projects/code/julia/hello_binary/builddir"
Make build directory
Build static library "hello_binary.a":
  atexit_hook_copy = copy(Base.atexit_hooks) # make backup
# clean state so that any package we use can carelessly call atexit
empty!(Base.atexit_hooks)
Base.__init__()
Sys.__init__() #fix /~https://github.com/JuliaLang/julia/issues/30479
using REPL
Base.REPL_MODULE_REF[] = REPL
Mod = @eval module $(gensym("anon_module")) end
# Include into anonymous module to not polute namespace
Mod.include("/home/simon/projects/code/julia/hello_binary/hello_binary.jl")
Base._atexit() # run all exit hooks we registered during precompile
empty!(Base.atexit_hooks) # don't serialize the exit hooks we run + added
# atexit_hook_copy should be empty, but who knows what base will do in the future
append!(Base.atexit_hooks, atexit_hook_copy)

Build shared library "hello_binary.so":
  `cc -shared '-DJULIAC_PROGRAM_LIBNAME="hello_binary.so"' -o hello_binary.so -Wl,--whole-archive hello_binary.a -Wl,--no-whole-archive -std=gnu99 -I/home/simon/.julia-dev/include/julia -DJULIA_ENABLE_THREADING=1 -fPIC -L/home/simon/.julia-dev/lib -Wl,--export-dynamic -Wl,-rpath,/home/simon/.julia-dev/lib -Wl,-rpath,/home/simon/.julia-dev/lib/julia -ljulia -mbe32 -O3`
Build executable "hello_binary":
  `cc '-DJULIAC_PROGRAM_LIBNAME="hello_binary.so"' -o hello_binary /home/simon/.julia/packages/PackageCompiler/4yNnV/examples/program.c hello_binary.so -std=gnu99 -I/home/simon/.julia-dev/include/julia -DJULIA_ENABLE_THREADING=1 -fPIC -L/home/simon/.julia-dev/lib -Wl,--export-dynamic -Wl,-rpath,/home/simon/.julia-dev/lib -Wl,-rpath,/home/simon/.julia-dev/lib/julia -ljulia -mbe32 -O3 '-Wl,-rpath,$ORIGIN' -march=pentium4`
cc: error: unrecognized -march target: pentium4   
cc: note: valid arguments are: armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5t armv5e armv5te armv5tej armv6 armv6j armv6k armv6z armv6kz armv6zk armv6t2 armv6-m armv6s-m armv7 armv7-a armv7ve armv7-r armv7-m armv7e-m armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8-m.base armv8-m.main armv8-r iwmmxt iwmmxt2 native
cc: error: missing argument to ‘-march=’
ERROR: LoadError: failed process: Process(`cc '-DJULIAC_PROGRAM_LIBNAME="hello_binary.so"' -o hello_binary /home/simon/.julia/packages/PackageCompiler/4yNnV/examples/program.c hello_binary.so -std=gnu99 -I/home/simon/.julia-dev/include/julia -DJULIA_ENABLE_THREADING=1 -fPIC -L/home/simon/.julia-dev/lib -Wl,--export-dynamic -Wl,-rpath,/home/simon/.julia-dev/lib -Wl,-rpath,/home/simon/.julia-dev/lib/julia -ljulia -mbe32 -O3 '-Wl,-rpath,$ORIGIN' -march=pentium4`, ProcessExited(1)) [1]

Stacktrace:
 [1] pipeline_error at ./process.jl:525 [inlined] 
 [2] #run#565(::Bool, ::typeof(run), ::Cmd) at ./process.jl:440
 [3] run(::Cmd) at ./process.jl:438
 [4] (::PackageCompiler.var"#19#20")() at /home/simon/.julia/packages/PackageCompiler/4yNnV/src/static_julia.jl:328
 [5] cd(::PackageCompiler.var"#19#20", ::String) at ./file.jl:104
 [6] build_exec(::String, ::String, ::String, ::String, ::Bool, ::String, ::String, ::Cmd, ::Array{String,1}) at /home/simon/.julia/packages/PackageCompiler/4yNnV/src/static_julia.jl:327
 [7] #static_julia#5(::Nothing, ::Bool, ::Bool, ::Nothing, ::String, ::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, ::Array{String,1}, ::typeof(static_julia), ::String) at /home/simon/.julia/packages/PackageCompiler/4yNnV/src/static_julia.jl:171
 [8] (::PackageCompiler.var"#kw##static_julia")(::NamedTuple{(:verbose, :rmtemp, :cc_flags, :outname, :autodeps, :executable, :release),Tuple{Bool,Bool,Array{String,1},String,Bool,Bool,Bool}}, ::typeof(static_julia), ::String) at ./none:0
 [9] julia_main(::Array{String,1}) at /home/simon/.julia/packages/PackageCompiler/4yNnV/juliac.jl:182
 [10] top-level scope at /home/simon/.julia/packages/PackageCompiler/4yNnV/juliac.jl:188
 [11] include at ./boot.jl:328 [inlined]
 [12] include_relative(::Module, ::String) at ./loading.jl:1105
 [13] include(::Module, ::String) at ./Base.jl:31 
 [14] exec_options(::Base.JLOptions) at ./client.jl:287
 [15] _start() at ./client.jl:460
in expression starting at /home/simon/.julia/packages/PackageCompiler/4yNnV/juliac.jl:187
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant