PackageCompiler.jl
PackageCompiler.jl copied to clipboard
Can't build the "examples/MyLib" project on Arch Linux due to provilege errors
I use Arch Linux with Julia 1.9.3 and PackageCompiler v2.1.7. I'm trying to build the example "MyLib" from PackageCompiler source.
I installed PackageCompiler with Pkg.Add('PackageCompiler')
I copied the "examples" directory and I tried to run make
in the "MyLib" subdirectory
I get the error:
ERROR: LoadError: ArgumentError: Package PackageCompiler [9b87118b-4619-50d2-8e1e-99f35a4d4d9d] is required but does not seem to be installed:
- Run `Pkg.instantiate()` to install all recorded dependencies.
To avoid this problem I have deleted build\Manifest.toml
I then tried again with make
.
I get the error:
ERROR: LoadError: IOError: open("/usr/lib/dbus-1.0/dbus-daemon-launch-helper", 0, 0): permission denied (EACCES)
Stacktrace:
[1] uv_error
@ ./libuv.jl:100 [inlined]
[2] open(path::String, flags::UInt8, mode::Int64)
@ Base.Filesystem ./filesystem.jl:121
[3] open
@ ./filesystem.jl:113 [inlined]
[4] sendfile(src::String, dst::String)
@ Base.Filesystem ./file.jl:992
[5] cptree(src::String, dst::String; force::Bool, follow_symlinks::Bool)
@ Base.Filesystem ./file.jl:351
[6] cptree(src::String, dst::String; force::Bool, follow_symlinks::Bool)
@ Base.Filesystem ./file.jl:348
[7] cptree
@ ./file.jl:338 [inlined]
[8] cp(src::String, dst::String; force::Bool, follow_symlinks::Bool)
@ Base.Filesystem ./file.jl:382
[9] cp
@ ./file.jl:376 [inlined]
[10] bundle_julia_libraries(dest_dir::String)
@ PackageCompiler ~/.julia/packages/PackageCompiler/b2smD/src/PackageCompiler.jl:1118
[11] create_library(package_dir::String, dest_dir::String; lib_name::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, force::Bool, header_files::Vector{String}, julia_init_c_file::String, version::Nothing, compat_level::String, cpu_target::String, include_lazy_artifacts::Bool, sysimage_build_args::Cmd, include_transitive_dependencies::Bool, script::Nothing)
@ PackageCompiler ~/.julia/packages/PackageCompiler/b2smD/src/PackageCompiler.jl:980
[12] top-level scope
The program is trying to run /usr/lib/dbus-1.0/dbus-daemon-launch-helper
that is not executable by a normal user
ls -l /usr/lib/dbus-1.0/dbus-daemon-launch-helper
-rwsr-x--- 1 root dbus 30680 Sep 2 15:42 /usr/lib/dbus-1.0/dbus-daemon-launch-helper*
So I tried again for test with sudo -g dbus make
I get a new error
ERROR: LoadError: IOError: open("/usr/lib/ssh/ssh-keysign", 0, 0): permission denied (EACCES)
My user can run this file in theory
ls -l "/usr/lib/ssh/ssh-keysign"
-rws--x--x 1 root root 334072 Sep 9 10:08 /usr/lib/ssh/ssh-keysign
/usr/lib/ssh/ssh-keysign
ssh-keysign not enabled in /etc/ssh/ssh_config
Definitely as root the make
command works but not as user.
How did you install Julia?
I'm using the package Julia-bin from AUR https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=julia-bin That should download the official release
@andrea993 , I think the problem is in the file examples/MyLib/build/Manifest.toml
, in this section:
[[PackageCompiler]]
deps = ["Artifacts", "Glob", "LazyArtifacts", "Libdl", "Pkg", "Printf", "RelocatableFolders", "TOML", "UUIDs"]
path = "../../.."
uuid = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
version = "2.1.7"
I got this problem too. If you copy the examples/MyLib
outside the PackageCompiler repo, this relative path ../../..
breaks. So I deleted this line and then it worked.
Begin edit
I forgot to say that after deleting the line, I started the Julia REPL and reinstalled the PackageCompiler:
julia> ]
(@v1.10) pkg> activate build/
Activating project at `~/Sources/MyLib/build`
(build) pkg> st
Status `~/Sources/MyLib/build/Project.toml`
ERROR: Could not locate the source code for the PackageCompiler package. Are you trying to use a manifest generated by a different version of Julia?
(build) pkg> remove PackageCompiler
[...]
(build) pkg> add PackageCompiler
[...]
And then it worked.
End edit
However, I ended with another problem:
gcc my_application.c -o my_application.out -I"MyLibCompiled"/include -L"MyLibCompiled"/lib -ljulia -lmylib
/usr/bin/ld: /tmp/cc0RSZVq.o: in function `main':
my_application.c:(.text+0x26): undefined reference to `increment32'
collect2: error: ld returned 1 exit status
make: *** [Makefile:20: build-executable] Error 1
When inspecting the generated library, I noticed that increment32
is marked as a LOCAL symbol:
~/S/P/e/MyLib (master)> readelf MyLibCompiled/lib/libmylib.so -s | grep -i increment32
21758: 0000000000167b10 281 FUNC LOCAL DEFAULT 11 increment32
~/S/P/e/MyLib (master)> readelf MyLibCompiled/lib/libmylib.so -s | grep -i _julia
110: 0000000000568390 5 FUNC GLOBAL DEFAULT 11 shutdown_julia
118: 0000000000568330 93 FUNC GLOBAL DEFAULT 11 init_julia
1391: 0000000000320170 70 FUNC LOCAL DEFAULT 11 jfptr_load_julia[...]
5157: 00000000001bc830 576 FUNC LOCAL DEFAULT 11 julia_load_julia[...]
24793: 0000000000568390 5 FUNC GLOBAL DEFAULT 11 shutdown_julia
24878: 0000000000568330 93 FUNC GLOBAL DEFAULT 11 init_julia
Does anyone have an idea on how I can mark the symbol increment32
as global?
Edit 2:
Nevermind. Actually, this symbol problem happens only in Julia 1.10-beta2. It worked in Julia 1.9.3.
I already solved the .toml
error directly deleting the file (as I wrote) but the real problem of this topic is about the error
ERROR: LoadError: IOError: open("/usr/lib/ssh/ssh-keysign", 0, 0): permission denied (EACCES)
I have the same error also if I try to build package written by myself without root
Ok. I was able to reproduce your problem and I think I found the cause:
[10] bundle_julia_libraries(dest_dir::String)
@ PackageCompiler ~/.julia/packages/PackageCompiler/b2smD/src/PackageCompiler.jl:1118
In PackageCompiler.jl:1118
:
cp(julia_libdir(), app_libdir; force=true)
For distribuition packages / system installations like julia-bin
in AUR, the package compiler will try to copy the entire /usr/bin
directory to MyLibCompiled
folder, since julia_libdir()
evaluates to "/usr/lib" (at least on my computer).
julia> isdebugbuild() = ccall(:jl_is_debugbuild, Cint, ()) != 0
isdebugbuild (generic function with 1 method)
julia> using Libdl
julia> function julia_libdir()
libname = isdebugbuild() ? "libjulia-debug" :
"libjulia"
return dirname(abspath(Libdl.dlpath(libname)))
end
julia_libdir (generic function with 1 method)
julia> julia_libdir()
"/usr/lib"
Although it is not the problem cause itself, copying the entire "/usr/lib" directory seems as an undesirable behavior.
Thanks this sound like an issue imho.
In other kinds of installation which is the output of julia_libdir()
?
In any case the aur package is only a script that download Julia from the official release and copy it to the system directories so I think that it's should not be a package problem. You can look at the package source that I linked
Manjaro (julia installed by sudo pacman -S julia
): "/usr/lib"
Juliaup: "/home/me/.julia/juliaup/julia-1.9.3+0.x64.linux.gnu/lib"
Julia docker image (docker run -it julia:1.9 bash
): "/usr/local/julia/lib"
PackageCompiler doesn't need dbus or cups libraries, which read permissions are denied, but it tries to copy the files anyway if they are in same directory as libjulia.so
.
I think this should be fixed now. Would be good if someone can confirm.