Skip to content

[2.2.1] lib/xmlparse.c compilation error (getentropy) on macOS #52

@AmirIHz

Description

@AmirIHz

I'm getting a compilation error with expat version 2.2.1 on macOS (both with clang and gcc)

Clang error:

/bin/sh ./libtool --verbose --mode=compile clang -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -fno-strict-aliasing  -DHAVE_EXPAT_CONFIG_H -o lib/xmlparse.lo -c lib/xmlparse.c
libtool: compile:  clang -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -fno-strict-aliasing -DHAVE_EXPAT_CONFIG_H -c lib/xmlparse.c  -fno-common -DPIC -o lib/.libs/xmlparse.o
In file included from lib/xmlparse.c:702:
/usr/include/sys/random.h:37:22: error: expected ')'
int getentropy(void* buffer, size_t size);
                     ^
lib/xmlparse.c:626:23: note: expanded from macro 'buffer'
#define buffer (parser->m_buffer)
                      ^
/usr/include/sys/random.h:37:22: note: to match this '('
lib/xmlparse.c:626:16: note: expanded from macro 'buffer'
#define buffer (parser->m_buffer)
               ^
lib/xmlparse.c:721:9: warning: implicit declaration of function 'getrandom' is invalid in C99 [-Wimplicit-function-declaration]
        getrandom(currentTarget, bytesToWrite, getrandomFlags);
        ^
1 warning and 1 error generated.
make: *** [Makefile:208: lib/xmlparse.lo] Error 1

Gists are available:
Clang: https://gist.github.com/AmirIHz/d39cf383fcd3c3d5dcd63c57007d874e
GCC: https://gist.github.com/AmirIHz/3e3b7fb14a782dcdd0aa8aee71db7584

Compiling and installing libbsd didn't help.

2.2.0 compiles w/o any problems (which makes sense, given the 2.2.1 Changelog)

Building 2.2.1 with CMake somehow finishes successfully, however, the resulting dylib (dynamic library) has a different compatibility version than the one built using configure/make, which causes problems with binaries that depend on expat. Another issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions