[Clamav-devel] ClamAV 0.100 could not compile on AIX 6.1

Micah Snyder (micasnyd) micasnyd at cisco.com
Fri Apr 20 10:55:00 EDT 2018


Sorry for the lag time getting back to you Tsutomu.

That is a very good question.

At a minimum, it looks as though the function definition should be


static inline int64_t cli_readint64(const void *buff)


instead of


static inline int32_t cli_readint64(const void *buff)


That said, it also appears that the lines in cli_readint64() and others should more explicitly cast the type prior to the shift.  Something like:



diff --git a/libclamav/others.h b/libclamav/others.h
index 65d20ef17..ab32e8fcb 100644
--- a/libclamav/others.h
+++ b/libclamav/others.h
@@ -579,18 +579,18 @@ struct unaligned_ptr {
     #define be32_to_host(v) (v)
     #define be64_to_host(v) (v)

-    static inline int32_t cli_readint64(const void *buff)
+    static inline int64_t cli_readint64(const void *buff)
     {
         int64_t ret;
-        ret = ((const char *)buff)[0] & 0xff;
-        ret |= (((const char *)buff)[1] & 0xff) << 8;
-        ret |= (((const char *)buff)[2] & 0xff) << 16;
-        ret |= (((const char *)buff)[3] & 0xff) << 24;
-
-        ret |= (((const char *)buff)[4] & 0xff) << 32;
-        ret |= (((const char *)buff)[5] & 0xff) << 40;
-        ret |= (((const char *)buff)[6] & 0xff) << 48;
-        ret |= (((const char *)buff)[7] & 0xff) << 56;
+        ret = (int64_t)((const char *)buff)[0] & 0xff;
+        ret |= (int64_t)(((const char *)buff)[1] & 0xff) << 8;
+        ret |= (int64_t)(((const char *)buff)[2] & 0xff) << 16;
+        ret |= (int64_t)(((const char *)buff)[3] & 0xff) << 24;
+
+        ret |= (int64_t)(((const char *)buff)[4] & 0xff) << 32;
+        ret |= (int64_t)(((const char *)buff)[5] & 0xff) << 40;
+        ret |= (int64_t)(((const char *)buff)[6] & 0xff) << 48;
+        ret |= (int64_t)(((const char *)buff)[7] & 0xff) << 56;
         return ret;
     }


Any chance you could try that patch to see if the warnings go away?

Regarding the 'ld' ERROR's youre seeing.  It looks as though it's failing to link correctly against libmspack or libclammspack.  Despite the above bug, this is what is now preventing you from completing the build.  It may have something to do with the ' --disable-static ' on your configure line.

Micah Snyder
ClamAV Development
Talos
Cisco Systems, Inc.


On Apr 14, 2018, at 8:12 AM, Tsutomu Oyamada <oyamada at promark-inc.com<mailto:oyamada at promark-inc.com>> wrote:

ld: 0711-317 ERROR: Undefined symbol: .mspack_create_cab_decompressor
ld: 0711-317 ERROR: Undefined symbol: .mspack_destroy_cab_decompressor
ld: 0711-317 ERROR: Undefined symbol: .mspack_create_chm_decompressor
ld: 0711-317 ERROR: Undefined symbol: .mspack_destroy_chm_decompressor
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status
-------

This message "Warning: Left shift count > = width of type" is many.
The following is the message in configure:
--------
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of void *... 8
--------
The size of the variable type is in 32bit mode.
Is this correct?




More information about the clamav-devel mailing list