[Spice-devel] [PATCH 1/2] Fix build for systems without LZ4 dependency installed

Eduardo Lima (Etrunko) etrunko at redhat.com
Wed Jun 15 17:45:40 UTC 2016


This was introduced by commit 903c91cd3013c763abd3f2292f8fbd911a0c83f0.
To fix it, we simply protect the try_compress_lz4 function with proper

Build log:

spicevmc.c: In function 'try_compress_lz4':
spicevmc.c:143:5: error: implicit declaration of function 'LZ4_compress_default' [-Werror=implicit-function-declaration]
     compressed_data_count = LZ4_compress_default((char*)&msg_item->buf,
     ^
spicevmc.c:143:5: error: nested extern declaration of 'LZ4_compress_default' [-Werror=nested-externs]

spicevmc.c: At top level:
spicevmc.c:124:24: error: 'try_compress_lz4' defined but not used [-Werror=unused-function]
 static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeItem *msg_item)
                        ^

Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
---
 server/spicevmc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/server/spicevmc.c b/server/spicevmc.c
index 908ad5f..e949827 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -121,6 +121,7 @@ static void spicevmc_red_channel_release_msg_rcv_buf(RedChannelClient *rcc,
  *  - NULL upon failure.
  *  - a new pipe item with the compressed data in it upon success
  */
+#ifdef USE_LZ4
 static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeItem *msg_item)
 {
     RedVmcPipeItem *msg_item_compressed;
@@ -157,6 +158,7 @@ static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeI
     free(msg_item_compressed);
     return NULL;
 }
+#endif
 
 static RedPipeItem *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin,
                                                        void *opaque)
-- 
2.5.5



More information about the Spice-devel mailing list