Open OPNA2608 opened 5 years ago
Either I can't figure out how to properly install and setup
lazarus
or it's unable to compile even the default project. Here's the compile log:
Hm, now that I look at it, at some point I started just adding a few packages and never got around to writing a proper wrapper.
I think I add the following: xorg.libX11 atk cairo gtk2 glib gdk_pixbuf pango
@OPNA2608 do you want to file a patch for this?
And when you add a wrapper I think that it might be useful to add fpc
to the environment as well so that a user can immediately start hacking Pascal after the installation.
I think this is fixed? There is a different issue right now involving some extraneous linker flags from NIX_LDFLAGS and quoting causing
Build IDE: Exit code 2, Errors: 1
/nix/store/a57856fs4m8ir6vlv14h3gq3sv9aq2lb-binutils-2.31.1/bin/ld: warning: /home/user/.lazarus/bin/link.res contains output sections; did you forget -T?
/nix/store/a57856fs4m8ir6vlv14h3gq3sv9aq2lb-binutils-2.31.1/bin/ld: cannot find '-rpath: No such file or directory
/nix/store/a57856fs4m8ir6vlv14h3gq3sv9aq2lb-binutils-2.31.1/bin/ld: cannot find /nix/store/anvwd9iwqvqj998s01pdv2j7brdwlq9g-lazarus-2.0.8/lib64: No such file or directory
lazarus.pp(165,1) Error: Error while linking
but hopefully we'll be fixing that.
During my triage I was able to recompile Lazarus itself and the example program, so that suggests to me things should work.
@7c6f434c @deliciouslytyped Took me some time to get back to this, sorry.
I can give it a shot on my NixOS machine later today, but I tested the current situation on my non-NixOS one:
"x86_64-linux"
Linux 4.15.0-112-generic, Ubuntu, 18.04.5 LTS (Bionic Beaver)
no
yes
nix-env (Nix) 2.3.5
"nixpkgs-20.09pre242495.3c0e3697520"
/home/bt1cn/.nix-defexpr/channels/nixpkgs
nix-shell -p lazarus -p fpc -p gdb '<nixpkgs>'
startlazarus
Same results with the example "imgviewer" application (share/lazarus/examples/imgviewer
).
Launching via lazarus-ide
indicates that compilation itself succeeded! But running the project with the configured gdb debugger fails.
The GDB command:
"-exec-run"
did not return any result.
Running without the debugger prints this on the terminal.
/home/bt1cn/tmp/project1: error while loading shared libraries: libgdk-x11-2.0.so.0: cannot open shared object file: No such file or directory
[nix-shell:~]$ ldd /home/bt1cn/tmp/project1
linux-vdso.so.1 (0x00007f93cc39a000)
libdl.so.2 => /nix/store/2pi6zgkwnr3zdslvlv16nixpzvbyjx1n-glibc-2.31/lib/libdl.so.2 (0x00007f93cc390000)
libpthread.so.0 => /nix/store/2pi6zgkwnr3zdslvlv16nixpzvbyjx1n-glibc-2.31/lib/libpthread.so.0 (0x00007f93cc36f000)
libgdk-x11-2.0.so.0 => not found
libX11.so.6 => not found
libgdk_pixbuf-2.0.so.0 => not found
libgtk-x11-2.0.so.0 => not found
libgobject-2.0.so.0 => not found
libglib-2.0.so.0 => not found
libgthread-2.0.so.0 => not found
libgmodule-2.0.so.0 => not found
libpango-1.0.so.0 => not found
libcairo.so.2 => not found
libatk-1.0.so.0 => not found
libc.so.6 => /nix/store/2pi6zgkwnr3zdslvlv16nixpzvbyjx1n-glibc-2.31/lib/libc.so.6 (0x00007f93cc1ac000)
/nix/store/2pi6zgkwnr3zdslvlv16nixpzvbyjx1n-glibc-2.31/lib64/ld-linux-x86-64.so.2 (0x00007f93cc39c000)
Adding xorg.libX11 gtk2.out cairo glib atk pango gdk_pixbuf
to my shell, setting LD_LIBRARY_PATH
accordingly after exiting lazarus and running the compiled binary does result in successful execution though.
Setting the LD_LIBRARY_PATH
before opening Lazarus, whether via startlazarus
or lazarus-ide
, results in the compilation failure from earlier.
From a single quick read-through, I'm not sure whats going on, but I think the RPATH might not be set correctly. Though if it is a matter of rpath, since the binary isn't a GC root specifying its deps, fixing the rpath will mean things will break again once something gets garbage collected (but I guess that's normal?).
I might be on a completely wrong track here though.
Edit: are you saying lazarus isnt propagating the LD_LIBRARY_PATH to binaries executed from it?
Retried this on my NixOS system.
"x86_64-linux"
Linux 4.14.195, NixOS, 20.03.2855.31827921288 (Markhor)
yes
yes
nix-env (Nix) 2.3.6
"nixos-20.03.2855.31827921288"
"unstable-20.09pre239318.c59ea8b8a0e, stable-19.09.1686.69ed29f5f41"
/nix/var/nix/profiles/per-user/root/channels/nixos
nix-shell -p lazarus -p fpc -p gdb '<unstable>'
This unfortunately still gives me the error from the initial comment.
I'm unsure what's going on here, unless I'm missing something? My unstable
channel's HEAD commit is dated 20. August and should already contain #88839.
Can you confirm that the lazarus you are running is indeed the correct version? (Check the wrapper script?) Maybe try with --pure.
Can't compare with the version on my machine at work but this is what i have/did. I believe I did nothing wrong there?
nix-env -e lazarus fpc gdb
nix-collect-garbage -d
nix-channel --update unstable # https://nixos.org/channels/nixos-unstable
rm -rf ~/.lazarus
nix-shell '<unstable>' -p lazarus fpc gdb which --pure
[nix-shell:~]$ realpath "$(which startlazarus)"
/nix/store/nr1wrkl9mh329w4hbi2ajmqfl09jxllp-lazarus-1.8.4/bin/startlazarus
[nix-shell:~]$ cat "$(realpath "$(which startlazarus)")"
#! /nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash -e
export NIX_LDFLAGS=''\''-rpath /nix/store/nr1wrkl9mh329w4hbi2ajmqfl09jxllp-lazarus-1.8.4/lib64 -rpath /nix/store/nr1wrkl9mh329w4hbi2ajmqfl09jxllp-lazarus-1.8.4/lib -L/nix/store/msp4hm62a75pdidlc3s2ymma2g5hsjjk-zlib-1.2.11/lib -L/nix/store/j2fdy70n25zaws892dc95yhj0gfhdxg6-libffi-3.3/lib -L/nix/store/kpmbp2nlwzf6cdgq37phlf5kfdz8dbsv-gettext-0.20.1/lib -L/nix/store/6j9v0jcx2pdins58ask9drg66g3ih0dm-glib-2.62.6/lib -L/nix/store/ipcp5xyxmmzdz5z7q3x574si2j7j7py2-bzip2-1.0.6.0.1/lib -L/nix/store/i3h1q2qpawskwiq4slr6fcs682qilnx6-libpng-apng-1.6.37/lib -L/nix/store/02rs7pbcc06pxzf0fn8d1va871p11pkp-freetype-2.10.1/lib -L/nix/store/71v85g151amsy5n8lyd6ifz3vc58cw42-fontconfig-2.12.6-lib/lib -L/nix/store/5plfk3s66fmfwg1nz0f9n4qkai3fvjj9-expat-2.2.8/lib -L/nix/store/kj93f118rkph69jnq0f7p37a2kvm1lnb-pixman-0.38.4/lib -L/nix/store/zymrgrmjlng0k4i3iimfsf7ff0v9031n-libXau-1.0.9/lib -L/nix/store/6vq8wp4576hbdfgb44zvmmrykr0w2frl-libXext-1.3.4/lib -L/nix/store/6wffq43p7ygy6rpdcn4hj5mm33077d3n-libxcb-1.13.1/lib -L/nix/store/7563czahvq56fq3a486w2x2vr9r63j1g-libX11-1.6.8/lib -L/nix/store/ivswcs2vby9qwjkqakmvgc5d7xvwzvsk-libXrender-0.9.10/lib -L/nix/store/w7b15ysa0wj5bdz603j0wpswi95vv5np-xcb-util-0.4.0/lib -L/nix/store/r5qgnl2c62lqfdcl5k7h800id09gbx1s-libGL-1.2.0/lib -L/nix/store/hrx2rjnlg54aq2qmkxli5vhpx7hv84ln-libglvnd-1.2.0/lib -L/nix/store/mxbnwpvybajzmb8gfnwgx1l2whi1zs8q-cairo-1.16.0/lib -L/nix/store/00k421jja9ydjqmv8kxd4i2gz8kqkmzp-graphite2-1.3.13/lib -L/nix/store/klm9hqw401x1rhhlfgkmjfaglwxmm784-harfbuzz-2.6.4/lib -L/nix/store/n2baq012wy4wz2wgp9zh5mbfs188cisd-libXft-2.3.3/lib -L/nix/store/flvlzs0z0fnc1zsnr9241biz7xwlmpc4-pango-1.44.7/lib -L/nix/store/qqlqsvnv9wgy27kn3rml3kmwcx5276fa-libjpeg-turbo-2.0.3/lib -L/nix/store/jj7dqm9m5cav4gqmwqpkf1z66g0ipwv6-xz-5.2.4/lib -L/nix/store/29blaaqpggzx0ypka5w0vg5yp7gmdyb5-libtiff-4.1.0/lib -L/nix/store/zc66pg8gzxx7i5s7jc4cr3nkyx8vsnk2-gdk-pixbuf-2.40.0/lib -L/nix/store/z3pjmsmk60wg3bklnndra12g7lgq3fik-atk-2.34.1/lib -L/nix/store/dblfpplb691ak9cx2nckzl8w2yncw5n7-libXrandr-1.5.2/lib -L/nix/store/s1rmmz59zfw5ag5pxphp9bvw2l7nmr84-libXfixes-5.0.3/lib -L/nix/store/vj2nf90f8fpazr28dcvja0bdqgfrmdjk-libXcomposite-0.4.5/lib -L/nix/store/5zdq8wgpmbh3ykqg2d7iyizw0s3xvn9y-libXi-1.7.10/lib -L/nix/store/l1q8vn3dsb3v6hqchdsnb90j7bhi8c3n-libXcursor-1.2.0/lib -L/nix/store/4hy92mxpkqcjpwjlfvd69cgvpgy2klim-libXinerama-1.1.4/lib -L/nix/store/447im4mh8gmw85dkrvz3facg1jsbn6c7-gmp-6.2.0/lib -L/nix/store/0rxcijs07fy1vbnq3axysc1ygvha6rh8-cups-2.3.3-lib/lib -L/nix/store/1p3invbqmnhs6078w4jrl9fi4wwzl7lm-gtk+-2.24.32/lib -L/nix/store/msp4hm62a75pdidlc3s2ymma2g5hsjjk-zlib-1.2.11/lib -L/nix/store/j2fdy70n25zaws892dc95yhj0gfhdxg6-libffi-3.3/lib -L/nix/store/kpmbp2nlwzf6cdgq37phlf5kfdz8dbsv-gettext-0.20.1/lib -L/nix/store/6j9v0jcx2pdins58ask9drg66g3ih0dm-glib-2.62.6/lib -L/nix/store/ipcp5xyxmmzdz5z7q3x574si2j7j7py2-bzip2-1.0.6.0.1/lib -L/nix/store/i3h1q2qpawskwiq4slr6fcs682qilnx6-libpng-apng-1.6.37/lib -L/nix/store/02rs7pbcc06pxzf0fn8d1va871p11pkp-freetype-2.10.1/lib -L/nix/store/71v85g151amsy5n8lyd6ifz3vc58cw42-fontconfig-2.12.6-lib/lib -L/nix/store/5plfk3s66fmfwg1nz0f9n4qkai3fvjj9-expat-2.2.8/lib -L/nix/store/kj93f118rkph69jnq0f7p37a2kvm1lnb-pixman-0.38.4/lib -L/nix/store/zymrgrmjlng0k4i3iimfsf7ff0v9031n-libXau-1.0.9/lib -L/nix/store/6vq8wp4576hbdfgb44zvmmrykr0w2frl-libXext-1.3.4/lib -L/nix/store/6wffq43p7ygy6rpdcn4hj5mm33077d3n-libxcb-1.13.1/lib -L/nix/store/7563czahvq56fq3a486w2x2vr9r63j1g-libX11-1.6.8/lib -L/nix/store/ivswcs2vby9qwjkqakmvgc5d7xvwzvsk-libXrender-0.9.10/lib -L/nix/store/w7b15ysa0wj5bdz603j0wpswi95vv5np-xcb-util-0.4.0/lib -L/nix/store/r5qgnl2c62lqfdcl5k7h800id09gbx1s-libGL-1.2.0/lib -L/nix/store/hrx2rjnlg54aq2qmkxli5vhpx7hv84ln-libglvnd-1.2.0/lib -L/nix/store/mxbnwpvybajzmb8gfnwgx1l2whi1zs8q-cairo-1.16.0/lib -L/nix/store/00k421jja9ydjqmv8kxd4i2gz8kqkmzp-graphite2-1.3.13/lib -L/nix/store/klm9hqw401x1rhhlfgkmjfaglwxmm784-harfbuzz-2.6.4/lib -L/nix/store/n2baq012wy4wz2wgp9zh5mbfs188cisd-libXft-2.3.3/lib -L/nix/store/flvlzs0z0fnc1zsnr9241biz7xwlmpc4-pango-1.44.7/lib -L/nix/store/qqlqsvnv9wgy27kn3rml3kmwcx5276fa-libjpeg-turbo-2.0.3/lib -L/nix/store/jj7dqm9m5cav4gqmwqpkf1z66g0ipwv6-xz-5.2.4/lib -L/nix/store/29blaaqpggzx0ypka5w0vg5yp7gmdyb5-libtiff-4.1.0/lib -L/nix/store/zc66pg8gzxx7i5s7jc4cr3nkyx8vsnk2-gdk-pixbuf-2.40.0/lib -L/nix/store/z3pjmsmk60wg3bklnndra12g7lgq3fik-atk-2.34.1/lib -L/nix/store/dblfpplb691ak9cx2nckzl8w2yncw5n7-libXrandr-1.5.2/lib -L/nix/store/s1rmmz59zfw5ag5pxphp9bvw2l7nmr84-libXfixes-5.0.3/lib -L/nix/store/vj2nf90f8fpazr28dcvja0bdqgfrmdjk-libXcomposite-0.4.5/lib -L/nix/store/5zdq8wgpmbh3ykqg2d7iyizw0s3xvn9y-libXi-1.7.10/lib -L/nix/store/l1q8vn3dsb3v6hqchdsnb90j7bhi8c3n-libXcursor-1.2.0/lib -L/nix/store/4hy92mxpkqcjpwjlfvd69cgvpgy2klim-libXinerama-1.1.4/lib -L/nix/store/447im4mh8gmw85dkrvz3facg1jsbn6c7-gmp-6.2.0/lib -L/nix/store/0rxcijs07fy1vbnq3axysc1ygvha6rh8-cups-2.3.3-lib/lib -L/nix/store/1p3invbqmnhs6078w4jrl9fi4wwzl7lm-gtk+-2.24.32/lib -L/nix/store/danv012gh0aakh8xnk2b35vahklz72mk-gcc-9.2.0-lib/lib -lXi -lX11 -lglib-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -lc -lXext -lpango-1.0 -latk-1.0 -lgdk_pixbuf-2.0 -lcairo -lgcc_s'\'''${NIX_LDFLAGS:+' '}$NIX_LDFLAGS
export LCL_PLATFORM=''\''gtk2'\'''${LCL_PLATFORM:+' '}$LCL_PLATFORM
exec -a "$0" "/nix/store/nr1wrkl9mh329w4hbi2ajmqfl09jxllp-lazarus-1.8.4/bin/.startlazarus-wrapped" "$@"
[nix-shell:~]$ startlazarus
# Confirm all the setup stuff
# Try building the default project
I marked this as stale due to inactivity. → More info
Issue description
Either I can't figure out how to properly install and setup
lazarus
or it's unable to compile even the default project. Here's the compile log:Steps to reproduce
nix-shell -p lazarus -p fpc -p gdb '<nixpkgs>'
startlazarus
Technical details
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the results."x86_64-linux"
Linux 4.18.14, NixOS, 18.09.git.c06f530 (Jellyfish)
yes
yes
nix-env (Nix) 2.1.1
""
"nixos-18.09.892.c06f5302f63"
/nix/var/nix/profiles/per-user/root/channels/nixos