conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
945 stars 1.71k forks source link

[package] flex/2.6.4: "flex: fatal internal error, exec of m4 failed" #4223

Open Quincunx271 opened 3 years ago

Quincunx271 commented 3 years ago

Package and Environment Details

Conan profile

[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=9
compiler.libcxx=libstdc++
build_type=Release
[options]
[build_requires]
[env]

Steps to reproduce

conanfile.txt

[build_requires]
flex/2.6.4

[generators]
cmake

CMakeLists.txt

cmake_minimum_required(VERSION 3.15)

project(TheProject)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

find_package(FLEX REQUIRED)

flex_target(do_flex lexer.l "${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp")
add_library(Something ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
target_link_libraries(Something ${CONAN_LIBS})

lexer.l (grabbed from the test_package/basic_nr.l)

/*
 * This file is part of flex.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 
 * Neither the name of the University nor the names of its contributors
 * may be used to endorse or promote products derived from this software
 * without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE.
 */

%option C++ noyywrap

%{
int mylineno = 0;
%}

string  \"[^\n"]+\"

ws  [ \t]+

alpha   [A-Za-z]
dig [0-9]
name    ({alpha}|{dig}|\$)({alpha}|{dig}|\_|\.|\-|\/|\$)*
num1    [-+]?{dig}+\.?([eE][-+]?{dig}+)?
num2    [-+]?{dig}*\.{dig}+([eE][-+]?{dig}+)?
number  {num1}|{num2}

%%

{ws}    /* skip blanks and tabs */

"/*"        {
        int c;

        while((c = yyinput()) != 0)
            {
            if(c == '\n')
                ++mylineno;

            else if(c == '*')
                {
                if((c = yyinput()) == '/')
                    break;
                else
                    unput(c);
                }
            }
        }

{number}    std::cout << "number " << YYText() << '\n';

\n      mylineno++;

{name}      std::cout << "name " << YYText() << '\n';

{string}    std::cout << "string " << YYText() << '\n';

%%

extern "C" {
    int yylex() {return 0;}
}

#include <fstream>

int main( int argc, const char *argv[]) {
    if (argc < 2) {
        fprintf(stderr, "Need an argument\n");
        return 1;
    }
    std::ifstream ifs(argv[1]);
    FlexLexer *lexer = new yyFlexLexer(ifs, std::cout);
    while(lexer->yylex() != 0)
        ;
    return 0;
    }

Trying to build with:

$ mkdir build && cd build
$ conan install ..
$ cmake .. -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_C_COMPILER=gcc-10
$ cmake --build .

The build fails with this message:

flex: fatal internal error, exec of m4 failed
buckfullingham commented 4 months ago

+1