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
Milestone

Comments

@elkrejzi
Copy link

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
Copy link
Author

@elkrejzi
Copy link
Author

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
Copy link
Contributor

@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
Copy link
Author

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

@elkrejzi
Copy link
Author

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
Copy link
Contributor

@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
Copy link
Author

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

@westes
Copy link
Owner

westes commented Jul 19, 2017 via email

@Explorer09
Copy link
Contributor

@elkrejzi I mean c99 mode without GNU extensions

@westes westes modified the milestone: 2.6.5 Jul 24, 2017
@westes westes closed this as completed Sep 4, 2017
Explorer09 added a commit to Explorer09/flex that referenced this issue Sep 4, 2017
This would define _GNU_SOURCE in config.h, enabling the reallocarray()
prototype in glibc 2.26+.

Fixes westes#241.
westes pushed a commit that referenced this issue Sep 4, 2017
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
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
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
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
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
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
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
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
Copy link

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

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jan 14, 2020
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 Jan 14, 2020
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.
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue May 27, 2020
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 May 27, 2020
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.
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 14, 2021
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 Oct 14, 2021
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.
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jan 18, 2023
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 Jan 18, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants