Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error with zlib-ng 2.1.3 when included from other project #1557

Open
FrancescAlted opened this issue Aug 18, 2023 · 4 comments
Open

Comments

@FrancescAlted
Copy link

FrancescAlted commented Aug 18, 2023

Hi. Thanks for the lib-ng project; it's a really nice replacement for regular zlib.

When trying to update zlib-ng from 2.0.7 to 2.1.3 in C-Blosc2 library, I am getting this (new) error:

[ 27%] Building C object blosc/CMakeFiles/blosc2_static.dir/__/internal-complibs/zlib-ng-2.1.3/adler32.c.o
In file included from /Users/faltet/blosc/c-blosc2/internal-complibs/zlib-ng-2.1.3/adler32.c:7:
In file included from /Users/faltet/blosc/c-blosc2/internal-complibs/zlib-ng-2.1.3/functable.h:9:
/Users/faltet/blosc/c-blosc2/internal-complibs/zlib-ng-2.1.3/deflate.h:212:34: error: expected parameter declarator
    struct crc32_fold_s ALIGNED_(16) crc_fold;
                                 ^
/Users/faltet/blosc/c-blosc2/internal-complibs/zlib-ng-2.1.3/deflate.h:212:34: error: expected ')'
/Users/faltet/blosc/c-blosc2/internal-complibs/zlib-ng-2.1.3/deflate.h:212:33: note: to match this '('
    struct crc32_fold_s ALIGNED_(16) crc_fold;
                                ^
/Users/faltet/blosc/c-blosc2/internal-complibs/zlib-ng-2.1.3/deflate.h:212:37: error: expected ';' at end of declaration list
    struct crc32_fold_s ALIGNED_(16) crc_fold;
                                    ^
                                    ;
/Users/faltet/blosc/c-blosc2/internal-complibs/zlib-ng-2.1.3/deflate.h:212:25: error: field 'ALIGNED_' declared as a function
    struct crc32_fold_s ALIGNED_(16) crc_fold;
                        ^

We have been triggering the zlib-ng build process from C-Blosc2 since 1.0, and it worked well so far, but not anymore with 2.1.3. Can you shed some light on what could be going on here? Thanks in advance!

@nmoinvaz
Copy link
Member

nmoinvaz commented Aug 19, 2023

Looks like ALIGNED_ is defined from HAVE_ATTRIBUTE_ALIGNED which, maybe mean it possibly isn't detecting attribute(aligned(x)) properly.

I was looking at your CMake and I think in zlib-ng CMake we do target_include_directories(... PUBLIC ..) which makes this not necessary:

file(COPY
                ${CMAKE_CURRENT_BINARY_DIR}/internal-complibs/${ZLIB_NG_DIR}/zconf.h
                DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/internal-complibs/${ZLIB_NG_DIR}/)

There might be something to it that I'm not seeing though.

If you still have problems can you attach your CMake output and CMakeOutput.log and CMakeErrors.log from build/CMakeFiles? I tried to look at your CI, but I couldn't find a run where it failed with this ALIGNED_ error.

@mtl1979
Copy link
Collaborator

mtl1979 commented Aug 20, 2023

https://github.com/Blosc/c-blosc2/blob/main/CMakeLists.txt#L183C9-L183C61 is incorrect... It's missing second parameter.

@thunderstone135
Copy link

I'm also getting this error when attempting to build in MSYS2 👇

gcc -O2  -m32 -std=c11 -Wall -DNDEBUG -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE=1 -Wno-pedantic-ms-format -DNO_FSEEKO -DNO_STRERROR -DZLIB_COMPAT -DWITH_GZFILEOP -DX86_FEATURES -DWITH_GZFILEOP -I/home/user/zlib/zlib-ng-2.1.5 -c -o example.o /home/user/zlib/zlib-ng-2.1.5/test/example.c
In file included from /home/user/zlib/zlib-ng-2.1.5/test/example.c:12:
/home/user/zlib/zlib-ng-2.1.5/deflate.h:217:34: error: expected declaration specifiers or ‘...’ before numeric constant
  217 |     struct crc32_fold_s ALIGNED_(16) crc_fold;
      |                                  ^~
/home/user/zlib/zlib-ng-2.1.5/deflate.h:287:12: error: expected declaration specifiers or ‘...’ before numeric constant
  287 | } ALIGNED_(8);
      |            ^
cc1: note: unrecognized command-line option ‘-Wno-pedantic-ms-format’ may have been intended to silence earlier diagnostics
make: *** [Makefile:200: example.o] Error 1

For configure, I use this 👇

./configure --prefix="$HOME/zlib/install" --32 --force-sse2 --zlib-compat

After that, I proceed with make.

@thunderstone135
Copy link

Update:

I was able to resolve the issue by updating MSYS2 with Pacman -Syu.
I normally don't update MSYS2 regularly because they sometimes f*ck up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants