User Tools

Site Tools


general:linux:create_shared_c_fs_lib_for_preload_with_citrix_client

Create shared c++fs lib for preload with Citrix client

Problem

Citrix client requires libc++ 9.x or newer, reason is probably due to the fact that prior to that it was needed to link with libc++fs.a at compile time.

sunkan@sunkan:/opt$ /opt/Citrix/ICAClient/util/HdxRtcEngine 2>&1| c++filt
/opt/Citrix/ICAClient/util/HdxRtcEngine: symbol lookup error: /opt/Citrix/ICAClient/util/HdxRtcEngine: undefined symbol: std::__1::__fs::filesystem::__temp_directory_path(std::__1::error_code*)

See Notes at cppreference

Solution

Extract libc++fs.a and then re-package it as shared library, then preload before launching citrix client.

Extract libc++fs.a

sunkan@sunkan:/tmp$ ar xv /usr/lib/llvm-7/lib/libc++fs.a 
x - operations.cpp.o
x - directory_iterator.cpp.o
x - int128_builtins.cpp.o
sunkan@sunkan:/tmp$

Package object files into shared library

sunkan@sunkan:/tmp$ clang++-7 -stdlib=libc++ -std=c++17 -shared -Wl,-soname,c++fs.so -o c++fs.so operations.cpp.o directory_iterator.cpp.o int128_builtins.cpp.o
sunkan@sunkan:/tmp$ ldd c++fs.so
        linux-vdso.so.1 (0x00007fff4596b000)
        libc++.so.1 => /lib/x86_64-linux-gnu/libc++.so.1 (0x00007f6bd7458000)
        libc++abi.so.1 => /lib/x86_64-linux-gnu/libc++abi.so.1 (0x00007f6bd7420000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6bd7298000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6bd7278000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6bd70b0000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6bd7088000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f6bd7078000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f6bd7580000)
sunkan@sunkan:/tmp$ 

Modify icaclient installation

sunkan@sunkan:/opt$ ls -l
total 140
-rw-r--r-- 1 root root 123408 maj 14 11:54 c++fs.so
drwxr-xr-x 3 root root   4096 mar 24 13:58 Citrix
drwxr-xr-x 3 root root   4096 mar 24 13:58 Citrix-20.12.0.12
-rw-r--r-- 1 root root    342 maj 14 12:48 wfica.desktop
-rwxr-xr-x 1 root root    188 maj 14 12:48 wfica.sh
 
sunkan@sunkan:/opt$ cat wfica.desktop 
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Citrix Workspace Engine
StartupWMClass=Wfica
NoDisplay=true
MimeType=application/x-ica;
Categories=Application;Network;X-Red-Hat-Base;X-SuSE-Core-Internet;
Icon=/opt/Citrix/ICAClient/icons/receiver.png
TryExec=/opt/Citrix/ICAClient/wfica
Exec=/opt/Citrix/ICAClient/wfica.sh %f
 
sunkan@sunkan:/opt$ cat wfica.sh
#!/bin/sh
ICAROOT=/opt/Citrix/ICAClient 
export ICAROOT
LD_LIBRARY_PATH=/opt/Citrix/ICAClient/lib
export LD_LIBRARY_PATH
LD_PRELOAD=/opt/c++fs.so
export LD_PRELOAD
$ICAROOT/wfica -file $1
sunkan@sunkan:/opt$ 
 
...
 
root@sunkan:/opt# cp wfica.desktop /usr/share/applications/wfica.desktop
root@sunkan:/opt# cp wfica.sh Citrix/ICAClient/
general/linux/create_shared_c_fs_lib_for_preload_with_citrix_client.txt · Last modified: 2021/05/14 13:29 by