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

Error when compiling #52

Open
vanhauser-thc opened this issue Jun 23, 2024 · 5 comments
Open

Error when compiling #52

vanhauser-thc opened this issue Jun 23, 2024 · 5 comments

Comments

@vanhauser-thc
Copy link

I try to follow the example commands from the README with the supplied LUA grammar, but building polyglot fails:

$ cmake -DCMAKE_BUILD_TYPE=Release -Bbuild -G Ninja -DBUILD_TESTING=OFF -DGRAMMAR_FILE=grammars/lua/Lua.g4
...
LEXER_NAME: Lua
PARSER_NAME: Lua
-- Configuring done
-- Generating done
-- Build files have been written to: /PolyGlot/build

$ ninja -C build
ninja: Entering directory `build'
ninja: error: '../srcs/antlr/grammars/lua/Lua.g4', needed by 'srcs/antlr/generated/LuaBaseListener.cpp', missing and no known rule to make it

what am I doing wrong?

@Changochen
Copy link
Member

Sorry about the confusion. You need to specify the full absolute path for the grammar file, please try:

cmake -DCMAKE_BUILD_TYPE=Release -Bbuild -G Ninja -DBUILD_TESTING=OFF -DGRAMMAR_FILE=`pwd`/grammars/lua/Lua.g4

instead.

@vanhauser-thc
Copy link
Author

Thanks, yes this makes it work!

Now that I have built Polyglot I try to fuzz mruby, but apparently not much is happening:

AFL_DISABLE_TRIM=1 AFL_FAST_CAL=1 AFL_CUSTOM_MUTATOR_ONLY=1 POLYGLOT_CONFIG=/PolyGlot/grammars/ruby/semantic.yml AFL_CUSTOM_MUTATOR_LIBRARY=/PolyGlot/build/libpolyglot_mutator.so afl-fuzz -i /mruby/test/t -o /share/out-polyglot -- /mruby/bin/mruby @@

image

@Changochen
Copy link
Member

Is it not running or not finding new paths? Could you try build/corpus_evaluate --corpus_dir your_corpus to see whether you have a good corpus?

@vanhauser-thc
Copy link
Author

vanhauser-thc commented Jun 27, 2024

Hmm I get this:

/PolyGlot (main) # build/corpus_evaluate --corpus_dir grammars/ruby/corpus/
Unparsable files: (TOTAL42 )
grammars/ruby/corpus/float.rb
[...]
grammars/ruby/corpus/basicobject.rb
Missing types in corpus: 
statement
args
program
val
sntart

the corpus directory has 42 files and it lists all files as unparsable (these files are the mruby test files)

for completeness, this is the grammars/ruby/semantic.yml file:

---
__comments: ''
InitFileDir: grammars/ruby/corpus/
BuiltinObjFile: ''
IsWeakType: true
SyntaxOnly: true
BasicTypes:
  - ANYTYPE

@Changochen
Copy link
Member

The semantic files are not related. Unparsable means the corpus files are not accepted by the grammar. Would you confirm that whether the g4 file is correct? Like, if you build a antlr parser on it, does it parse the corpus file?

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