Packaging lix for openSUSE: build fails with "cannot find -llix_doc: No such file or directory" #475

Closed
opened 2024-08-18 07:14:32 +00:00 by johanneskastl · 8 comments

I am trying to package lix for openSUSE. I have all of the dependencies and got the build to start (with the workaround from #470).

However, the build fails:

[  250s] [197/485] Linking static target src/liblibasanoptions.a
[  253s] [198/485] Compiling C++ object tests/unit/liblixutil-test-support.so.p/libutil-support_tests_hash.cc.o
[  254s] [199/485] Precompiling header /home/abuild/rpmbuild/BUILD/lix-2.91.0/src/pch/precompiled-headers.hh
[  256s] [200/485] Compiling C++ object tests/unit/liblixutil-test-support.so.p/libutil-support_tests_cli-literate-parser.cc.o
[  256s] [201/485] Precompiling header /home/abuild/rpmbuild/BUILD/lix-2.91.0/src/pch/precompiled-headers.hh
[  256s] [202/485] Compiling C++ object src/libcmd/liblixcmd.so.p/repl.cc.o
[  258s] [203/485] Compiling C++ object src/libcmd/liblixcmd.so.p/installables.cc.o
[  258s] [204/485] Linking target src/libcmd/liblixcmd.so
[  258s] FAILED: src/libcmd/liblixcmd.so 
[  258s] c++  -o src/libcmd/liblixcmd.so src/libcmd/liblixcmd.so.p/built-path.cc.o src/libcmd/liblixcmd.so.p/cmd-profiles.cc.o src/libcmd/liblixcmd.so.p/command.cc.o src/libcmd/liblixcmd.so.p/common-eval-args.cc.o src/libcmd/liblixcmd.so.p/editor-for.cc.o src/libcmd/liblixcmd.so.p/installable-attr-path.cc.o src/libcmd/liblixcmd.so.p/installable-derived-path.cc.o src/libcmd/liblixcmd.so.p/installable-flake.cc.o src/libcmd/liblixcmd.so.p/installable-value.cc.o src/libcmd/liblixcmd.so.p/installables.cc.o src/libcmd/liblixcmd.so.p/legacy.cc.o src/libcmd/liblixcmd.so.p/markdown.cc.o src/libcmd/liblixcmd.so.p/repl.cc.o src/libcmd/liblixcmd.so.p/repl-interacter.cc.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,-soname,liblixcmd.so -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error -pthread -Wl,--no-copy-dt-needed-entries '-Wl,-rpath,$ORIGIN/../libutil:$ORIGIN/../libstore:$ORIGIN/../libexpr:$ORIGIN/../libfetchers:$ORIGIN/../libmain' -Wl,-rpath-link,/home/abuild/rpmbuild/BUILD/lix-2.91.0/build/src/libutil -Wl,-rpath-link,/home/abuild/rpmbuild/BUILD/lix-2.91.0/build/src/libstore -Wl,-rpath-link,/home/abuild/rpmbuild/BUILD/lix-2.91.0/build/src/libexpr -Wl,-rpath-link,/home/abuild/rpmbuild/BUILD/lix-2.91.0/build/src/libfetchers -Wl,-rpath-link,/home/abuild/rpmbuild/BUILD/lix-2.91.0/build/src/libmain -Wl,--start-group src/libutil/liblixutil.so src/libstore/liblixstore.so src/libexpr/liblixexpr.so src/libfetchers/liblixfetchers.so src/libmain/liblixmain.so /usr/lib64/libeditline.so /usr/lib64/liblowdown.so -lm -llix_doc -Wl,--end-group
[  258s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: cannot find -llix_doc: No such file or directory
[  258s] collect2: error: ld returned 1 exit status
[  259s] [205/485] Precompiling header /home/abuild/rpmbuild/BUILD/lix-2.91.0/src/pch/precompiled-headers.hh
[  261s] [206/485] Compiling C++ object src/nix/nix.p/add-to-store.cc.o
[  263s] [207/485] Compiling C++ object src/nix/nix.p/app.cc.o
[  263s] [208/485] Compiling C++ object src/nix/nix.p/bundle.cc.o
[  264s] [209/485] Compiling C++ object src/nix/nix.p/build.cc.o
[  264s] ninja: build stopped: subcommand failed.
[  264s] INFO: autodetecting backend as ninja
[  264s] INFO: calculating backend command to run: /usr/bin/ninja -C /home/abuild/rpmbuild/BUILD/lix-2.91.0/build

The package is here: https://build.opensuse.org/package/show/home:ojkastl_buildservice:Branch_devel_tools/lix

The full buildlog is here: https://build.opensuse.org/package/live_build_log/home:ojkastl_buildservice:Branch_devel_tools/lix/openSUSE_Tumbleweed/x86_64

I tried to translate the just build commands to meson to have one layer of abstraction less. That should not be the problem.

I think I need to set the $mesonFlags to set enable-docs to true, if I understand the part in the packages.nix file correctly.

Line 207 in 278fddc
(lib.mesonBool "enable-docs" canRunInstalled)

Maybe the README could be expanded to contain a safe set of $mesonFlags for builds on non-NixOS machines?

Kind Regards,
Johannes

I am trying to package lix for openSUSE. I have all of the dependencies and got the build to start (with the workaround from #470). However, the build fails: ``` [ 250s] [197/485] Linking static target src/liblibasanoptions.a [ 253s] [198/485] Compiling C++ object tests/unit/liblixutil-test-support.so.p/libutil-support_tests_hash.cc.o [ 254s] [199/485] Precompiling header /home/abuild/rpmbuild/BUILD/lix-2.91.0/src/pch/precompiled-headers.hh [ 256s] [200/485] Compiling C++ object tests/unit/liblixutil-test-support.so.p/libutil-support_tests_cli-literate-parser.cc.o [ 256s] [201/485] Precompiling header /home/abuild/rpmbuild/BUILD/lix-2.91.0/src/pch/precompiled-headers.hh [ 256s] [202/485] Compiling C++ object src/libcmd/liblixcmd.so.p/repl.cc.o [ 258s] [203/485] Compiling C++ object src/libcmd/liblixcmd.so.p/installables.cc.o [ 258s] [204/485] Linking target src/libcmd/liblixcmd.so [ 258s] FAILED: src/libcmd/liblixcmd.so [ 258s] c++ -o src/libcmd/liblixcmd.so src/libcmd/liblixcmd.so.p/built-path.cc.o src/libcmd/liblixcmd.so.p/cmd-profiles.cc.o src/libcmd/liblixcmd.so.p/command.cc.o src/libcmd/liblixcmd.so.p/common-eval-args.cc.o src/libcmd/liblixcmd.so.p/editor-for.cc.o src/libcmd/liblixcmd.so.p/installable-attr-path.cc.o src/libcmd/liblixcmd.so.p/installable-derived-path.cc.o src/libcmd/liblixcmd.so.p/installable-flake.cc.o src/libcmd/liblixcmd.so.p/installable-value.cc.o src/libcmd/liblixcmd.so.p/installables.cc.o src/libcmd/liblixcmd.so.p/legacy.cc.o src/libcmd/liblixcmd.so.p/markdown.cc.o src/libcmd/liblixcmd.so.p/repl.cc.o src/libcmd/liblixcmd.so.p/repl-interacter.cc.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,-soname,liblixcmd.so -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error -pthread -Wl,--no-copy-dt-needed-entries '-Wl,-rpath,$ORIGIN/../libutil:$ORIGIN/../libstore:$ORIGIN/../libexpr:$ORIGIN/../libfetchers:$ORIGIN/../libmain' -Wl,-rpath-link,/home/abuild/rpmbuild/BUILD/lix-2.91.0/build/src/libutil -Wl,-rpath-link,/home/abuild/rpmbuild/BUILD/lix-2.91.0/build/src/libstore -Wl,-rpath-link,/home/abuild/rpmbuild/BUILD/lix-2.91.0/build/src/libexpr -Wl,-rpath-link,/home/abuild/rpmbuild/BUILD/lix-2.91.0/build/src/libfetchers -Wl,-rpath-link,/home/abuild/rpmbuild/BUILD/lix-2.91.0/build/src/libmain -Wl,--start-group src/libutil/liblixutil.so src/libstore/liblixstore.so src/libexpr/liblixexpr.so src/libfetchers/liblixfetchers.so src/libmain/liblixmain.so /usr/lib64/libeditline.so /usr/lib64/liblowdown.so -lm -llix_doc -Wl,--end-group [ 258s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: cannot find -llix_doc: No such file or directory [ 258s] collect2: error: ld returned 1 exit status [ 259s] [205/485] Precompiling header /home/abuild/rpmbuild/BUILD/lix-2.91.0/src/pch/precompiled-headers.hh [ 261s] [206/485] Compiling C++ object src/nix/nix.p/add-to-store.cc.o [ 263s] [207/485] Compiling C++ object src/nix/nix.p/app.cc.o [ 263s] [208/485] Compiling C++ object src/nix/nix.p/bundle.cc.o [ 264s] [209/485] Compiling C++ object src/nix/nix.p/build.cc.o [ 264s] ninja: build stopped: subcommand failed. [ 264s] INFO: autodetecting backend as ninja [ 264s] INFO: calculating backend command to run: /usr/bin/ninja -C /home/abuild/rpmbuild/BUILD/lix-2.91.0/build ``` The package is here: https://build.opensuse.org/package/show/home:ojkastl_buildservice:Branch_devel_tools/lix The full buildlog is here: https://build.opensuse.org/package/live_build_log/home:ojkastl_buildservice:Branch_devel_tools/lix/openSUSE_Tumbleweed/x86_64 I tried to translate the `just` build commands to `meson` to have one layer of abstraction less. That should not be the problem. I think I need to set the `$mesonFlags` to set `enable-docs` to true, if I understand the part in the `packages.nix` file correctly. https://git.lix.systems/lix-project/lix/src/commit/278fddc317cf0cf4d3602d0ec0f24d1dd281fadb/package.nix#L207 Maybe the README could be expanded to contain a safe set of `$mesonFlags` for builds on non-NixOS machines? Kind Regards, Johannes
Owner

this is poor documentation, but what you're actually experiencing here is that we punted on the issue of compiling lix-doc/ with meson for the sake of time. this will be fixed in the in-development 2.92 release by building it with meson instead.

the piece of packaging that you're missing is lix-doc/package.nix, which just builds lix-doc as a rust staticlib. this is then put in the linker search path by nix magic in our case, but you probably have to jam in LDFLAGS in your case.

this is not related to enable-docs, actually. lix-doc is part of nix repl, and it's kind of an evil little trap that we carelessly set to have it not be declared as a meson dependency anywhere so it randomly fails to link if you've not injected it into the link search path.

i would not make it a separate package for opensuse, it is an implementation detail of lix that just is built as a separate package in our case because of technical limitations in nix plus it having been the most expedient thing to do at the time, when we weren't meson-only.

this is poor documentation, but what you're actually experiencing here is that we punted on the issue of compiling lix-doc/ with meson for the sake of time. this will be fixed in the in-development 2.92 release by building it with meson instead. the piece of packaging that you're missing is lix-doc/package.nix, which just builds lix-doc as a rust staticlib. this is then put in the linker search path by nix magic in our case, but you probably have to jam in LDFLAGS in your case. this is not related to enable-docs, actually. lix-doc is part of nix repl, and it's kind of an evil little trap that we carelessly set to have it not be declared as a meson dependency anywhere so it randomly fails to link if you've not injected it into the link search path. i would not make it a separate package for opensuse, it is an implementation detail of lix that just is built as a separate package in our case because of technical limitations in nix plus it having been the most expedient thing to do at the time, when we weren't meson-only.
Owner

the actual thing enable-docs is saying that you're reading is "enable the documentation if the building system can run the host-platform code" i.e. it's not cross compilation. this is because of settings default values/docs and a bunch of other stuff that is extracted from the nix binary and put into the manual. we consider this technical debt that will be eliminated given sufficient time.

the actual thing enable-docs is saying that you're reading is "enable the documentation if the building system can run the host-platform code" i.e. it's not cross compilation. this is because of settings default values/docs and a bunch of other stuff that is extracted from the nix binary and put into the manual. we consider this technical debt that will be eliminated given sufficient time.
Owner

also related: #258

also related: https://git.lix.systems/lix-project/lix/issues/258
Author

Thanks for the fast reply. Is there any flag I can set to skip the lix-doc part when building with meson?

Thanks for the fast reply. Is there any flag I can set to skip the lix-doc part when building with meson?
Author

this is poor documentation, but what you're actually experiencing here is that we punted on the issue of compiling lix-doc/ with meson for the sake of time. this will be fixed in the in-development 2.92 release by building it with meson instead.

the piece of packaging that you're missing is lix-doc/package.nix, which just builds lix-doc as a rust staticlib. this is then put in the linker search path by nix magic in our case, but you probably have to jam in LDFLAGS in your case.

this is not related to enable-docs, actually. lix-doc is part of nix repl, and it's kind of an evil little trap that we carelessly set to have it not be declared as a meson dependency anywhere so it randomly fails to link if you've not injected it into the link search path.

i would not make it a separate package for opensuse, it is an implementation detail of lix that just is built as a separate package in our case because of technical limitations in nix plus it having been the most expedient thing to do at the time, when we weren't meson-only.

Thanks for the detailed explanation. If I understand you correctly I would first compile the nix-docs, before I compile lix. All within the same openSUSE package and from the same git repository?

If this is work in the making, then I will wait for 2.92 to be released and try again then.

Have a nice day!

Johannes

> this is poor documentation, but what you're actually experiencing here is that we punted on the issue of compiling lix-doc/ with meson for the sake of time. this will be fixed in the in-development 2.92 release by building it with meson instead. > > the piece of packaging that you're missing is lix-doc/package.nix, which just builds lix-doc as a rust staticlib. this is then put in the linker search path by nix magic in our case, but you probably have to jam in LDFLAGS in your case. > > this is not related to enable-docs, actually. lix-doc is part of nix repl, and it's kind of an evil little trap that we carelessly set to have it not be declared as a meson dependency anywhere so it randomly fails to link if you've not injected it into the link search path. > > i would not make it a separate package for opensuse, it is an implementation detail of lix that just is built as a separate package in our case because of technical limitations in nix plus it having been the most expedient thing to do at the time, when we weren't meson-only. Thanks for the detailed explanation. If I understand you correctly I would first compile the nix-docs, before I compile lix. All within the same openSUSE package and from the same git repository? If this is work in the making, then I will wait for 2.92 to be released and try again then. Have a nice day! Johannes
Owner

Thanks for the fast reply. Is there any flag I can set to skip the lix-doc part when building with meson?

No. It is a required part of the program that is necessary for proper repl functionality. You have to cargo build it outside of meson, currently, then provide it somewhere in the linking search path so the linking command you saw fail above will work.

> Thanks for the fast reply. Is there any flag I can set to skip the lix-doc part when building with meson? No. It is a required part of the program that is necessary for proper repl functionality. You have to `cargo build` it outside of meson, currently, then provide it somewhere in the linking search path so the linking command you saw fail above will work.
Author

Thanks for the fast reply. Is there any flag I can set to skip the lix-doc part when building with meson?

No. It is a required part of the program that is necessary for proper repl functionality. You have to cargo build it outside of meson, currently, then provide it somewhere in the linking search path so the linking command you saw fail above will work.

OK, I'll try that and report back. Thanks, @jade

> > Thanks for the fast reply. Is there any flag I can set to skip the lix-doc part when building with meson? > > No. It is a required part of the program that is necessary for proper repl functionality. You have to `cargo build` it outside of meson, currently, then provide it somewhere in the linking search path so the linking command you saw fail above will work. OK, I'll try that and report back. Thanks, @jade
Author

Solved by building first and then adding the path to LIBRARY_PATH:

export LIBRARY_PATH=$LIBRARY_PATH:$PWD/lix-doc/target/release/
Solved by building first and then adding the path to `LIBRARY_PATH`: ``` export LIBRARY_PATH=$LIBRARY_PATH:$PWD/lix-doc/target/release/ ```
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#475
No description provided.