Mailing List Archive

"BZIP2_LIBRARIES" breaks cmake build
Hi,

I am writing to report that the cmake build method will be broken if the
"BZIP2_LIBRARIES" parameter is set.

The build is successful with this :
| cmake .. \
| -D CMAKE_BUILD_TYPE=Release \
| -D ENABLE_JSON_SHARED=OFF \
| -D JSONC_INCLUDE_DIR=<path-to-json-c>/include/json-c \
| -D JSONC_LIBRARY=<path-to-json-c>/lib/libjson-c.a

But it fails when "BZIP2_LIBRARIES" is used :
| cmake .. \
| -D CMAKE_BUILD_TYPE=Release \
| -D ENABLE_JSON_SHARED=OFF \
| -D BZIP2_LIBRARIES=<path-to-bzip2>/lib/libbz2.a \
| -D JSONC_INCLUDE_DIR=<path-to-json-c>/include/json-c \
| -D JSONC_LIBRARY=<path-to-json-c>/lib/libjson-c.a

Between the lines "-- Configuring done" and "-- Generating done", the
following block of text is repeated 17 times :
| CMake Warning (dev) in CMakeLists.txt:
| Policy CMP0111 is not set: An imported target missing its location property
| fails during generation. Run "cmake --help-policy CMP0111" for policy
| details. Use the cmake_policy command to set the policy and suppress this
| warning.
|
| IMPORTED_LOCATION not set for imported target "BZip2::BZip2" configuration
| "Release".
| This warning is for project developers. Use -Wno-dev to suppress it.

If "make" is then invoked, it will stop at 52% of progress :
| [ 51%] Built target tgt_clam_IScab_ext.exe
| [ 51%] Built target tomsfastmath
| libclamav/CMakeFiles/clamav.dir/build.make:2445: *** target pattern contains no '%'. Stop.
| make[1]: *** [CMakeFiles/Makefile2:1562: libclamav/CMakeFiles/clamav.dir/all] Error 2
| make[1]: *** Waiting for unfinished jobs....
| [ 52%] Linking CXX shared library libclamunrar.so
| [ 52%] Built target clamunrar
| make: *** [Makefile:166: all] Error 2

Parameters for other dependencies (e.g. "OPENSSL_CRYPTO_LIBRARY",
"LIBXML2_LIBRARY", etc) have not caused any problem.

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml
Re: "BZIP2_LIBRARIES" breaks cmake build [ In reply to ]
We use CMake's FindBZip2 module.

It looks to me like there are two issues:

1. You must specify BZIP2_INCLUDE_DIR=<path to header directory>
2. Setting "BZIP2_LIBRARIES" does not work and you must instead set BZIP2_LIBRARY_RELEASE.

I found that these options works on my system where I've installed libbz2 to $HOME/.mussels/install/host-static:
-D BZIP2_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \
-D BZIP2_LIBRARY_RELEASE="$HOME/.mussels/install/host-static/lib/libbz2_static.a" \

We will have to update the clamav INSTALL.md file to list this variable name instead of BZIP2_LIBRARIES.

If anyone wants to volunteer to fix it in CMake's sources, CMake is open source and the module is here: https://github.com/Kitware/CMake/blob/master/Modules/FindBZip2.cmake

Regards,
Micah


Micah Snyder
ClamAV Development
Talos
Cisco Systems, Inc.
________________________________
From: clamav-users <clamav-users-bounces@lists.clamav.net> on behalf of anctop--- via clamav-users <clamav-users@lists.clamav.net>
Sent: Saturday, January 15, 2022 10:02 PM
To: clamav-users@lists.clamav.net <clamav-users@lists.clamav.net>
Cc: anctop@gmail.com <anctop@gmail.com>
Subject: [clamav-users] "BZIP2_LIBRARIES" breaks cmake build


Hi,

I am writing to report that the cmake build method will be broken if the
"BZIP2_LIBRARIES" parameter is set.

The build is successful with this :
| cmake .. \
| -D CMAKE_BUILD_TYPE=Release \
| -D ENABLE_JSON_SHARED=OFF \
| -D JSONC_INCLUDE_DIR=<path-to-json-c>/include/json-c \
| -D JSONC_LIBRARY=<path-to-json-c>/lib/libjson-c.a

But it fails when "BZIP2_LIBRARIES" is used :
| cmake .. \
| -D CMAKE_BUILD_TYPE=Release \
| -D ENABLE_JSON_SHARED=OFF \
| -D BZIP2_LIBRARIES=<path-to-bzip2>/lib/libbz2.a \
| -D JSONC_INCLUDE_DIR=<path-to-json-c>/include/json-c \
| -D JSONC_LIBRARY=<path-to-json-c>/lib/libjson-c.a

Between the lines "-- Configuring done" and "-- Generating done", the
following block of text is repeated 17 times :
| CMake Warning (dev) in CMakeLists.txt:
| Policy CMP0111 is not set: An imported target missing its location property
| fails during generation. Run "cmake --help-policy CMP0111" for policy
| details. Use the cmake_policy command to set the policy and suppress this
| warning.
|
| IMPORTED_LOCATION not set for imported target "BZip2::BZip2" configuration
| "Release".
| This warning is for project developers. Use -Wno-dev to suppress it.

If "make" is then invoked, it will stop at 52% of progress :
| [ 51%] Built target tgt_clam_IScab_ext.exe
| [ 51%] Built target tomsfastmath
| libclamav/CMakeFiles/clamav.dir/build.make:2445: *** target pattern contains no '%'. Stop.
| make[1]: *** [CMakeFiles/Makefile2:1562: libclamav/CMakeFiles/clamav.dir/all] Error 2
| make[1]: *** Waiting for unfinished jobs....
| [ 52%] Linking CXX shared library libclamunrar.so
| [ 52%] Built target clamunrar
| make: *** [Makefile:166: all] Error 2

Parameters for other dependencies (e.g. "OPENSSL_CRYPTO_LIBRARY",
"LIBXML2_LIBRARY", etc) have not caused any problem.

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml
Re: "BZIP2_LIBRARIES" breaks cmake build [ In reply to ]
This is to confirm that the fix works perfectly.

Many thanks for your help.
It is particularly crucial for those non-standard systems like ours.

Regards,
anctop


On Tue, 18 Jan 2022, Micah Snyder (micasnyd) wrote:
> We use CMake's FindBZip2 module.
> It looks to me like there are two issues:
> 1. You must specify BZIP2_INCLUDE_DIR=<path to header directory>
> 2. Setting "BZIP2_LIBRARIES" does not work and you must instead set BZIP2_LIBRARY_RELEASE.
> I found that these options works on my system where I've installed libbz2 to
> $HOME/.mussels/install/host-static:
> -D BZIP2_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \
> -D BZIP2_LIBRARY_RELEASE="$HOME/.mussels/install/host-static/lib/libbz2_static.a" \
> We will have to update the clamav INSTALL.md file to list this variable name instead of
> BZIP2_LIBRARIES.
> If anyone wants to volunteer to fix it in CMake's sources, CMake is open source and the
> module is here: https://github.com/Kitware/CMake/blob/master/Modules/FindBZip2.cmake
> Regards, Micah
> Micah Snyder
> ClamAV Development
> Talos
> Cisco Systems, Inc.
>
> ____________________________________________________________________________________________
> From: clamav-users <clamav-users-bounces@lists.clamav.net> on behalf of anctop--- via
> clamav-users <clamav-users@lists.clamav.net>
> Sent: Saturday, January 15, 2022 10:02 PM
> To: clamav-users@lists.clamav.net <clamav-users@lists.clamav.net>
> Cc: anctop@gmail.com <anctop@gmail.com>
> Subject: [clamav-users] "BZIP2_LIBRARIES" breaks cmake build
> Hi,
> I am writing to report that the cmake build method will be broken if the
> "BZIP2_LIBRARIES" parameter is set.
> The build is successful with this :
> | cmake .. \
> | -D CMAKE_BUILD_TYPE=Release \
> | -D ENABLE_JSON_SHARED=OFF \
> | -D JSONC_INCLUDE_DIR=<path-to-json-c>/include/json-c \
> | -D JSONC_LIBRARY=<path-to-json-c>/lib/libjson-c.a
> But it fails when "BZIP2_LIBRARIES" is used :
> | cmake .. \
> | -D CMAKE_BUILD_TYPE=Release \
> | -D ENABLE_JSON_SHARED=OFF \
> | -D BZIP2_LIBRARIES=<path-to-bzip2>/lib/libbz2.a \
> | -D JSONC_INCLUDE_DIR=<path-to-json-c>/include/json-c \
> | -D JSONC_LIBRARY=<path-to-json-c>/lib/libjson-c.a
> Between the lines "-- Configuring done" and "-- Generating done", the
> following block of text is repeated 17 times :
> | CMake Warning (dev) in CMakeLists.txt:
> | Policy CMP0111 is not set: An imported target missing its location property
> | fails during generation. Run "cmake --help-policy CMP0111" for policy
> | details. Use the cmake_policy command to set the policy and suppress this
> | warning.
> | IMPORTED_LOCATION not set for imported target "BZip2::BZip2" configuration
> | "Release".
> | This warning is for project developers. Use -Wno-dev to suppress it.
> If "make" is then invoked, it will stop at 52% of progress :
> | [ 51%] Built target tgt_clam_IScab_ext.exe
> | [ 51%] Built target tomsfastmath
> | libclamav/CMakeFiles/clamav.dir/build.make:2445: *** target pattern contains no '%'. Stop.
> | make[1]: *** [CMakeFiles/Makefile2:1562: libclamav/CMakeFiles/clamav.dir/all] Error 2
> | make[1]: *** Waiting for unfinished jobs....
> | [ 52%] Linking CXX shared library libclamunrar.so
> | [ 52%] Built target clamunrar
> | make: *** [Makefile:166: all] Error 2
> Parameters for other dependencies (e.g. "OPENSSL_CRYPTO_LIBRARY",
> "LIBXML2_LIBRARY", etc) have not caused any problem.
> _______________________________________________
> clamav-users mailing list
> clamav-users@lists.clamav.net
> https://lists.clamav.net/mailman/listinfo/clamav-users
> Help us build a comprehensive ClamAV guide:
> https://github.com/vrtadmin/clamav-faq
> http://www.clamav.net/contact.html#ml

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml