Skip to content

Compile Issues #1

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

Closed
mgwoo opened this issue Jan 8, 2019 · 4 comments
Closed

Compile Issues #1

mgwoo opened this issue Jan 8, 2019 · 4 comments

Comments

@mgwoo
Copy link
Collaborator

mgwoo commented Jan 8, 2019

Thanks for really great work!
I've found two compile issues regarding with this Verilog parser.

  1. Flex 2.5.37 is compile-able, but flex 2.6.4 generated compile error.
    Below command,

     $ flex -o ./verilog_lexer.yy.cc parser-verilog/verilog_lexer.l 
    

    the verilog_lexer.yy.cc from Flex 2.5.37 is working for me, but the verilog_lexer.yy.cc from Flex 2.6.4 generated compile error.
    I've attached compiled verilog_lexer_yy.cc file just in case.
    ( Compile environment: Centos 7 / GCC 8.2.0 )
    verilog_lexer.zip

  2. The below command was working in my environments.

     $ g++ -std=c++17 -I./ -Iparser-verilog/ verilog_parser.tab.cc verilog_lexer.yy.cc example/sample_parser.cpp -o sample_parser -lstdc++fs
    
@clin99
Copy link
Collaborator

clin99 commented Jan 9, 2019

Hi @mgwoo , thanks for reporting this issue!
I just build the flex-2.6.4 retrieved from flex repo and use this flex to compile the verilog_lexer.l :

$ flex -o ./verilog_lexer.yy.cc parser-verilog/verilog_lexer.l

I didn't get any compilation error. Here is the generated verilog_lexer.yy.cc file https://github.com/OpenTimer/Parser-Verilog/files/2738877/verilog_lexer.yy.cc.zip

This file is the same as your lexer file by flex-2.6.4. The following command also works using the generated lexer file:

$ g++ -std=c++17 -I./ -Iparser-verilog/ verilog_parser.tab.cc verilog_lexer.yy.cc example/sample_parser.cpp -o sample_parser -lstdc++fs

I try both gcc-7.4 & 8.1 and both work.

Could you please provide the compilation error messages so I can dig into this further?

Thanks!

@mgwoo
Copy link
Collaborator Author

mgwoo commented Jan 9, 2019

Thanks for the quick response.
I've attached the log file of this.

compile_error.log
(If you could use $ cat compile_error.log in the Linux, you may see the colored logs)

Could you check this?

@clin99
Copy link
Collaborator

clin99 commented Jan 9, 2019

Hi @mgwoo , I have checked the log file and I think the problem is caused by the out-of-sync Flex package. This stackoverflow post reports a compilation error message similar to your log file. To verify this, I suggest you build the latest Flex package from source code. Please follow below steps to build the Flex binary:

First download the source code flex-2.6.4.tar.gz from the official repo and then

$ tar zxvf flex-2.6.4.tar.gz
$ cd flex-2.6.4
$ ./autogen.sh
$ mkdir build
$ ./configure --prefix=absolute_path_to_the_build_folder
$ make 
$ make install

Above steps will only install the Flex binary inside flex-2.6.4 folder and no root permission required.
If you didn't see any error in those steps, you can find the Flex binary inside the flex-2.6.4/build/bin folder. Then you can use the Flex binary to compile the lexer file

flex-2.6.4/build/bin/flex -o ./verilog_lexer.yy.cc parser-verilog/verilog_lexer.l 

If you get the same compilation error, please let me know.

Note: you can clear the built Flex package by removing the flex-2.6.4 folder.

Thanks!

@mgwoo
Copy link
Collaborator Author

mgwoo commented Jan 9, 2019

Thank you for pointing out this problem...!
I added one additional -I/path/to/the/FlexLexer-2.6.4.h/folder command in g++ and it worked.
Sorry for confusing. I'll close this issue.

@mgwoo mgwoo closed this as completed Jan 9, 2019
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

No branches or pull requests

2 participants