xiaolu / lz4

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

r71+ fails to build on Mac OS X #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
> uname -v
Darwin Kernel Version 11.4.0: Mon Apr  9 19:33:05 PDT 2012; 
root:xnu-1699.26.8~1/RELEASE_I386

LZ4 stopped building after revision r71:

> svn checkout -q http://lz4.googlecode.com/svn/trunk/ lz4-trunk && cd 
lz4-trunk && make
gcc      -O3 -I. -std=c99 -Wall -W -Wundef -Wno-implicit-function-declaration 
lz4hc.c lz4.c bench.c lz4demo.c -o LZ4Demo.exe
Undefined symbols for architecture x86_64:
  "_LZ4_compress64kCtx", referenced from:
      _LZ4_compress_limitedOutput in ccJ02lMQ.o
      _LZ4_compress in ccJ02lMQ.o
  "_LZ4_compressCtx", referenced from:
      _LZ4_compress_limitedOutput in ccJ02lMQ.o
      _LZ4_compress in ccJ02lMQ.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [lz4demo] Error 1

Revisions before r71 build ok:

> svn checkout -q -r 70 http://lz4.googlecode.com/svn/trunk/ lz4-ok && cd 
lz4-ok && make
gcc      -O3 -I. -std=c99 -Wall -W -Wundef -Wno-implicit-function-declaration 
lz4hc.c lz4.c bench.c lz4demo.c -o LZ4Demo.exe

Original issue reported on code.google.com by b...@atmaildot.com on 4 Aug 2012 at 9:08

GoogleCodeExporter commented 9 years ago
Thanks for the head up.
It looks like the ---Ctx() functions cannot be found at linking stage.
There could be a relation with the fact that they are now "inline", since r71.
Nonetheless, that's pretty strange since :
- The caller is into the same source file
- LZ4_NbCommonBytes() is also inlined, but that does not seem to cause any 
problem.

What's the version number of your GCC ?

Original comment by yann.col...@gmail.com on 5 Aug 2012 at 9:16

GoogleCodeExporter commented 9 years ago
$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) 
(LLVM build 2336.11.00)

Original comment by b...@atmaildot.com on 5 Aug 2012 at 9:27

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Found the answer here: http://stackoverflow.com/a/10245969
Changing the *Ctx() functions from inline to static inline fixed the problem.

Original comment by b...@atmaildot.com on 5 Aug 2012 at 10:26

GoogleCodeExporter commented 9 years ago
Thanks for pointing that out !

Original comment by yann.col...@gmail.com on 6 Aug 2012 at 7:55

GoogleCodeExporter commented 9 years ago
OK, if i do understand correctly
the version in attached file should solve the issue
without producing side effects.

Would you please tell me if it works for you ?

Regards

Original comment by yann.col...@gmail.com on 7 Aug 2012 at 7:46

Attachments:

GoogleCodeExporter commented 9 years ago
Yes, that change fixes the problem.

Original comment by b...@atmaildot.com on 7 Aug 2012 at 10:59

GoogleCodeExporter commented 9 years ago
Solved in r74

Original comment by yann.col...@gmail.com on 8 Aug 2012 at 1:03