Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load the shared library #8

Closed
guidomeijer opened this issue Feb 19, 2021 · 7 comments
Closed

Unable to load the shared library #8

guidomeijer opened this issue Feb 19, 2021 · 7 comments
Assignees
Labels

Comments

@guidomeijer
Copy link

I'm at the last step of the installation but unfortunately I ran into another issue. When I run the python example it gives the error

Traceback (most recent call last):
  File "/home/guido/Repositories/datoviz/bindings/cython/datoviz/__init__.py", line 10, in <module>
    from .pydatoviz import App, colormap
ImportError: /lib/x86_64-linux-gnu/librsvg-2.so.2: undefined symbol: cairo_tag_end

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bindings/cython/examples/quickstart.py", line 12, in <module>
    from datoviz import canvas, run, colormap
  File "/home/guido/Repositories/datoviz/bindings/cython/datoviz/__init__.py", line 13, in <module>
    "Unable to load the shared library, make sure to run in your terminal:\n"
ImportError: Unable to load the shared library, make sure to run in your terminal:
`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/build`

I ran source setup-env.sh which is basically the command given in the error message, but when I run $LD_LIBRARY_PATH it says
bash: :/home/guido/Repositories/datoviz/build: No such file or directory
However, this is the correct path so I don't understand why it can't find it.

@rossant rossant self-assigned this Feb 19, 2021
@rossant
Copy link
Contributor

rossant commented Feb 19, 2021

I think the key bit is:

ImportError: /lib/x86_64-linux-gnu/librsvg-2.so.2: undefined symbol: cairo_tag_end

First, what is your exact operating system?

@rossant
Copy link
Contributor

rossant commented Feb 19, 2021

Also, what is your Python environment?

@guidomeijer
Copy link
Author

I'm on Ubuntu 20.04.2 LTS and use Anaconda 4.9.2 with python 3.7.9

@rossant
Copy link
Contributor

rossant commented Feb 19, 2021

Okay, I think this is the issue: https://stackoverflow.com/a/63305833/1595060

If I understand correctly, Anaconda overrides a system lib (librsvg) with its own, and the librsvg provided in Ubuntu 20.04 (used when compiling Datoviz) doesn't match the one provided by Anaconda (used when running Python). So you have to tell Python to use the system librsvg instead of the Anaconda one. The link above should provide some guidance, I'll try to find a more automated way to fix this.

@rossant
Copy link
Contributor

rossant commented Feb 19, 2021

For the record, it seems this library is one of the many dependencies brought by ffmpeg when Datoviz is compiled with ffmpeg support (ffmpeg is only used by the integrated live screencast video feature, but it may also be used in the future if we ever implement a Video visual).

So, you could also go in the CMakeLists.txt and disable compilation with ffmpeg by replacing option(DATOVIZ_WITH_FFMPEG "Build Datoviz with FFMPEG support" ON) by option(DATOVIZ_WITH_FFMPEG "Build Datoviz with FFMPEG support" OFF). This will disable the screencast feature, but will also remove the broken librsvg dependency.

For future reference, here are the dependencies of Datoviz when ffmpeg support is OFF (Ubuntu 20.04):

$ ldd build/libdatoviz.so
	linux-vdso.so.1 (0x00007ffdba957000)
	libglfw.so.3 => /lib/x86_64-linux-gnu/libglfw.so.3 (0x00007efc65bc4000)
	libvulkan.so.1 => /home/cyrille/vulkan/x86_64/lib/libvulkan.so.1 (0x00007efc6596f000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007efc6594c000)
	libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007efc65914000)
	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007efc65733000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efc655e2000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007efc655c7000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efc653d5000)
	/lib64/ld-linux-x86-64.so.2 (0x00007efc66024000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007efc653cf000)
	libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007efc65292000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007efc65276000)
	libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007efc6524a000)
	libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007efc65244000)
	libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007efc6523c000)
	libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007efc65222000)

Note for future package managers: if creating a conda package, I guess you should make sure that you use the Anaconda ffmpeg and other libraries instead of the system libraries.

@guidomeijer
Copy link
Author

Thanks! Running the python script as follows works for me:
LD_PRELOAD=/lib/x86_64-linux-gnu/libcairo.so.2 python bindings/cython/examples/quickstart.py

@rossant
Copy link
Contributor

rossant commented Feb 19, 2021

Great, thanks! Will update the install instructions for Anaconda users on Ubuntu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants