Compilation trouble on Arch Linux - likely qhull to blame

33 views
Skip to first unread message

Mark Turiansky

unread,
Sep 14, 2019, 1:00:45 AM9/14/19
to fresnel-users
Hello,

I'm trying to compile fresnel on an Arch Linux system. I have the required dependencies installed, but the compilation fails with the following message:

/usr/bin/ld: /usr/lib/libqhullcpp.a(Qhull.cpp.o): relocation R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [fresnel/CMakeFiles/_common.dir/build.make:101: fresnel/_common.cpython-37m-x86_64-linux-gnu.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:119: fresnel/CMakeFiles/_common.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[100%] Built target _cpu
make: *** [Makefile:130: all] Error 2

It seems that linking against the qhull library is failing. I think the trouble is that the qhull library is a static library (libqhullcpp.a) while it is compiling the dynamic library (fresnel/_common.cpython-37m-x86_64-linux-gnu.so). I don't see a dynamic version of libqhullcpp in my /usr/lib.

I'm not sure if this is an error with my system configuration or potentially the cmake files for fresnel.

I tried adding "set(CMAKE_POSITION_INDEPENDENT_CODE ON)" in a few CMake files, but it didn't help. I'm not so familiar with CMake unfortunately.

Thanks for any advice/help.

Best,
Mark

Mark Turiansky

unread,
Sep 15, 2019, 9:10:35 PM9/15/19
to fresnel-users
Just to follow up: I see from your Dockerfile that you compile qhull manually and specify "-fPIC". You mention in the installation directions that the developers have had success on arch linux: did you have to install qhull manually there too or was the one provided by the arch linux repositories sufficient (my guess is it's not)?

Thanks,
Mark

Joshua A. Anderson

unread,
Sep 16, 2019, 1:34:40 PM9/16/19
to fresne...@googlegroups.com
Mark,

Thanks for reporting this. fresnel 0.10.x built correctly with qhull
2015.2 on arch. The version bump to 2019.1 removed the -fPIC:
https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/qhull&id=8e9850ad8332d316c7f705e392e1db6ccd6dea2c

There are several possible solutions:
1) Submit a bug to arch linux and request that they built qhull with
-fPIC so that libqhullcpp.a is is usable.

2) Submit a bug/PR to qhull so that it adds -fPIC to the libqhullcpp.a
library build.

3) Partially revert the changes in fresnel 0.10 and bundle libqhullcpp
directly in fresnel.

4) Or modify ConvexPolyhedronBuilder.cc to use only the qhull C API so
that libqhullcpp.a is not needed.

Any thoughts from the user community?
---
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
http://www-personal.umich.edu/~joaander/

On 9/15/19 9:10 PM, Mark Turiansky wrote:
> Just to follow up: I see from your Dockerfile that you compile qhull
> manually and specify "-fPIC". You mention in the installation directions
> that the developers have had success on arch linux: did you have to
> install qhull manually there too or was the one provided by the arch
> linux repositories sufficient (my guess is it's not)?
>
> Thanks,
> Mark
>
> On Friday, September 13, 2019 at 10:00:45 PM UTC-7, Mark Turiansky wrote:
>
> Hello,
>
> I'm trying to compile fresnel on an Arch Linux system. I have the
> required dependencies installed, but the compilation fails with the
> following message:
>
> /usr/bin/ld: /usr/lib/libqhullcpp.a(Qhull.cpp.o): relocation
> R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' can not be
> used when making a shared object; recompile with -fPIC
> /usr/bin/ld: final link failed: bad value
> collect2: error: ld returned 1 exit status
> make[2]: *** [fresnel/CMakeFiles/_common.dir/build.make:101:
> fresnel/_common.cpython-37m-x86_64-linux-gnu.so
> <http://common.cpython-37m-x86_64-linux-gnu.so>] Error 1
> make[1]: *** [CMakeFiles/Makefile2:119:
> fresnel/CMakeFiles/_common.dir/all] Error 2
> make[1]: *** Waiting for unfinished jobs....
> [100%] Built target _cpu
> make: *** [Makefile:130: all] Error 2
>
> It seems that linking against the qhull library is failing. I think
> the trouble is that the qhull library is a static library
> (libqhullcpp.a) while it is compiling the dynamic library
> (fresnel/_common.cpython-37m-x86_64-linux-gnu.so
> <http://common.cpython-37m-x86_64-linux-gnu.so>). I don't see a
> dynamic version of libqhullcpp in my /usr/lib.
>
> I'm not sure if this is an error with my system configuration or
> potentially the cmake files for fresnel.
>
> This stack overflow seems relevant:
> https://stackoverflow.com/questions/46731707/got-recompile-with-fpic-error-while-the-option-is-passed-to-the-linker
> <https://stackoverflow.com/questions/46731707/got-recompile-with-fpic-error-while-the-option-is-passed-to-the-linker>
> I tried adding "set(CMAKE_POSITION_INDEPENDENT_CODE ON)" in a few
> CMake files, but it didn't help. I'm not so familiar with CMake
> unfortunately.
>
> Thanks for any advice/help.
>
> Best,
> Mark
>
> --
> You received this message because you are subscribed to the Google
> Groups "fresnel-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to fresnel-user...@googlegroups.com
> <mailto:fresnel-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/fresnel-users/a6b88500-f623-4928-a6b6-42e3a3d4a3f3%40googlegroups.com
> <https://groups.google.com/d/msgid/fresnel-users/a6b88500-f623-4928-a6b6-42e3a3d4a3f3%40googlegroups.com?utm_medium=email&utm_source=footer>.

Mark Turiansky

unread,
Sep 16, 2019, 2:24:03 PM9/16/19
to fresnel-users
There's also the (least confrontational) option to maintain qhull with -fPIC on the AUR.

One other question I had is if there are any plans to make fresnel installable through pip? Personally, pip is most ideal because it's available with all python installations. Even conda is one step to many in my opinion. Would this inform the decision as to how to approach qhull?

Joshua A. Anderson

unread,
Sep 17, 2019, 11:27:42 AM9/17/19
to fresne...@googlegroups.com
Mark,

Building a manylinux wheel for pypi would take considerably more time
than I have available for fresnel maintenance. It would provide a
workaround for the qhull problem because the build script would compile
qhull and include it in the wheel.

On the developer side, conda is much easier to work with for python
packages with internal C/C++ libraries and dependencies. conda provides
a simple structure to build and package shared objects with a variety of
build systems and depend on C/C++ only packages.

I will investigate using the C API as that will also work to support
compilation with the ubuntu qhull package which does not include
libqhullcpp.a
----
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
http://www-personal.umich.edu/~joaander/

> >     <http://common.cpython-37m-x86_64-linux-gnu.so
> <http://common.cpython-37m-x86_64-linux-gnu.so>>] Error 1
> >     make[1]: *** [CMakeFiles/Makefile2:119:
> >     fresnel/CMakeFiles/_common.dir/all] Error 2
> >     make[1]: *** Waiting for unfinished jobs....
> >     [100%] Built target _cpu
> >     make: *** [Makefile:130: all] Error 2
> >
> >     It seems that linking against the qhull library is failing. I
> think
> >     the trouble is that the qhull library is a static library
> >     (libqhullcpp.a) while it is compiling the dynamic library
> >     (fresnel/_common.cpython-37m-x86_64-linux-gnu.so
> <http://common.cpython-37m-x86_64-linux-gnu.so>
> >     <http://common.cpython-37m-x86_64-linux-gnu.so
> <http://common.cpython-37m-x86_64-linux-gnu.so>>). I don't see a
> >     dynamic version of libqhullcpp in my /usr/lib.
> >
> >     I'm not sure if this is an error with my system configuration or
> >     potentially the cmake files for fresnel.
> >
> >     This stack overflow seems relevant:
> >
> https://stackoverflow.com/questions/46731707/got-recompile-with-fpic-error-while-the-option-is-passed-to-the-linker
> <https://stackoverflow.com/questions/46731707/got-recompile-with-fpic-error-while-the-option-is-passed-to-the-linker>
>
> >
> <https://stackoverflow.com/questions/46731707/got-recompile-with-fpic-error-while-the-option-is-passed-to-the-linker
> <https://stackoverflow.com/questions/46731707/got-recompile-with-fpic-error-while-the-option-is-passed-to-the-linker>>
>
> >     I tried adding "set(CMAKE_POSITION_INDEPENDENT_CODE ON)" in a
> few
> >     CMake files, but it didn't help. I'm not so familiar with CMake
> >     unfortunately.
> >
> >     Thanks for any advice/help.
> >
> >     Best,
> >     Mark
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "fresnel-users" group.
> > To unsubscribe from this group and stop receiving emails from it,
> send
> > an email to fresne...@googlegroups.com <javascript:>
> > <mailto:fresnel-user...@googlegroups.com <javascript:>>.
> <https://groups.google.com/d/msgid/fresnel-users/a6b88500-f623-4928-a6b6-42e3a3d4a3f3%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/fresnel-users/a6b88500-f623-4928-a6b6-42e3a3d4a3f3%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "fresnel-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to fresnel-user...@googlegroups.com
> <mailto:fresnel-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com
> <https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com?utm_medium=email&utm_source=footer>.

Mark Turiansky

unread,
Sep 17, 2019, 3:08:00 PM9/17/19
to fresnel-users
Okay, I see. Thanks for the help. I'll work with docker for now while you investigate the C API.

Best,
Mark
>      > <mailto:fresnel-users+unsub...@googlegroups.com <javascript:>>.

Joshua A. Anderson

unread,
Sep 20, 2019, 9:58:15 AM9/20/19
to fresne...@googlegroups.com
Pull the branch `embed-libqhullcpp` from github, update the git
submodules and try compiling fresnel from source again. It should find
that libqhullcpp is broken and build.

Let me know if that works for you.

---
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
http://www-personal.umich.edu/~joaander/

> >      > <mailto:fresnel-user...@googlegroups.com
> <javascript:> <javascript:>>.
> > an email to fresne...@googlegroups.com <javascript:>
> > <mailto:fresnel-user...@googlegroups.com <javascript:>>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com
> <https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com>
>
> >
> <https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "fresnel-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to fresnel-user...@googlegroups.com
> <mailto:fresnel-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/fresnel-users/2f1cc201-a87f-4d21-be90-135c2eb5bfed%40googlegroups.com
> <https://groups.google.com/d/msgid/fresnel-users/2f1cc201-a87f-4d21-be90-135c2eb5bfed%40googlegroups.com?utm_medium=email&utm_source=footer>.

Mark Turiansky

unread,
Sep 29, 2019, 5:35:41 PM9/29/19
to fresnel-users
Sorry for the delay. I tried installing from source again, and your fix works. One comment I would have is that the build still fails with the same error if I have qhull installed on my system. I needed to uninstall it for the compilation to work. It might help to mention this somewhere in the installation instructions in case someone else runs into the same problem.

Best,
Mark
>      >      > <mailto:fresnel-users+unsub...@googlegroups.com
>     <javascript:> <javascript:>>.
>      >      > To view this discussion on the web visit
>      >      >
>      >
>     https://groups.google.com/d/msgid/fresnel-users/a6b88500-f623-4928-a6b6-42e3a3d4a3f3%40googlegroups.com
>     <https://groups.google.com/d/msgid/fresnel-users/a6b88500-f623-4928-a6b6-42e3a3d4a3f3%40googlegroups.com>
>
>      >    
>     <https://groups.google.com/d/msgid/fresnel-users/a6b88500-f623-4928-a6b6-42e3a3d4a3f3%40googlegroups.com
>     <https://groups.google.com/d/msgid/fresnel-users/a6b88500-f623-4928-a6b6-42e3a3d4a3f3%40googlegroups.com>>
>
>      >
>      >      >
>      >    
>     <https://groups.google.com/d/msgid/fresnel-users/a6b88500-f623-4928-a6b6-42e3a3d4a3f3%40googlegroups.com?utm_medium=email&utm_source=footer
>     <https://groups.google.com/d/msgid/fresnel-users/a6b88500-f623-4928-a6b6-42e3a3d4a3f3%40googlegroups.com?utm_medium=email&utm_source=footer>
>
>      >    
>     <https://groups.google.com/d/msgid/fresnel-users/a6b88500-f623-4928-a6b6-42e3a3d4a3f3%40googlegroups.com?utm_medium=email&utm_source=footer
>     <https://groups.google.com/d/msgid/fresnel-users/a6b88500-f623-4928-a6b6-42e3a3d4a3f3%40googlegroups.com?utm_medium=email&utm_source=footer>>>.
>
>      >
>      >
>      > --
>      > You received this message because you are subscribed to the Google
>      > Groups "fresnel-users" group.
>      > To unsubscribe from this group and stop receiving emails from it,
>     send
>      > an email to fresne...@googlegroups.com <javascript:>
>      > <mailto:fresnel-users+unsub...@googlegroups.com <javascript:>>.

Joshua A. Anderson

unread,
Sep 30, 2019, 10:17:27 AM9/30/19
to fresne...@googlegroups.com
Mark,

Try the latest master branch (4f46ffb1b6b1a0) and see if it works for
you now with the arch qhull package installed.

----
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
http://www-personal.umich.edu/~joaander/

> >      >      > <mailto:fresnel-user...@googlegroups.com
> <javascript:>
> >      > <mailto:fresnel-user...@googlegroups.com
> <javascript:> <javascript:>>.
> >      > To view this discussion on the web visit
> >      >
> >
> https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com
> > an email to fresne...@googlegroups.com <javascript:>
> > <mailto:fresnel-user...@googlegroups.com <javascript:>>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/fresnel-users/2f1cc201-a87f-4d21-be90-135c2eb5bfed%40googlegroups.com
> <https://groups.google.com/d/msgid/fresnel-users/2f1cc201-a87f-4d21-be90-135c2eb5bfed%40googlegroups.com>
>
> >
> <https://groups.google.com/d/msgid/fresnel-users/2f1cc201-a87f-4d21-be90-135c2eb5bfed%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/fresnel-users/2f1cc201-a87f-4d21-be90-135c2eb5bfed%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "fresnel-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to fresnel-user...@googlegroups.com
> <mailto:fresnel-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/fresnel-users/4348f903-bc72-48b3-940c-229dace0b4dd%40googlegroups.com
> <https://groups.google.com/d/msgid/fresnel-users/4348f903-bc72-48b3-940c-229dace0b4dd%40googlegroups.com?utm_medium=email&utm_source=footer>.

Mark Turiansky

unread,
Sep 30, 2019, 2:09:50 PM9/30/19
to fresnel-users
Works perfectly now! Thank you for the help.
>      >      >      > <mailto:fresnel-users+unsub...@googlegroups.com
>      >      > <mailto:fresnel-users+unsub...@googlegroups.com
>     <javascript:> <javascript:>>.
>      >      > To view this discussion on the web visit
>      >      >
>      >
>     https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com
>     <https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com>
>
>      >    
>     <https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com
>     <https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com>>
>
>      >
>      >      >
>      >    
>     <https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com?utm_medium=email&utm_source=footer
>     <https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com?utm_medium=email&utm_source=footer>
>
>      >    
>     <https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com?utm_medium=email&utm_source=footer
>     <https://groups.google.com/d/msgid/fresnel-users/1701a3e9-3ab7-44c1-89ba-2ff3ef26b4cc%40googlegroups.com?utm_medium=email&utm_source=footer>>>.
>
>      >
>      >
>      > --
>      > You received this message because you are subscribed to the Google
>      > Groups "fresnel-users" group.
>      > To unsubscribe from this group and stop receiving emails from it,
>     send
>      > an email to fresne...@googlegroups.com <javascript:>
>      > <mailto:fresnel-users+unsub...@googlegroups.com <javascript:>>.
Reply all
Reply to author
Forward
0 new messages