quixdb / squash

Compression abstraction library and utilities
https://quixdb.github.io/squash/
MIT License
406 stars 53 forks source link

Error in code during compilation #199

Closed srkmobiya closed 8 years ago

srkmobiya commented 8 years ago

Hi All,

I installed squash and it's all dependency then I try to run make but it is showing some error:-

[ 0%] Building C object squash/CMakeFiles/squash0.8.dir/memory.c.o /home/surendra/squash/squash/memory.c:52:4: error: #error No alignned memory allocation function /home/surendra/squash/squash/memory.c: In function ‘squash_wrap_aligned_alloc’: /home/surendra/squash/squash/memory.c:69:1: warning: no return statement in function returning non-void [-Wreturn-type] /home/surendra/squash/squash/memory.c: At top level: /home/surendra/squash/squash/memory.c:87:3: error: ‘_aligned_free’ undeclared here (not in a function) make[2]: * [squash/CMakeFiles/squash0.8.dir/memory.c.o] Error 1 make[1]: * [squash/CMakeFiles/squash0.8.dir/all] Error 2 make: *\ [all] Error 2

nemequ commented 8 years ago

What platform are you on? Aligned memory is something which isn't standardized (at least until C11, which we can't depend on yet), so we need several different implementations…

srkmobiya commented 8 years ago

Hi Nemeque,

I tried on Ubuntu 12.10. Now I am trying in CentOs 6 and getting this error:-

[root@diags1 squash]# make [ 9%] Built target squash0.8 [ 11%] Built target squash0.8-plugin-brieflz [ 20%] Built target squash0.8-plugin-brotli [ 26%] Built target squash0.8-plugin-bsc [ 26%] Built target squash0.8-plugin-bzip2 [ 27%] Built target squash0.8-plugin-copy [ 28%] Built target squash0.8-plugin-crush [ 29%] Building C object plugins/density/CMakeFiles/squash0.8-plugin-density.dir/density/src/block_decode.c.o In file included from /root/surendra/squash/plugins/density/density/src/block_decode.h:40, from /root/surendra/squash/plugins/density/density/src/block_decode.c:35: /root/surendra/squash/plugins/density/density/src/main_header.h:55: warning: declaration does not declare anything /root/surendra/squash/plugins/density/density/src/block_decode.c: In function ‘density_block_decode_init’: /root/surendra/squash/plugins/density/density/src/block_decode.c:121: error: ‘density_main_header_parameters’ has no member named ‘as_bytes’ make[2]: * [plugins/density/CMakeFiles/squash0.8-plugin-density.dir/density/src/block_decode.c.o] Error 1 make[1]: * [plugins/density/CMakeFiles/squash0.8-plugin-density.dir/all] Error 2 make: *\ [all] Error 2

nemequ commented 8 years ago

I haven't tried on Ubuntu 12.10 yet (qemu-kvm dosen't seem to like the installation media, I need to try with virtualbox).

CentOS 6 works if you disable the density and libdeflate plugins (libdeflate also uses unnamed unions). I think the issue is that GCC 4.4 didn't support unnamed unions in C99 mode (since C99 doesn't allow it), but did in GNU99. GCC has since been changed to support the extension even in C99 mode, but a warning message will be emitted if you compile with -Wpedantic (thanks to @jibsen for discovering that).

To disable density and libdeflate, you can just pass --disable-density --disable-libdeflate to the configure script or, if you're invoking CMake directly, passing -DENABLE_DENSITY=no -DENABLE_LIBDEFLATE=no to cmake.

nemequ commented 8 years ago

I just compiled Squash on an Ubuntu 12.04 VM without any issues. I did install 12.10 in a VM, but apparently when a release is no longer supported Ubuntu removes the repositories, so I couldn't install the necessary packages (git, build-essential, and cmake). Without a way to reproduce there isn't much I can do.

As for the issues on CentOS 6.2, libdeflate has been fixed. The issue has been reported to density, but unfortunately there hasn't been any activity in the library for some time now… other important bugs have gone unfixed for a long time (including a potential security issue that hasn't been adressed for about 6 months). I've disabled density plugin by default for now, so CentOS 6.2 will now compile without issues (just tested in a VM, it works).

nemequ commented 8 years ago

I've also added a CI build for CentOS: https://snap-ci.com/quixdb/squash/branch/staging, so hopefully we won't break it again.