Repository: stepjam/RLBench
Issue: Running Headless Fail
Root cause: Environment Incompatibility

Hello, authors. I want to install the RLBench on the A5000 linux server. However, I encounter some problems need your help.  


I strictly follow the instruction in this repo and PyRep repo, especally the section `Running Headless`. When I execute the example program via `python examples/few_short_rl.py`. It shows the following mistakes and terminates.
```
qt.qpa.xcb: QXcbConnection: XCB error: 148 (Unknown), sequence: 195, resource id: 0, major code: 140 (Unknown), minor code: 20
qt.qpa.xcb: QXcbConnection: XCB error: 148 (Unknown), sequence: 210, resource id: 0, major code: 140 (Unknown), minor code: 20
qt.qpa.xcb: QXcbConnection: XCB error: 148 (Unknown), sequence: 224, resource id: 0, major code: 140 (Unknown), minor code: 20
qt.qpa.xcb: QXcbConnection: XCB error: 148 (Unknown), sequence: 238, resource id: 0, major code: 140 (Unknown), minor code: 20
qt.qpa.xcb: QXcbConnection: XCB error: 148 (Unknown), sequence: 252, resource id: 0, major code: 140 (Unknown), minor code: 20
qt.qpa.xcb: QXcbConnection: XCB error: 148 (Unknown), sequence: 266, resource id: 0, major code: 140 (Unknown), minor code: 20
qt.qpa.xcb: QXcbConnection: XCB error: 148 (Unknown), sequence: 280, resource id: 0, major code: 140 (Unknown), minor code: 20
qt.qpa.xcb: QXcbConnection: XCB error: 148 (Unknown), sequence: 294, resource id: 0, major code: 140 (Unknown), minor code: 20
Reset Episode
libGL error: MESA-LOADER: failed to open swrast: /lib/x86_64-linux-gnu/libLLVM-12.so.1: undefined symbol: ffi_type_sint32, version LIBFFI_BASE_7.0 (search paths /usr/lib/x86_64-linux-gnu/dri, suffix _dri)
libGL error: failed to load driver: swrast
libGL error: MESA-LOADER: failed to open swrast: /lib/x86_64-linux-gnu/libLLVM-12.so.1: undefined symbol: ffi_type_sint32, version LIBFFI_BASE_7.0 (search paths /usr/lib/x86_64-linux-gnu/dri, suffix _dri)
libGL error: failed to load driver: swrast
libGL error: MESA-LOADER: failed to open swrast: /lib/x86_64-linux-gnu/libLLVM-12.so.1: undefined symbol: ffi_type_sint32, version LIBFFI_BASE_7.0 (search paths /usr/lib/x86_64-linux-gnu/dri, suffix _dri)
libGL error: failed to load driver: swrast
libGL error: MESA-LOADER: failed to open swrast: /lib/x86_64-linux-gnu/libLLVM-12.so.1: undefined symbol: ffi_type_sint32, version LIBFFI_BASE_7.0 (search paths /usr/lib/x86_64-linux-gnu/dri, suffix _dri)
libGL error: failed to load driver: swrast
libGL error: MESA-LOADER: failed to open swrast: /lib/x86_64-linux-gnu/libLLVM-12.so.1: undefined symbol: ffi_type_sint32, version LIBFFI_BASE_7.0 (search paths /usr/lib/x86_64-linux-gnu/dri, suffix _dri)
libGL error: failed to load driver: swrast
libGL error: MESA-LOADER: failed to open swrast: /lib/x86_64-linux-gnu/libLLVM-12.so.1: undefined symbol: ffi_type_sint32, version LIBFFI_BASE_7.0 (search paths /usr/lib/x86_64-linux-gnu/dri, suffix _dri)
libGL error: failed to load driver: swrast
libGL error: MESA-LOADER: failed to open swrast: /lib/x86_64-linux-gnu/libLLVM-12.so.1: undefined symbol: ffi_type_sint32, version LIBFFI_BASE_7.0 (search paths /usr/lib/x86_64-linux-gnu/dri, suffix _dri)
libGL error: failed to load driver: swrast
libGL error: MESA-LOADER: failed to open swrast: /lib/x86_64-linux-gnu/libLLVM-12.so.1: undefined symbol: ffi_type_sint32, version LIBFFI_BASE_7.0 (search paths /usr/lib/x86_64-linux-gnu/dri, suffix _dri)
libGL error: failed to load driver: swrast


Error: signal 11:

/data1/gl/.local/bin/CoppeliaSim/libcoppeliaSim.so.1(_Z11_segHandleri+0x30)[0x7f4ad0fc4ae0]
/lib/x86_64-linux-gnu/libc.so.6(+0x43090)[0x7f4b74408090]
/data1/gl/.local/bin/CoppeliaSim/libQt5Gui.so.5(_ZNK14QOpenGLContext10shareGroupEv+0x0)[0x7f4acf82e060]
/data1/gl/.local/bin/CoppeliaSim/libQt5Gui.so.5(_ZN16QOpenGLFunctions25initializeOpenGLFunctionsEv+0x4b)[0x7f4acfafaa4b]
/data1/gl/.local/bin/CoppeliaSim/libQt5Gui.so.5(_ZN24QOpenGLFramebufferObjectC1EiiNS_10AttachmentEjj+0xc8)[0x7f4acfafea18]
/data1/gl/.local/bin/CoppeliaSim/libsimExtOpenGL3Renderer.so(_ZN18CFrameBufferObjectC2Eii+0x5a)[0x7f4a1344724a]
/data1/gl/.local/bin/CoppeliaSim/libsimExtOpenGL3Renderer.so(_ZN16COpenglOffscreenC1EiiiP14QOpenGLContext+0x72)[0x7f4a13447602]
/data1/gl/.local/bin/CoppeliaSim/libsimExtOpenGL3Renderer.so(_Z21executeRenderCommandsbiPv+0x2550)[0x7f4a13445b90]
/data1/gl/.local/bin/CoppeliaSim/libcoppeliaSim.so.1(_ZN16CPluginContainer11extRendererEiPv+0x19)[0x7f4ad118e249]
/data1/gl/.local/bin/CoppeliaSim/libcoppeliaSim.so.1(_ZN13CVisionSensor24_extRenderer_prepareViewEi+0x347)[0x7f4ad0e95107]
QMutex: destroying locked mutex
```

The system information is:
```
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.6 LTS
Release:	20.04
Codename:	focal
```

I executed the command 
(1) `sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024
echo -e 'Section "ServerFlags"\n\tOption "MaxClients" "2048"\nEndSection\n' \
    | sudo tee /etc/X11/xorg.conf.d/99-maxclients.conf
`
(2) `sudo nohup X :99 & disown`
```
(rlbench) ➜  nvidia-smi

Sat Jul 13 20:13:29 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.54.03              Driver Version: 535.54.03    CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA RTX A5000               Off | 00000000:01:00.0 Off |                  Off |
| 30%   46C    P0              69W / 230W |     29MiB / 24564MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   1  NVIDIA RTX A5000               Off | 00000000:25:00.0 Off |                  Off |
| 30%   45C    P0              64W / 230W |     29MiB / 24564MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   2  NVIDIA RTX A5000               Off | 00000000:41:00.0 Off |                  Off |
| 30%   43C    P0              58W / 230W |     29MiB / 24564MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   3  NVIDIA RTX A5000               Off | 00000000:61:00.0 Off |                  Off |
| 30%   41C    P0              66W / 230W |     29MiB / 24564MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   4  NVIDIA RTX A5000               Off | 00000000:81:00.0 Off |                  Off |
| 30%   42C    P0              65W / 230W |     29MiB / 24564MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   5  NVIDIA RTX A5000               Off | 00000000:A1:00.0 Off |                  Off |
| 30%   42C    P0              67W / 230W |     29MiB / 24564MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   6  NVIDIA RTX A5000               Off | 00000000:C1:00.0 Off |                  Off |
| 30%   43C    P0              63W / 230W |     29MiB / 24564MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   7  NVIDIA RTX A5000               Off | 00000000:E1:00.0 Off |                  Off |
| 30%   41C    P0              63W / 230W |     29MiB / 24564MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A     36862      G   /usr/lib/xorg/Xorg                           23MiB |
|    1   N/A  N/A     36862      G   /usr/lib/xorg/Xorg                           23MiB |
|    2   N/A  N/A     36862      G   /usr/lib/xorg/Xorg                           23MiB |
|    3   N/A  N/A     36862      G   /usr/lib/xorg/Xorg                           23MiB |
|    4   N/A  N/A     36862      G   /usr/lib/xorg/Xorg                           23MiB |
|    5   N/A  N/A     36862      G   /usr/lib/xorg/Xorg                           23MiB |
|    6   N/A  N/A     36862      G   /usr/lib/xorg/Xorg                           23MiB |
|    7   N/A  N/A     36862      G   /usr/lib/xorg/Xorg                           23MiB |
+---------------------------------------------------------------------------------------+

```


The supplementary is:
```
(rlbench) ➜  x86_64-linux-gnu echo $LIBGL_DRIVERS_PATH
/usr/lib/x86_64-linux-gnu/dri
(rlbench) ➜  x86_64-linux-gnu ll | grep libffi
-rw-r--r--  1 root root   62K 3月  24  2020 libffi.a
-rw-r--r--  1 root root   62K 3月  24  2020 libffi_pic.a
lrwxrwxrwx  1 root root    15 3月  24  2020 libffi.so -> libffi.so.7.1.0
lrwxrwxrwx  1 root root    37 7月  13 14:52 libffi.so.6 -> /usr/lib/x86_64-linux-gnu/libffi.so.7
lrwxrwxrwx  1 root root    15 4月  25  2023 libffi.so.7 -> libffi.so.7.1.0
-rw-r--r--  1 root root   43K 3月  24  2020 libffi.so.7.1.0
(rlbench) ➜  x86_64-linux-gnu ll | grep libLLVM-12.so
lrwxrwxrwx  1 root root    15 3月   9  2022 libLLVM-12.0.0.so.1 -> libLLVM-12.so.1
lrwxrwxrwx  1 root root    15 3月   9  2022 libLLVM-12.so -> libLLVM-12.so.1
-rw-r--r--  1 root root   88M 3月   9  2022 libLLVM-12.so.1
```

**I have tried 3 servers, they all encountered similar problems. I am very helpless. I would be grateful if you could help me.**

Hi, I encountered this problem too, and you need to set another env variable LD_PRELOAD, for example `export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libffi.so.7`