Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 908591 - media-gfx/openscad-9999: error while loading shared libraries: libmanifold.so: cannot open shared object file: No such file or directory; One or more CMake variables were not used by the project: ENABLE_MANIFOLD
Summary: media-gfx/openscad-9999: error while loading shared libraries: libmanifold.so...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Paul Zander
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-16 08:20 UTC by Michael Moon
Modified: 2024-04-19 19:29 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Moon 2023-06-16 08:20:56 UTC
Just started seeing this after updating openscad on June 6th.

A warning that may be relevant is "One or more CMake variables were not used by the project: ENABLE_MANIFOLD"

Portage also says "QA Notice: Unresolved soname dependencies: libmanifold.so", but this message is pretty easy to lose in the shuffle.

Seems like openscad now ignores -DENABLE_MANIFOLD=OFF from the ebuild and force-enables the feature, but the libraries for manifold don't get installed:

# equery f openscad | grep -i manifold
«no output, retcode=1»
# ebuild `equery w openscad` install
«few minutes of compiling, everything seems happy»
# find /var/tmp/portage/media-gfx/openscad-9999/image -name libmanifold.so
«no output»
# find /var/tmp/portage/media-gfx/openscad-9999/work -name 'libmanifold.so'
/var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999_build/submodules/manifold/src/manifold/libmanifold.so
# cp /var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999_build/submodules/manifold/src/manifold/libmanifold.so /usr/lib64/
$ openscad
openscad: error while loading shared libraries: libClipper2.so.1: cannot open shared object file: No such file or directory
# find /var/tmp/portage/media-gfx/openscad-9999/image/ -name libClipper2.so.1
«no output»
# find /var/tmp/portage/media-gfx/openscad-9999/work -iname libClipper2.so.1
/var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999_build/submodules/manifold/src/third_party/clipper2/CPP/libClipper2.so.1
# cp /var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999_build/submodules/manifold/src/third_party/clipper2/CPP/libClipper2.so.1 /usr/lib64/
$ openscad
«opens and seems to work»

If the root cause of these libraries not being installed is upstream's cmake script (which it seems to be since openscad.ebuild:src_install invokes cmake_src_install) let me know and I can report it to them.

Fwiw no-one else has reported this issue there (or anywhere else) as far as I can tell, so at the moment it looks like it could be Gentoo-specific despite src_install just invoking cmake_src_install
Comment 1 Michael Moon 2023-06-16 08:26:25 UTC
The ebuild mentions debundling and dev-libs/clipper exists, however

# /var/db/repos/gentoo/profiles/package.mask:
# Michał Górny <mgorny@gentoo.org> (2023-05-05)
# The Gentoo packages are severely out of date, and they haven't been
# ported to Python 3.11.  They are hard to keep working, and there
# are better alternatives available.  The suggested replacements are:
# media-gfx/prusaslicer, media-gfx/superslicer and orcaslicer
# (not packaged).
# Removal on 2023-08-04.  Bug #905769.
=dev-libs/clipper-6.4.2
Comment 2 Michael Moon 2023-07-03 05:52:43 UTC
https://github.com/openscad/openscad/pull/4533 being merged seems relevant, and from some of the comments in there (eg https://github.com/openscad/openscad/pull/4533#issuecomment-1478572931 ) we may want to add a 'cuda' USE flag to openscad as well
Comment 3 Michael Moon 2023-09-04 13:04:26 UTC
Hi, openscad team just reported mainline inclusion of manifold at https://redd.it/169qukg so this issue may hit non-9999 ebuilds soon
Comment 4 Michael Moon 2023-09-05 05:27:53 UTC
This can be worked around by:

--- a/openscad-9999.ebuild        2023-05-08 16:32:32.676462773 +0800
+++ b/openscad-9999.ebuild        2023-09-05 13:14:35.327894329 +0800
@@ -88,7 +88,6 @@
                -DENABLE_EGL=$(usex egl)
                -DENABLE_HIDAPI=$(usex hidapi)
                # needs python deps, unbundle first before enabling
-               -DENABLE_MANIFOLD=OFF
                -DENABLE_SPNAV=$(usex spacenav)
                -DENABLE_TESTS=OFF
                -DEXPERIMENTAL=$(usex experimental)
@@ -114,6 +114,8 @@

        mv -i "${ED}"/usr/share/openscad/locale "${ED}"/usr/share || die "failed to move locales"
        dosym -r /usr/share/locale /usr/share/openscad/locale
+       dolib.so ${S}_build/submodules/manifold/src/manifold/libmanifold.so
+       dolib.so ${S}_build/submodules/manifold/src/third_party/clipper2/CPP/libClipper2.so*
 }

 pkg_postinst() {

although it feels a bit grubby to use ${S}_build, and emerge throws QA warnings:

 * QA Notice: The following files contain insecure RUNPATHs
 *  Please file a bug about this at https://bugs.gentoo.org/
 *  with the maintainer of the package.
 *   /var/tmp/portage/media-gfx/openscad-9999/image/usr/lib64/libmanifold.son    RPATH: /var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999_build/submodules/manifold/src/third_party/clipper2/CPP

which I'm not entirely sure how to fix

https://forums.gentoo.org/viewtopic-t-1110728-start-0.html may be relevant, it discusses cmake patches to install things to image/ properly rather than snatching them from the build dir
Comment 5 Michael Moon 2023-12-28 20:29:50 UTC
Hi, just ran into a new missing library;

/usr/bin/openscad: error while loading shared libraries: libcross_section.so: cannot open shared object file: No such file or directory

and it hides a few others

I did:

# ebuild `equery w openscad` install
…
scanelf: rpath_security_checks(): Security problem NULL DT_RUNPATH in /var/tmp/portage/media-gfx/openscad-9999/image/usr/lib64/libmanifold.so                                                                                                                Auto fixing rpaths for /var/tmp/portage/media-gfx/openscad-9999/image/usr/lib64/libmanifold.so                                                                                                                                                                                                                                                                                                                                                                                                                             * QA Notice: The following files contain insecure RUNPATHs                                                                                                                                                                                                   *  Please file a bug about this at https://bugs.gentoo.org/                                                                                                                                                                                                  *  with the maintainer of the package.                                                                                                                                                                                                                       *   /var/tmp/portage/media-gfx/openscad-9999/image/usr/lib64/libmanifold.son    RPATH: /var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999_build/submodules/manifold/src/cross_section:/var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999_build/submodules/manifold/src/collider:/var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999_build/submodules/manifold/src/polygon:/var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999_build/submodules/manifold/src/third_party/clipper2/CPP:/var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999_build/submodules/manifold/src/third_party:                                                                                                                                                          *                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        strip: x86_64-pc-linux-gnu-strip --strip-unneeded -N __gentoo_check_ldflags__ -R .comment -R .GCC.command.line -R .note.gnu.gold-version                                                                                                                        /usr/lib64/libClipper2.so.1.2.2                                                                                                                                                                                                                              /usr/lib64/libmanifold.so                                                                                                                                                                                                                                    /usr/bin/openscad                                                                                                                                                                                                                                          * QA Notice: Unresolved soname dependencies:                                                                                                                                                                                                                 *                                                                                                                                                                                                                                                            *      /usr/lib64/libmanifold.so: libcollider.so libcross_section.so libpolygon.so libquickhull.so                                                                                                                                                           *                                                                                                                                                                                                                                                           

# cd /var/tmp/portage/media-gfx/openscad-9999/
# LD_LIBRARY_PATH=./image/usr/lib64 ./image/usr/bin/openscad
./image/usr/bin/openscad: error while loading shared libraries: libcross_section.so: cannot open shared object file: No such file or directory
# cp ./work/openscad-9999_build/submodules/manifold/src/cross_section/libcross_section.so image/usr/lib64/
# cp ./work/openscad-9999_build/submodules/manifold/src/collider/libcollider.so image/usr/lib64/
# cp ./work/openscad-9999_build/submodules/manifold/src/polygon/libpolygon.so image/usr/lib64/
# cp ./work/openscad-9999_build/submodules/manifold/src/third_party/libquickhull.so image/usr/lib64/
# LD_LIBRARY_PATH=./image/usr/lib64 ./image/usr/bin/openscad
qt.qpa.xcb: could not connect to display

looks good, now

# cd; ebuild `equery w openscad` merge

and it works,

So we need to patch:

# diff -u /var/db/repos/gentoo/media-gfx/openscad/openscad-9999.ebuild /usr/local/portage/media-gfx/openscad/openscad-9999.ebuild
--- /var/db/repos/gentoo/media-gfx/openscad/openscad-9999.ebuild        2023-05-08 16:32:32.676462773 +0800
+++ /usr/local/portage/media-gfx/openscad/openscad-9999.ebuild  2023-12-29 04:20:10.347873484 +0800
@@ -87,8 +87,6 @@
                -DENABLE_CAIRO=$(usex cairo)
                -DENABLE_EGL=$(usex egl)
                -DENABLE_HIDAPI=$(usex hidapi)
-               # needs python deps, unbundle first before enabling
-               -DENABLE_MANIFOLD=OFF
                -DENABLE_SPNAV=$(usex spacenav)
                -DENABLE_TESTS=OFF
                -DEXPERIMENTAL=$(usex experimental)
@@ -114,6 +112,12 @@

        mv -i "${ED}"/usr/share/openscad/locale "${ED}"/usr/share || die "failed to move locales"
        dosym -r /usr/share/locale /usr/share/openscad/locale
+       dolib.so ${S}_build/submodules/manifold/src/manifold/libmanifold.so
+       dolib.so ${S}_build/submodules/manifold/src/cross_section/libcross_section.so
+       dolib.so ${S}_build/submodules/manifold/src/collider/libcollider.so
+       dolib.so ${S}_build/submodules/manifold/src/polygon/libpolygon.so
+       dolib.so ${S}_build/submodules/manifold/src/third_party/clipper2/CPP/libClipper2.so*
+       dolib.so ${S}_build/submodules/manifold/src/third_party/libquickhull.so
 }

 pkg_postinst() {

(which I also tested and is working)

Unless one of y'all know how to convince openscad's cmake/ninja script to actually install these libraries by itself?
Seems like a massive kludge to call them out explicitly in the ebuild…
Comment 6 Chris Mayo 2024-01-10 20:04:43 UTC
If the live ebuild works for you as you have modified it then I would stick with it as is. The ultimate would probably be as the ebuild suggests to package manifold and clipper2. I have got a version of that now but it is not currently good enough for the tree and uses several patches as well making it too much to post. I will see what I can get upstream.

I don't really know about RPATH but there are some CMake variables that might work;

CMAKE_SKIP_INSTALL_RPATH
https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_INSTALL_RPATH.html#variable:CMAKE_SKIP_INSTALL_RPATH

CMAKE_SKIP_BUILD_RPATH
https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_BUILD_RPATH.html#variable:CMAKE_SKIP_BUILD_RPATH
Comment 7 Michael Moon 2024-01-11 04:43:49 UTC
I think the RPATH thing is because cmake isn't actually installing these libraries during install phase, so I've ignored the RPATH warnings.

However I don't know enough about cmake to discern why it's not installing them, or how to tell the ebuild to ask it to install them - https://github.com/openscad/openscad/blob/master/CMakeLists.txt#L876-L890 is sausage to me
Comment 8 Michael Moon 2024-03-12 08:45:39 UTC
Since manifold has stopped bundling Clipper2 ( https://github.com/elalish/manifold/commit/e27c9c100f1baa4aa32111dd361e49b8a32b6b3e ), openscad-9999 now requires Clipper2 to be provided externally.

Luckily, Clipper2 is pretty simple to package:

media-libs/libclipper2/libclipper2-1.3.0.ebuild:
	EAPI=8

	inherit cmake

	DESCRIPTION="A Polygon Clipping and Offsetting library"
	HOMEPAGE="https://www.angusj.com/clipper2/"
	SRC_URI="https://github.com/AngusJohnson/Clipper2/archive/refs/tags/Clipper2_${PV}.tar.gz -> ${P}.tar.gz"

	LICENSE="Boost-1.0"
	SLOT="0"
	KEYWORDS=""
	IUSE=""
	RESTRICT="test"

	S="${WORKDIR}/Clipper2-Clipper2_${PV}/CPP"

	src_configure() {
		local mycmakeargs=(
			-DBUILD_SHARED_LIBS=ON
			-DCLIPPER2_EXAMPLES=OFF
			-DCLIPPER2_TESTS=OFF
			-DCLIPPER2_UTILS=OFF
		)

		cmake_src_configure
	}

and then some of the stray .so files from before seem to have been absorbed into manifold or something;

--- /var/db/repos/gentoo/media-gfx/openscad/openscad-9999.ebuild        2024-01-09 12:39:50.593007297 +0800
+++ /usr/local/portage/media-gfx/openscad/openscad-9999.ebuild  2024-03-12 15:57:37.520445326 +0800
@@ -61,6 +61,7 @@
        hidapi? ( dev-libs/hidapi )
        mimalloc? ( dev-libs/mimalloc:= )
        spacenav? ( dev-libs/libspnav )
+       media-libs/libclipper2
 "
 DEPEND="${RDEPEND}"
 BDEPEND="
@@ -87,8 +88,6 @@
                -DENABLE_CAIRO=$(usex cairo)
                -DENABLE_EGL=$(usex egl)
                -DENABLE_HIDAPI=$(usex hidapi)
-               # needs python deps, unbundle first before enabling
-               -DENABLE_MANIFOLD=OFF
                -DENABLE_SPNAV=$(usex spacenav)
                -DENABLE_TESTS=OFF
                -DEXPERIMENTAL=$(usex experimental)
@@ -114,6 +113,11 @@

        mv -i "${ED}"/usr/share/openscad/locale "${ED}"/usr/share || die "failed to move locales"
        dosym -r /usr/share/locale /usr/share/openscad/locale
+       dolib.so ${S}_build/submodules/manifold/src/manifold/libmanifold.so*
 }

 pkg_postinst() {



And it seems to work :D

Of course it would be better if we can convince cmake_src_install to strip and copy libmanifold for us, but I still have no clue how to achieve that
Comment 9 Stephen Cavilia 2024-03-25 21:40:48 UTC
Maybe not related to this bug per se, but upstream source doesn't appear to be in the best shape to work with this ebuild. The last commit I could build with the in-tree -9999 was 5cfd4db.

For one thing, -DEXPERIMENTAL=ON seems to be mandatory (ENABLE_MANIFOLD only works with experimental, but some bits are hard-coded to always include manifold: Geometry.h:73:24: error: no matching function for call to ‘GeometryVisitor::visit(const ManifoldGeometry&))

Building the sources by hand with experimental enabled works, but trying USE=experimental fails due to the thrust library not being found, which it tries to download but this silently fails (no errors or sandbox violations so I don't know what's going on)
Comment 10 Michael Moon 2024-03-25 21:44:35 UTC
I'm building it with USE="experimental" and with the tweaks I've posted here it works fine.

If it's a required flag now, I guess we should remove the use flag from the ebuild.

Never seen anything about a thrust library, are you building with USE="gamepad spacenav" perhaps? I haven't tried those.
Comment 11 Stephen Cavilia 2024-03-26 02:17:18 UTC
I don't have gamepad or spacenav enabled.

This is the first error:

FAILED: submodules/manifold/src/manifold/CMakeFiles/manifold.dir/src/edge_op.cpp.o
In file included from /var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999/submodules/manifold/src/utilities/include/sparse.h:19,
                 from /var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999/submodules/manifold/src/collider/include/collider.h:17,
                 from /var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999/submodules/manifold/src/manifold/src/impl.h:18,
                 from /var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999/submodules/manifold/src/manifold/src/edge_op.cpp:15:
/var/tmp/portage/media-gfx/openscad-9999/work/openscad-9999/submodules/manifold/src/utilities/include/par.h:16:10: fatal error: thrust/binary_search.h: No such file or directory
   16 | #include <thrust/binary_search.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
Comment 12 Michael Moon 2024-03-26 02:33:39 UTC
Hmm I guess it's force-enabling CUDA and you don't have dev-util/nvidia-cuda-toolkit then?

$ equery b thrust/binary_search.h
dev-util/nvidia-cuda-toolkit-12.3.2 (/opt/cuda/targets/x86_64-linux/include/thrust/binary_search.h)

That should probably be a USE flag → cmake var as well if it can even build without cuda…
Comment 13 Stephen Cavilia 2024-03-26 13:04:43 UTC
I don't have CUDA installed so that's probably why mine is failing but yours isn't.

It looks like the thrust library is thankfully neither proprietary like CUDA nor dependent on nvidia hardware, but I'm not sure why downloading it during the build process isn't working (sandbox would likely break it anyway, just like that tool everyone uses for Java now that makes ebuilds basically impossible, but nothing in cmake is reporting a failure), or why they didn't include it as a submodule. Maybe it's possible to package thrust separately though.
Comment 14 Chris Mayo 2024-03-26 19:39:57 UTC
I've posted the ebuilds I have been using:
https://github.com/gentoo/gentoo/pull/35936

I do snapshots rather than live ebuilds, and have unbundled everything, but there might be something of use.

It includes cccl which provides the thrust headers for those of us without Nvidia hardware.
Comment 15 Chris Mayo 2024-03-27 20:06:40 UTC
There are some comments on PR 35936 - and interest in the live ebuild.

Does someone want to create a PR with the live ebuild and try and get it updated? It is close to impossible to review in Bugzilla.
Comment 16 cJ 2024-04-19 19:29:02 UTC
The live ebuilds should use +experimental (see https://github.com/openscad/openscad/issues/5093), upstream is in transition period and non-experimental is not supported right now.