cea-sec / sanzu

Graphical remote desktop solution
GNU General Public License v3.0
175 stars 27 forks source link

Build (client) with spack on CentOS7 #252

Open cessenat opened 7 months ago

cessenat commented 7 months ago

I try to build sanzu for CentOS7 as a simple user with no sudo privilege. I use a decent gcc compiler (8.4). I obviously have missed a pre-requisite about "libclang": it fails as follows: << $ spack install sanzu %gcc ^cmake@3.27.9

==> Warning: the original concretizer is currently being used. Upgrade to "clingo" at your earliest convenience. The original concretizer will be removed from Spack in a future version. ==> zlib@1.2.11 : has external module in ['zlib/1.2.11-gcc-8.40.'] [+] /opt/spack/sw/zlib/1.2.11/linux-centos7-x86_64/gcc-8.4.0/zlib-1.2.11 (external zlib-1.2.11-cwiymq6mjpyhygikdliec3qxmtxlm4lb) [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/nghttp2-1.57.0-cva6ty2fky2g4tmgcqu3ukybqjbsx576 ==> xz@5.2.5 : has external module in ['xz/5.2.5-gcc-8.4.0'] [+] /opt/spack/sw/xz/5.2.5/linux-centos7-x86_64/gcc-8.4.0/xz-5.2.5 (external xz-5.2.5-wc3eqwosyydmpsqlmhtbpxwonwdeiey5) [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/pcre-8.45-m4eldcmbe5iqe37q4y4olu23d6krpfkx ==> python@3.7.7 : has external module in ['python/3.7.7-gcc-8.4.0'] [+] /opt/spack/sw/python/3.7.7/linux-centos7-x86_64/gcc-8.4.0/python-3.7.7 (external python-3.7.7-dwllrk7xmwdbfgv6hbkjyoyumaugfhp3) [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/nasm-2.15.05-jqlbv2twn2e2p6ryrvjjjgq5txtr4cgj [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/alsa-lib-1.2.3.2-katdvi7l3eta6dfjvv6sx6xtrglwkg42 ==> libiconv@1.16 : has external module in ['libiconv/1.16-gcc-8.4.0'] [+] /opt/spack/sw/libiconv/1.16/linux-centos7-x86_64/gcc-8.4.0/libiconv-1.16 (external libiconv-1.16-fsjhth7mutjoce4pu6krbwtk7xhzcoe3) [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/yasm-1.3.0-cdvmbgfdwryshel3x3nfxnrq4vk6be72 ==> bzip2@1.0.8 : has external module in ['bzip2/1.0.8-gcc-8.4.0'] [+] /opt/spack/sw/bzip2/1.0.8/linux-centos7-x86_64/gcc-8.4.0/bzip2-1.0.8 (external bzip2-1.0.8-vjdycwwzhddrfy266d33k5dn6p5bl26k) [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/abseil-cpp-20230802.1-lbmyhfkafn5bxa3cjsoc35frh5iln3vt ==> gettext@0.20.2 : has external module in ['gettext/0.20.2-gcc-8.4.0'] [+] /opt/spack/sw/gettext/0.20.2/linux-centos7-x86_64/gcc-8.4.0/gettext-0.20.2 (external gettext-0.20.2-gx2hj2atwtkjuli2jbwr52r4ao4g2xeu) [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libpthread-stubs-0.4-repcre6qaz6tkwb3vtmekxdaofdaeky2 [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/xproto-7.0.31-iu5peokr2tdobrsiclwkqnggnhikfxji [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libmd-1.0.4-zonmbnzief33ysjdcu4wqhivosidoh4a [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/xextproto-7.3.0-fewdu6x5zpks5mfvzacg6v34fmjaht7v [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/xtrans-1.4.0-pokzccma52ebxf7mofvebatszahtrkl3 [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/kbproto-1.0.7-kydfma3alvdl6afl4pdqtvto67dfd42w [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/inputproto-2.3.2-7io5edoxjw5x5ly526aiycyxwwvq2qco [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/fixesproto-5.0-n5tgvbjjuvao5n44saapaqmuwahx3ehi [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/recordproto-1.14.2-t5fnfaeoyukpyfmswkvmk3eae4235zu6 [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/damageproto-1.2.1-v23teqhe2fl7nswbmklnft4gvjsgtiy4 [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libogg-1.3.5-kgam2h7eo76rceegzaqfkwgo53xanatk [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/linux-pam-1.5.2-zcovtuzs6hyv6i3q6gkoc23rjhdnuddw ==> pkgconf@1.7.3 : has external module in ['pkgconf/1.7.3-gcc-8.4.0'] [+] /opt/spack/sw/pkgconf/1.7.3/linux-centos7-x86_64/gcc-8.4.0/pkgconf-1.7.3 (external pkgconf-1.7.3-vpcjgjlcpiqwx7rsba3bgt6voibugpeq) [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libgssglue-0.4-t6uljxiuc36imfrcesnd2my5q5ixc3wn [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/openssl-3.1.3-mgw6lgq7e6dziwqrf7exs7fxrcqp4mxv [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/xcb-proto-1.15.2-j2uw4wf7azqjkrslm6ohnqjheb3ucrxg [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/x264-20210613-twe5qdgu3lco3e5tkw7rbz2s2ntpswzl [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/protobuf-3.25.1-cgn5kuhwzgrt2zb7i3b23qtjub2xp3xv [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libbsd-0.11.7-sxuikdsnez6powqkkwavtbo45a5alpah [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libpam-1.09-llqvmnalwar43m3yj3ymdprq5gyhxzs5 [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libvorbis-1.3.7-ya2mtiuetgnifgz36rxkegq4unzgh4d5 [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libxau-1.0.8-s4wuz5xv2iiv46ueoow4cj3sq4utzudg [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libssh2-1.11.0-tnw2mishj2iykatacbxyw6q4od7penzh [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/curl-8.4.0-snsedkl3onnlejasvgabirlwq7xlun74 [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/krb5-1.20.1-krsaghkklgtilnhmfyqed3cxpcxyljtr [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/ffmpeg-6.0-7q3jrbhoznhprbvkwh5nmjf677wjbnso [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libxdmcp-1.1.4-lvqcxdwrdtx3elpfvnthrnnrttgffds5 [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/opus-1.3.1-ecay2mrcwbzarauewjl4p3xtrf6eekpd [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libgit2-1.7.0-4x4ymzyvkxcrywgsuksuxdn62nhuxten [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libxcb-1.14-vrie3dkhpsltnw2rviumx6nql476ggty [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/rust-1.73.0-aktutbu667qo3xg2sg5gggyezrjy65gn [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libx11-1.8.4-idfsgo6se3r2eprktnqtovkswjvzqcn5 [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libxfixes-5.0.2-2j5rm4gqg7bil53et5qicqzy2axdhdo6 [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libxext-1.3.3-w7gkfbnee6ehixtsxfg63nkeuen2nlkd [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libxdamage-1.1.4-o7plzulmroon7j37dwtvkuhdpunx636g [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libxi-1.7.6-vrxjv7uc5kg7nm6qqdug6b5dmxgv37jo [+] /home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/libxtst-1.2.2-t4xsv3jkeqaubcolcb273yled2437i6w ==> Installing sanzu-0.1.4-uyq3q7yt3lixvhkzg3qtsncwvjbt5cuv [50/50] ==> No binary for sanzu-0.1.4-uyq3q7yt3lixvhkzg3qtsncwvjbt5cuv found: installing from source ==> Using cached archive: /home/cessenat/spack/var/spack/cache/_source-cache/archive/3e/3ef19ac56d0b09fe6097f721fe206565665142cd9d5cc744092838daf63b4f90.tar.gz ==> No patches needed for sanzu ==> sanzu: Executing phase: 'install' ==> Error: ProcessError: Command exited with status 101: '/home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/rust-1.73.0-aktutbu667qo3xg2sg5gggyezrjy65gn/bin/cargo' 'install' '--root' '/home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/sanzu-0.1.4-uyq3q7yt3lixvhkzg3qtsncwvjbt5cuv' '--path' 'sanzu'

3 errors found in build log: 136 Compiling x11rb-protocol v0.10.0 137 Compiling crossbeam-deque v0.8.4 138 Compiling nix v0.25.1 139 Compiling users v0.10.0 140 Compiling humantime v2.1.0 141 Compiling base64 v0.21.5

142 error: failed to run custom build command for libgssapi-sys v0.3.0 143
144 Caused by: 145 process didn't exit successfully: /home/cessenat/tmp/spack-stage-sanzu-0.1.4-uyq3q7yt3lixvhkzg3qtsncwvjbt5cuv/spack-src/target/release/build/libgssapi- sys-db3d66ef8d25d5ba/build-script-build (exit status: 101) 146 --- stdout 147 cargo:rustc-link-lib=gssapi_krb5 148

 ...

 156              ),
 157              stdout: "/home/cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/krb5-1.20.1-krsaghkklgtilnhmfyqed3cxpcxyljtr/lib/libgssapi_krb5.so.2.2\n/home/
        cessenat/opt/spack/linux-centos7-skylake/gcc-8.4.0/krb5-1.20.1-krsaghkklgtilnhmfyqed3cxpcxyljtr/lib/libgssapi_krb5.so.2\n/home/cessenat/opt/spack/linux-ce
        ntos7-skylake/gcc-8.4.0/krb5-1.20.1-krsaghkklgtilnhmfyqed3cxpcxyljtr/lib/libgssapi_krb5.so\n",
 158              stderr: "",
 159          },
 160      )
 161      thread 'main' panicked at /home/cessenat/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.64.0/./lib.rs:2393:31:

162 Unable to find libclang: "the libclang shared library at /usr/lib64/clang-private/libclang.so.7 could not be opened: libclangAST.so.7: cannot open share d object file: No such file or directory" 163 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace 164 warning: build failed, waiting for other jobs to finish... 165 error: failed to compile sanzu v0.1.4 (/home/cessenat/tmp/spack-stage-sanzu-0.1.4-uyq3q7yt3lixvhkzg3qtsncwvjbt5cuv/spack-src/sanzu), intermediate artifa cts can be found at /home/cessenat/tmp/spack-stage-sanzu-0.1.4-uyq3q7yt3lixvhkzg3qtsncwvjbt5cuv/spack-src/target. 166 To reuse those artifacts with a future compilation, set the environment variable CARGO_TARGET_DIR to that path.

See build log for details: /home/cessenat/tmp/spack-stage-sanzu-0.1.4-uyq3q7yt3lixvhkzg3qtsncwvjbt5cuv/spack-build-out.txt

despite I do have a "/usr/lib64/clang-private/libclangAST.so.7" !

I join the spack package. package.py.gz

serpilliere commented 7 months ago

Hi @cessenat We also have sanzu on centOS 7 here, and if I remember correctly, I agree with you: I may haved missed a dependency update on clang of clang-devel (I will double check this, and update the README accordingly)

By the way, you need another fix to run sanzu on centos 7: As it distributes an old FFmpeg version, you have to use this patch:

diff --git a/sanzu/src/video_decoder.rs b/sanzu/src/video_decoder.rs
index b1e1838c..c909b620 100644
--- a/sanzu/src/video_decoder.rs
+++ b/sanzu/src/video_decoder.rs
@@ -33,6 +33,10 @@ pub fn init_video_codec<'a>(
         ffmpeg::av_log_set_level(ffmpeg::AV_LOG_FATAL);
     }

+    unsafe {
+        ffmpeg::av_register_all();
+    }
+
     let decoder: Box<dyn Decoder> = match name {
         "null" => Box::new(DecoderNull {
             data_rgb: None,
diff --git a/sanzu/src/video_encoder.rs b/sanzu/src/video_encoder.rs
index c4d210b0..d08a8553 100644
--- a/sanzu/src/video_encoder.rs
+++ b/sanzu/src/video_encoder.rs
@@ -611,6 +611,11 @@ pub fn init_video_encoder<'a>(
     unsafe {
         ffmpeg::av_log_set_level(ffmpeg::AV_LOG_FATAL);
     }
+
+    unsafe {
+        ffmpeg::av_register_all();
+    }
+
     let encoder: Box<dyn Encoder> = match name {
         "null" => Box::new(EncoderNull::new()),
         name => {

which you can find in this branch: https://github.com/cea-sec/sanzu/tree/ffmpeg_old The av_register_all is mandatory in old FFmpeg versions to prepare codec search (for decoding and encoding), and is now deprecated (so must be removed). But I may stop maintain it in a near future, as centos7 EOL is soon ( :skull: in june 2024)

cessenat commented 7 months ago

Thanks @serpilliere. I cannot install any OS package so I install everything with spack, including ffmpeg. Probably I do not have the proper packages from my distro, and I failed to find thge equivalent in spack ; I installed llvm@14 but that did not fix the error. I have llvm-private installed, but no clang or clang-dev - I thought it were the same thing.

$ yum whatprovides '*/libclangAST.so'
Modules complémentaires chargés : fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.in2p3.fr
 * epel: mirror.cspacehostings.com
 * extras: mirror.in2p3.fr
 * rpmfusion-free-updates: ftp.nluug.nl
 * updates: mirror.in2p3.fr
llvm-private-7.0.1-1.el7.i686 : llvm engine for Mesa
Dépôt               : base
Correspondance depuis :
Nom de fichier : /usr/lib/clang-private/libclangAST.so

llvm-private-7.0.1-1.el7.x86_64 : llvm engine for Mesa
Dépôt               : base
Correspondance depuis :
Nom de fichier : /usr/lib64/clang-private/libclangAST.so

llvm-private-7.0.1-1.el7.x86_64 : llvm engine for Mesa
Dépôt               : @CentOS
Correspondance depuis :
Nom de fichier : /usr/lib64/clang-private/libclangAST.so

$ rpm -q llvm-private
llvm-private-7.0.1-1.el7.x86_64