Segmentation fault (core dumped) after GLFWViewer::initialize() when start the offline_lidar_visualizer_tool
I follow the steps in doc how_to_run_offline_perception_visualizer, after I use following command to start the visualizer,
/apollo/bazel-bin/modules/perception/tool/offline_visualizer_tool/offline_lidar_visualizer_tool
There is no window pop out, the error message like following pic:

I tried several times. It seems that the error Segmentation fault (core dumped) always came out right after GLFWViewer::initialize().
I also try start the tool with the option: --enable_visualization=false which prevent the visualiztion window creation, it seems to continually run, the result is like:

You can see that every frame is being processed.
So how can I make the visualization work?
Here is some info about my Apollo:
GPU:QUADRO M2000M
driver:384.111(both in docker and host pc)
deviceQuery test result: PASS
OpenGL related libs in docker:

OpenGL related libs in host:

Any luck with this @hzdsdhr ? I'm having the same problem.
Hi @hzdsdhr, I met the same problem, do you figure out how to solve it?
@ytzhao Did you get it to work ?
@luo2880399 Did you face issues with that ?
Solved it by copying files and linking it!
@ankitvora7 Hi ankitvora, how do fix this issue?
Can you post the console out of these three terminal commands ? Assuming you have Nvidia graphics card. nvidia-smi (inside the docker) nvidia-smi (outside the docker) ll /usr/lib/x86_64-linux-gnu/libGL*
@ankitvora7 inside the docker
Mon Mar 12 18:54:49 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.111 Driver Version: 384.111 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 1070 Off | 00000000:01:00.0 On | N/A |
| N/A 45C P8 10W / N/A | 260MiB / 8112MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
+-----------------------------------------------------------------------------+
outside the docker
Mon Mar 12 18:53:53 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.111 Driver Version: 384.111 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 1070 Off | 00000000:01:00.0 On | N/A |
| N/A 48C P5 13W / N/A | 260MiB / 8112MiB | 3% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 991 G /usr/lib/xorg/Xorg 152MiB |
| 0 2038 G compiz 101MiB |
| 0 23839 G /usr/lib/firefox/firefox 3MiB |
+-----------------------------------------------------------------------------+
ll /usr/lib/x86_64-linux-gnu/libGL*
$ ll /usr/lib/x86_64-linux-gnu/libGL*
lrwxrwxrwx 1 root root 21 1月 30 04:07 /usr/lib/x86_64-linux-gnu/libGLESv2.so -> mesa-egl/libGLESv2.so
lrwxrwxrwx 1 root root 19 2月 11 16:38 /usr/lib/x86_64-linux-gnu/libGLEWmx.so.1.13 -> libGLEWmx.so.1.13.0
-rw-r--r-- 1 root root 448632 11月 10 2015 /usr/lib/x86_64-linux-gnu/libGLEWmx.so.1.13.0
lrwxrwxrwx 1 root root 17 2月 11 16:38 /usr/lib/x86_64-linux-gnu/libGLEW.so.1.13 -> libGLEW.so.1.13.0
-rw-r--r-- 1 root root 514176 11月 10 2015 /usr/lib/x86_64-linux-gnu/libGLEW.so.1.13.0
lrwxrwxrwx 1 root root 13 1月 30 04:07 /usr/lib/x86_64-linux-gnu/libGL.so -> mesa/libGL.so
-rw-r--r-- 1 root root 911218 10月 24 2015 /usr/lib/x86_64-linux-gnu/libGLU.a
lrwxrwxrwx 1 root root 15 10月 24 2015 /usr/lib/x86_64-linux-gnu/libGLU.so -> libGLU.so.1.3.1
lrwxrwxrwx 1 root root 15 2月 11 16:38 /usr/lib/x86_64-linux-gnu/libGLU.so.1 -> libGLU.so.1.3.1
-rw-r--r-- 1 root root 453352 10月 24 2015 /usr/lib/x86_64-linux-gnu/libGLU.so.1.3.1
Thank you! :)
@ankitvora7 How to fix it?
@ytzhao - I'm sorry I completely missed your comment and hence didn't reply @hzdsdhr - Most likely you'll get the same output as @ytzhao. What is happening is the OpenGL files are not installed correctly. The symlinks that need to be created aren't created properly. So what you'll need to do is create these links such the libGL points to the nvidia provided openGL files. Follow these steps:
-
Start the docker
-
Get into the docker
-
Create a folder named nvidia-384 in the /usr/lib directory sudo mkdir /usr/lib/nvidia
-
In another terminal, outside the docker, copy the nvidia driver files from host machine into the docker docker cp /usr/lib/nvidia-384/libGL.so.384.111 apollo_dev:/usr/lib/nvidia-384 Note: The driver versions might differ. So change the path names accordingly.
-
Create the symlink between libGL and nvidia provided libGL inside the docker cd /usr/lib/x86_64-linux-gnu sudo ln -sf /usr/lib/nvidia-384/libGL.so.384.111 libGL.so
This worked for me. See if this works for you guys. If yes, you can change the dev_start script to accommodate these changes.
@ankitvora7 thank you for you help, really appreciate it. But it seems not working for me.
For my docker, there is a folder named nvidia-384 in /usr/lib/, there are many .so files in it. But there is not libGL.so.384.111. And I found the libGL.so.384.111 in host computer, in folder /usr/lib/nvidia-384.
So I copy it and paste into docker's same directory(/usr/lib/nvidia-384).
Then I did what you said,
cd /usr/lib/x86_64-linux-gnu
sudo ln -sf /usr/lib/nvidia-384/libGL.so.384.111 libGL.so
At last, I built offline_lidar_visualizer_tool again and run it, the error occurs as following:
_I0321 14:03:53.455853 824 kalman_filter.cc:93] propagation noise of KalmanFilter is
10 00 00
00 10 00
00 00 10
I0321 14:03:53.455893 824 kalman_filter.cc:57] breakdown threshold maximum of KalmanFilter is 10
I0321 14:03:53.455899 824 lidar_process.cc:300] Init algorithm plugin successfully, tracker: HmObjectTracker
I0321 14:03:53.455907 824 lidar_process.cc:313] Init algorithm plugin successfully, type_fuser: DummyTypeFuser
I0321 14:03:53.455921 824 glfw_viewer.cc:64] GLFWViewer::initialize()
Segmentation fault (core dumped)_
It seems to stop running right after GLFWViewer::initialize failing.
Do you have any solution for this? Thank you.
Can you check the console output of following two commands inside the docker please ?
- ll /usr/lib/nvidia-384
- ll /usr/lib/x86_64-linux-gnu/libGL*
So I copy it and paste into docker's same directory(/usr/lib/nvidia-384).
You should not manually copy and link the libGL.
I have experienced the same issue. It is a problem of OpenGL mismatch between the host and the docker. You need to make sure to install the gpu driver in both the host and the docker without mixing up the OpenGL in both places. To get it done, I have uninstalled the pre-installed driver in my ubuntu (16.04) and install the 384.111 nvidia driver from run file with --no-opengl-files (very important). An automatically approach with 'apt-get install nvidia-
To test if you properly install the driver in the docker without messing up the OpenGL, inside docker, run: 'glxgears'. For reference bahavior, run 'glxgears' in your host. If you can run 'glxgears' in the docker, then 'GLFWViewer()' in the docker should work fine and display the visualizer.
Also make sure you install CUDA properly. I have uninstalled the pre-installed CUDA 9.1 in my host machine using the readme from nvidia, and then installed the CUDA 8.0 that matches with the version used in the host.
@TuanHo16 You're right that these should not have been linked manually and hence this is a workaround. One surprising thing I noticed is that even if I have not linked the files, the glxgears demo works perfectly! But I continue to get segfaults when I run lidar visualizer.
@ankitvora7 The lidar visualizer is working for me. Some steps you may want to check:
Build both Apollo and perception/lidar_visualizer with GPU
./apollo.sh build_gpu
bazel build -c opt --cxxopt=-DUSE_CAFFE_GPU //modules/perception/tool/offline_visualizer_tool:offline_lidar_visualizer_tool
What is the output of your running glxgears in the docker?
@ankitvora7 the result for ll /usr/lib/nvidia-384 in docker is like:
total 30616
drwxr-xr-x 2 root root 4096 Mar 21 11:00 ./
drwxr-xr-x 167 root root 4096 Mar 21 10:34 ../
-rw-r--r-- 1 root root 1291224 Dec 20 14:50 libGL.so.384.111
-rw-r--r-- 1 root root 30031552 Dec 20 14:49 libnvidia-glcore.so.384.111
-rw-r--r-- 1 root root 13080 Dec 20 14:55 libnvidia-tls.so.384.111
the result for ll /usr/lib/x86_64-linux-gnu/libGL* is like:
lrwxrwxrwx 1 root root 36 Mar 21 10:34 /usr/lib/x86_64-linux-gnu/libGL.so -> /usr/lib/nvidia-384/libGL.so.384.111
-rw-r--r-- 1 root root 902304 Oct 21 2013 /usr/lib/x86_64-linux-gnu/libGLU.a
lrwxrwxrwx 1 root root 15 Oct 21 2013 /usr/lib/x86_64-linux-gnu/libGLU.so -> libGLU.so.1.3.1
lrwxrwxrwx 1 root root 15 Oct 21 2013 /usr/lib/x86_64-linux-gnu/libGLU.so.1 -> libGLU.so.1.3.1
-rw-r--r-- 1 root root 449232 Oct 21 2013 /usr/lib/x86_64-linux-gnu/libGLU.so.1.3.1
Any idea? Thank you.
@TuanHo16 I reinstall the nvidia driver 384.111 in host with -no-opengl-files,still not work. When I use the command 'glxgears' in the docker, the result: libGL error: failed to load driver: swrast X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 154 (GLX) Minor opcode of failed request: 3 (X_GLXCreateContext) Value in failed request: 0x0 Serial number of failed request: 35 Current serial number in output stream: 37
@hzdsdhr This is your expected result when running glxgears in the docker (with no libGL conflict, i.e. no "libGL error: failed to load driver: swrast") :

The renderer can load the library driver and create a window which is very similar to Apollo lidar visualizer.
Something to think about:
-
Entirely remove the host's driver before re-install with a run file.
-
Unload DRM kernel before you install the driver. Make sure you unload any application(s) that uses the drm kernel and OpenGL before installation. Otherwise, the installer would likely complain and you could not finish your installation properly. To see what related kernel is being loaded: "lsmod | grep nvidia"
@TuanHo16 Can you tell me how to unload DRM kernel? I'm really new to Linux. Thank you.
@hzdsdhr If you are not familiar with Linux, I would suggest you to start your installation of driver (both docker and host) before X starts. To do so, reboot your machine and at the logging screen (don't log in), go to the virtual terminal (Ctrl+Alt+F1) -> log in, kill X. Check lsmod | grep nvidia to make sure DRM is unloaded. After that, you can install the driver with --no-opengl-files at both places.