xiaoyin0208 / lz4

Automatically exported from code.google.com/p/lz4
0 stars 0 forks source link

windows cygwin gcc compile error #72

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Error 1
=======
$make
gcc      -O3 -I. -std=c99 -Wall -W -Wundef -Wno-implicit-function-declaration 
lz4.c lz4hc.c bench.c xxhash.c lz4c.c -o lz4c.exe
/tmp/cchGfidN.o:lz4c.c:(.text+0xc36): undefined reference to `_LZ4_createHC'
/tmp/cchGfidN.o:lz4c.c:(.text+0x1013): undefined reference to `_LZ4_freeHC'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: 
/tmp/cchGfidN.o: bad reloc address 0xa20 in section `.rdata'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: final link 
failed: Invalid operation
collect2: ld returned 1 exit status
Makefile:16: recipe for tar

Analysis
========
cygwin gcc add underscores at the begining of function name.

Solution
========
remove 'extern' before function implementation.(lz4hc.c)

-extern inline void* LZ4_createHC (const char* slidingInputBuffer)
+inline void* LZ4_createHC (const char* slidingInputBuffer)
 {
     void* hc4 = ALLOCATOR(sizeof(LZ4HC_Data_Structure));
     LZ4_InitHC ((LZ4HC_Data_Structure*)hc4, (const BYTE*)slidingInputBuffer);
@@ -353,7 +353,7 @@
 }

-extern inline int LZ4_freeHC (void* LZ4HC_Data)
+inline int LZ4_freeHC (void* LZ4HC_Data)
 {
     FREEMEM(LZ4HC_Data);
     return (0);

----------------------------------------------------------------

Error 2
=======
$ make lz4c32
gcc -m32 -Os -march=native -I. -std=c99 -Wall -W -Wundef 
-Wno-implicit-function-declaration lz4.c lz4hc.c bench.c xxhash.c lz4c.c -o 
lz4c32.exe
lz4.c:1: error: bad value (native) for -march= switch
lz4.c:1: error: bad value (native) for -mtune= switch
lz4hc.c:1: error: bad value (native) for -march= switch
lz4hc.c:1: error: bad value (native) for -mtune= switch
bench.c:1: error: bad value (native) for -march= switch
bench.c:1: error: bad value (native) for -mtune= switch
xxhash.c:1: error: bad value (native) for -march= switch
xxhash.c:1: error: bad value (native) for -mtune= switch
lz4c.c:1: error: bad value (native) for -march= switch
lz4c.c:1: error: bad value (native) for -mtune= switch
Makefile:19: recipe for target `lz4c32' failed
make: *** [lz4c32] Error 1

Solution
=========
 lz4c32: lz4.c lz4hc.c bench.c xxhash.c lz4c.c
-       $(CC) -m32 -Os -march=native $(CFLAGS) $^ -o $@$(EXT)
+       $(CC) -m32 -Os $(CFLAGS) $^ -o $@$(EXT)

----------------------------------------------------------------
Everything is OK now, under windows cygwin:

$ make all
gcc      -O3 -I. -std=c99 -Wall -W -Wundef -Wno-implicit-function-declaration 
lz4.c lz4hc.c bench.c xxhash.c lz4c.c -o lz4c.exe
gcc -m32 -Os -I. -std=c99 -Wall -W -Wundef -Wno-implicit-function-declaration 
lz4.c lz4hc.c bench.c xxhash.c lz4c.c -o lz4c32.exe
gcc      -O3 -I. -std=c99 -Wall -W -Wundef -Wno-implicit-function-declaration 
lz4.c lz4hc.c fuzzer.c -o fuzzer.exe
gcc      -O3 -I. -std=c99 -Wall -W -Wundef -Wno-implicit-function-declaration 
lz4.c lz4hc.c xxhash.c fullbench.c -o fullbench.exe

Original issue reported on code.google.com by Godspeed...@gmail.com on 28 Jun 2013 at 3:10

GoogleCodeExporter commented 8 years ago
Thanks for reporting.

Error 1 is already corrected in the .dev version.
It will be part of the next release.

Error 2 (makefile limitation) can be modified for next release.

Rgds

Original comment by yann.col...@gmail.com on 28 Jun 2013 at 8:12

GoogleCodeExporter commented 8 years ago

Original comment by yann.col...@gmail.com on 28 Jun 2013 at 8:12

GoogleCodeExporter commented 8 years ago
Attached file : proposed release candidate, hopefully correcting the 2 
mentioned issues

Original comment by yann.col...@gmail.com on 28 Jun 2013 at 9:13

Attachments:

GoogleCodeExporter commented 8 years ago
Corrected into r98

Original comment by yann.col...@gmail.com on 1 Jul 2013 at 7:53