Skip to content

Commit 271a618

Browse files
committed
Cmake: Additional symbol version-script fixes
libclamav.map: Add missing symbol and correct symbol version. libclamunrar.map: Use symbol version-script for libclamunrar, too. Thank you to Sebastian Andrzej Siewior for the help. Also fix a unittest linker issue... Adding libclamav.map causes libclamav to no longer export zlib when zlib is statically linked. What was weird is that libxml2 depends on zlib and the check_clamav unit test program was using those symbols from libclamav. Introducing libclamav.map broke that even though we were explicitly trying to link check_clamav with ZLIB::ZLIB as well. For reasons I can't explain, linking check_clamav with the ClamAV::common library managed to properly link it with ZLIB::ZLIB and so the undefined references go away. Also in this commit, I've removed the `.map` files from .gitignore I'm not sure why they were ignored before.
1 parent 745fbaf commit 271a618

4 files changed

Lines changed: 8 additions & 32 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ __pycache__/
3030

3131
# C Linker output
3232
*.ilk
33-
*.map
3433
*.exp
3534

3635
# C Precompiled Headers

libclamav/libclamav.map

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ CLAMAV_PUBLIC {
1515
cl_engine_set_clcb_meta;
1616
cl_engine_set_clcb_file_props;
1717
cl_set_clcb_msg;
18-
cl_engine_set_clcb_file_inspection;
1918
cl_engine_set_clcb_pre_scan;
2019
cl_engine_set_clcb_post_scan;
2120
cl_engine_set_clcb_virus_found;
@@ -64,11 +63,13 @@ CLAMAV_PUBLIC {
6463
CLAMAV_0.104.0 {
6564
global:
6665
cl_engine_set_clcb_engine_compile_progress;
66+
cl_engine_set_clcb_engine_free_progress;
6767
cl_engine_set_clcb_sigload_progress;
6868
} CLAMAV_PUBLIC;
6969
CLAMAV_1.0.0 {
7070
global:
7171
cl_cvdunpack;
72+
cl_engine_set_clcb_file_inspection;
7273
} CLAMAV_0.104.0;
7374
CLAMAV_PRIVATE {
7475
global:

libclamunrar/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ if(ENABLE_SHARED_LIB)
9595

9696
if(WIN32)
9797
set_target_properties(clamunrar PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
98+
elseif(UNIX AND NOT APPLE)
99+
target_link_options(clamunrar PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libclamunrar.map")
98100
endif()
99101

100102
if(WIN32)

unit_tests/CMakeLists.txt

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,7 @@ if(ENABLE_APP)
4848
target_link_libraries(check_fpu_endian
4949
PRIVATE
5050
ClamAV::libclamav
51-
libcheck::check
52-
tomsfastmath
53-
JSONC::jsonc
54-
${LIBMSPACK}
55-
OpenSSL::SSL
56-
OpenSSL::Crypto
57-
ZLIB::ZLIB
58-
BZip2::BZip2
59-
PCRE2::pcre2
60-
LibXml2::LibXml2)
51+
libcheck::check)
6152
if(ENABLE_SHARED_LIB)
6253
target_link_libraries(check_fpu_endian
6354
PRIVATE
@@ -84,16 +75,7 @@ if(ENABLE_APP)
8475
PRIVATE
8576
ClamAV::libclamav
8677
ClamAV::common
87-
libcheck::check
88-
tomsfastmath
89-
JSONC::jsonc
90-
${LIBMSPACK}
91-
OpenSSL::SSL
92-
OpenSSL::Crypto
93-
ZLIB::ZLIB
94-
BZip2::BZip2
95-
PCRE2::pcre2
96-
LibXml2::LibXml2)
78+
libcheck::check)
9779
if(ENABLE_SHARED_LIB)
9880
target_link_libraries(check_clamd
9981
PRIVATE
@@ -132,16 +114,8 @@ target_sources(check_clamav
132114
target_link_libraries(check_clamav
133115
PRIVATE
134116
ClamAV::libclamav
135-
libcheck::check
136-
tomsfastmath
137-
JSONC::jsonc
138-
${LIBMSPACK}
139-
OpenSSL::SSL
140-
OpenSSL::Crypto
141-
ZLIB::ZLIB
142-
BZip2::BZip2
143-
PCRE2::pcre2
144-
LibXml2::LibXml2)
117+
ClamAV::common
118+
libcheck::check)
145119
if (ENABLE_UNRAR)
146120
if(ENABLE_SHARED_LIB)
147121
target_link_libraries(check_clamav

0 commit comments

Comments
 (0)