Cisco-Talos / clamav

ClamAV - Documentation is here: https://docs.clamav.net
https://www.clamav.net/
GNU General Public License v2.0
4.47k stars 707 forks source link

Error while building Clamav in AIX - Powerpc64 #1345

Open KamathForAIX opened 3 months ago

KamathForAIX commented 3 months ago

Describe the bug

I am building Clamav for the AIX operating system on the PowerPC platform.

In AIX we need to pass bbigtoc flag to linker or mcmodel=large flag when the TOC is large via RUSTFLAGS.

More about TOC can be read here.

This causes the below error.

Any inputs to resolve this? It will be of help.

rror: failed to run rustc to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names '-C\' 'link-arg=-bbigtoc\' -g --target powerpc64-ibm-aix --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
  --- stderr
  error: unknown codegen option: `\`

How to reproduce the problem

Build Clamav on AIX with the below steps.

cmake  . -B build -D CMAKE_INSTALL_PREFIX=$PWD/install_dir -D ENABLE_JSON_SHARED=OFF -D JSONC_INCLUDE_DIR=/opt/freeware/include/json-c  -D JSONC_LIBRARY=/opt/freeware/lib/libjson-c.a -D ENABLE_TESTS=OFF  -DCMAKE_AIX_SHARED_LIBRARY_ARCHIVE=ON -DZLIB_INCLUDE_DIR=/opt/freeware/include/zlib.h -DZLIB_LIBRARY=/opt/freeware/lib/libz.a -DLIBXML2_LIBRARY=/opt/freeware/lib/libxml2.a -DLIBXML2_INCLUDE_DIR=/opt/freeware/include/libxml2/ -DPCRE2_LIBRARIES=/opt/freeware/lib/libpcre2-posix.a -DPCRE2_INCLUDE_DIR=/opt/freeware/include/pcre2.h -DRUSTFLAGS="-C link-arg=-bbigtoc "

cmake --build build -j 4
cmake --install build
micahsnyder commented 3 months ago

It sounds similar to this issue https://github.com/rust-lang/rust/issues/59142

Do you have some thing in a RUSTFLAGS environment variable that would cause this? For ClamAV 1.4.0, we added a change so that the RUSTFLAGS environment variable is passed through CMake to rustc: https://github.com/Cisco-Talos/clamav/pull/1301

KamathForAIX commented 3 months ago

No we do not have anything in RUSTFLAGS environment variable. Somehow a '/' gets added for a space. Not sure why. We are passing RUSTFLAGS through cmake only.