Project

General

Profile

Bug #2806

Compile Error in Generated Parsers With strongSwan 5.6.3+ on mips32r2 and uClibc

Added by Alexander Ostapchuk almost 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
build
Target version:
Start date:
Due date:
Estimated time:
Affected version:
5.6.3
Resolution:
Fixed

Description

Hello!

Strongswan 5.6.3+ do not build for mips32r2 with uClibc 0.9.33.2

This is error in src/libstrongswan/settings/settings_lexer.c at string

"#include <unistd.h>" - error expected ';', ',' or ')' before numeric constant

The referenced line in unistd.h is:

extern void __exit_thread (int val) __attribute__ ((__noreturn__));

As I can see in the src/libstrongswan/settings/settings_lexer.c is defined variable "val"

line 716 "settings/settings_lexer.c" 

#define INITIAL 0
#define ref 1
#define val 2
#define inc 3
#define str 4

#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
 * down here because we want the user's section 1 to have been scanned first.
 * The user has a chance to override it with an option.
 */
/* %if-c-only */
#include <unistd.h>
/* %endif */
/* %if-c++-only */
/* %endif */
#endif

and after preprocessing we have in the unistd.h:

extern void __exit_thread (int 1) __attribute__ ((__noreturn__));

After I move include above the define - everything compiled without errors

line 716 "settings/settings_lexer.c" 

#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
 * down here because we want the user's section 1 to have been scanned first.
 * The user has a chance to override it with an option.
 */
/* %if-c-only */
#include <unistd.h>
/* %endif */
/* %if-c++-only */
/* %endif */
#endif

#define INITIAL 0
#define ref 1
#define val 2
#define inc 3
#define str 4

History

#1 Updated by Tobias Brunner almost 7 years ago

  • Tracker changed from Issue to Bug
  • Status changed from New to Feedback
  • Assignee set to Tobias Brunner
  • Target version set to 5.7.2

This is error in src/libstrongswan/settings/settings_lexer.c at string

If you read the first comment in that file, you know that it is generated by flex. So we have no direct way to influence the placement of these defines.

I can see three ways to fix this. Either use %option nounistd to avoid the inclusion (this requires %option never-interactive too to disable interactive mode, which uses isatty() from uinstd.h), or include the file ourselves in the header so the include guard in the header file should prevent these conflicts, or rename the state variables (but that might cause conflicts with other versions of unistd.h or later changes to that file). I'm leaning towards the first option as we don't use the scanners interactively, so that's what I pushed to the 2806-flex-unistd branch.

Anyway, to fix this you either have to do what you already did (modify the distributed and generated file), apply a patch to the .l files and regenerate them, or build everything directly from the repository with the pushed patch applied (which requires other tools like bison and gperf, see source:HACKING).

#2 Updated by Tobias Brunner almost 7 years ago

  • Status changed from Feedback to Closed
  • Resolution set to Fixed

#3 Updated by Tobias Brunner over 6 years ago

  • Subject changed from Strongswan 5.6.3+ on mips32r2 and uClibc to Compile Error in Generated Parsers With strongSwan 5.6.3+ on mips32r2 and uClibc