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

[2.6.4 clang/glibc-2.25.90] implicit declaration of function 'reallocarray' is invalid in C99 #241

Closed
elkrejzi opened this issue Jul 17, 2017 · 10 comments

Comments

Projects
None yet
4 participants
@elkrejzi
Copy link

commented Jul 17, 2017

When built with clang-4.0.1, on system with glibc-2.25.90 (glibc 2.26 development snapshot, current git master), the following is noted during compilation

https://gist.github.com/elkrejzi/baad3a9c0035ef954cbb8e6ce2d635ba

At runtime, while compiling doxygen, flex will crash with the following backtrace

https://gist.github.com/elkrejzi/2f821eab0346ea1d1501dfd0f8c53195

@elkrejzi

This comment has been minimized.

@elkrejzi

This comment has been minimized.

Copy link
Author

commented Jul 17, 2017

reallocarray is declared in malloc.h on glibc-based system. Simply adding "#include <malloc.h>" to src/flexdef.h fixes the problem for me.

@Explorer09

This comment has been minimized.

Copy link
Contributor

commented Jul 19, 2017

@elkrejzi reallocarray prototypes in FreeBSD and OpenBSD are defined in <stdlib.h> (see man pages 1 2 )
Glibc should follow and declare reallocarray prototype in <stdlib.h> as well. Since you're building against a development version of Glibc, there's nothing we could fix in flex's side.

@elkrejzi

This comment has been minimized.

Copy link
Author

commented Jul 19, 2017

@Explorer09 It's unlikely glibc is going to change their behaviour. This is after all, a non-standard function.

@elkrejzi

This comment has been minimized.

Copy link
Author

commented Jul 19, 2017

According to https://sourceware.org/bugzilla/show_bug.cgi?id=21789 you need to define _GNU_SOURCE on glibc systems to use this function via stdlib.h (well, as I said, it's a non-standard function).

@Explorer09

This comment has been minimized.

Copy link
Contributor

commented Jul 19, 2017

@elkrejzi I would say thank you for finding that out.
However regarding feature test macros, flex misses many of them, not just _GNU_SOURCE.
The current flex source can pop out many "implicit declaration" warnings when built with gcc -std=c99.
I think that's another issue different from this one.

@elkrejzi

This comment has been minimized.

Copy link
Author

commented Jul 19, 2017

Well, clang defaults to c99 mode for some time now. Doesn't gcc as well?

@westes

This comment has been minimized.

Copy link
Owner

commented Jul 19, 2017

@Explorer09

This comment has been minimized.

Copy link
Contributor

commented Jul 19, 2017

@elkrejzi I mean c99 mode without GNU extensions

@westes westes modified the milestone: 2.6.5 Jul 24, 2017

@westes westes closed this Sep 4, 2017

Explorer09 added a commit to Explorer09/flex that referenced this issue Sep 4, 2017

AC_USE_SYSTEM_EXTENSIONS in configure.ac
This would define _GNU_SOURCE in config.h, enabling the reallocarray()
prototype in glibc 2.26+.

Fixes westes#241.

westes added a commit that referenced this issue Sep 4, 2017

build: AC_USE_SYSTEM_EXTENSIONS in configure.ac.
This would, e.g. define _GNU_SOURCE in config.h, enabling the
reallocarray() prototype in glibc 2.26+ on Linux systems with that
version of glibc.

Fixes #241.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 20, 2017

triaxx
Add workaround for fixing build on Linux
See westes/flex#241
The problem is fixed in master branch and the workaround could be removed
in the next version update.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 22, 2017

triaxx
Add workaround for fixing build on Linux
See westes/flex#241
The problem is fixed in master branch and the workaround could be removed
in the next version update.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 22, 2017

triaxx
Add workaround for fixing build on Linux
See westes/flex#241
The problem is fixed in master branch and the workaround could be removed
in the next version update.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 22, 2017

triaxx
Add workaround for fixing build on Linux
See westes/flex#241
The problem is fixed in master branch and the workaround could be removed
in the next version update.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 24, 2017

triaxx
Add workaround for fixing build on Linux
See westes/flex#241
The problem is fixed in master branch and the workaround could be removed
in the next version update.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Nov 4, 2017

Pullup ticket #5602 - requested by sevan
audio/grip: Linux build fix

Revisions pulled up:
- audio/grip/Makefile                                           1.5
- audio/grip/distinfo                                           1.3
- audio/grip/patches/patch-configure                            1.3

---
   Module Name:    pkgsrc
   Committed By:   triaxx
   Date:           Sun Oct 22 07:55:24 UTC 2017

   Modified Files:
           pkgsrc/audio/grip: Makefile distinfo
   Added Files:
           pkgsrc/audio/grip/patches: patch-configure

   Log Message:
   Add workaround for fixing build on Linux

   See westes/flex#241
   The problem is fixed in master branch and the workaround could be removed
   in the next version update.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Nov 6, 2017

Pullup ticket #5605 - requested by sevan
devel/flex: Linux build fix

Revisions pulled up:
- devel/flex/Makefile                                           1.61

---
   Module Name:    pkgsrc
   Committed By:   triaxx
   Date:           Fri Oct 20 06:22:24 UTC 2017

   Modified Files:
           pkgsrc/devel/flex: Makefile

   Log Message:
   Add workaround for fixing build on Linux

   See westes/flex#241
   The problem is fixed in master branch and the workaround could be removed
   in the next version update.
@kevin-osborne

This comment has been minimized.

Copy link

commented Aug 15, 2018

I just needed to build lede/openwrt on manjaro; fixed it by adding this patch to tools/flex/patches/:

https://github.com/westes/flex/commit/24fd0551333e7eded87b64dd36062da3df2f6380.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.