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

Bench File Reading Error #73

Closed
utdael opened this issue Mar 26, 2022 · 4 comments
Closed

Bench File Reading Error #73

utdael opened this issue Mar 26, 2022 · 4 comments

Comments

@utdael
Copy link

utdael commented Mar 26, 2022

How do you run a bench file with lorina? Do you have to run it to read the bench file line by line? We downloaded the lorina library and are trying to run it to read the bench file and it isn't working. The bench files we are trying to read are found here. http://www.pld.ttu.ee/~maksim/benchmarks/iscas85/bench/
Thank you.

@hriener
Copy link
Owner

hriener commented Mar 27, 2022

Hello utdael,

I would run lorina as follows to parse a bench file:

#include <lorina/lorina.hpp>
#include <iostream>

int main()
{
  using namespace lorina;
  bench_reader reader;
  text_diagnostics consumer;
  diagnostic_engine diag( &consumer );

  if ( read_bench( "c432.bench", reader, &diag ) == return_code::success )
  {
    std::cout << "parsing successful" << std::endl;
  }
  else
  {
    std::cout << "parsing failed" << std::endl;
  }
}

On my system, this approach seems to be able to read all of Maksim's benchmarks.

What do you mean by "it isn't working"? Do you see a specific error message?

Edit: I should point out that lorina is a C++ library. It provides you with API to read bench files, but you still have to implement an executable that calls the API to process the file(s).

Best,
Heinz

@utdael
Copy link
Author

utdael commented Mar 28, 2022

Thank you for the quick response.
My main problem is compiling and running lorina on one of our cpp files in a linux environment. At the moment, we cloned the github in the same folder as our cpp file.
We attempted to compile it using gcc bench.cpp in one of the screenshots attached.

ErrorMessage

However, we get an error that says "no such file or directory" for the #include <lorina/lorina.hpp> library.

LibraryLorina

How can I go about compiling this design?

@hriener
Copy link
Owner

hriener commented Mar 28, 2022

lorina uses CMake as a build system.

Try the following steps:

$ git clone git@github.com:hriener/lorina.git
Cloning into 'lorina'...
[...]
$ cd lorina
$ mkdir build
$ cd build
$ cmake .. -DLORINA_EXAMPLES=ON
-- The CXX compiler identification is ...
[...]
$ make
[ 50%] Building CXX object examples/CMakeFiles/pretty_print.dir/pretty_print.cpp.o
[100%] Linking CXX executable pretty_print
[100%] Built target pretty_print
$ ./example/pretty_print PATH_TO_YOUR_BENCH_FILE

Two more notes:

  • You may have to install cmake and make on your system first. You will notice if you see error messages saying that cmake or make is not a valid command.
  • All files ending with .cpp in the directory examples will be automatically build. Each time you add a new example, you have to run cmake again in the build directory. Each time you change one of the .cpp files, you have to run make again in the build directory.

@hriener
Copy link
Owner

hriener commented Apr 4, 2022

Seems to be resolved.

If not, then the issue can be re-opened...

@hriener hriener closed this as completed Apr 4, 2022
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