question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

C++ runtime demo fails to build

See original GitHub issue

In the current state of the master branch (dd623ec), the C++ runtime demo fails to build:

$ cd <snip>/runtime/Cpp
$ mkdir build && mkdir run && cd build
$ cmake .. -DANTLR_JAR_LOCATION=<snip>/antlr-4.9.3-complete.jar -DWITH_DEMO=True
$ make
...
[ 97%] Building CXX object demo/CMakeFiles/antlr4-demo.dir/Linux/main.cpp.o
In file included from /home/felix/src/antlr4/runtime/Cpp/demo/Linux/main.cpp:16:
/home/felix/src/antlr4/runtime/Cpp/demo/generated/TLexer.h:57:43: error: ‘virtual const std::vector<std::__cxx11::basic_string<char> >& antlrcpptest::TLexer::getTokenNames() const’ marked ‘override’, but does not override
   57 |   virtual const std::vector<std::string>& getTokenNames() const override; // deprecated, use vocabulary instead
      |                                           ^~~~~~~~~~~~~
In file included from /home/felix/src/antlr4/runtime/Cpp/demo/Linux/main.cpp:17:
/home/felix/src/antlr4/runtime/Cpp/demo/generated/TParser.h:44:43: error: ‘virtual const std::vector<std::__cxx11::basic_string<char> >& antlrcpptest::TParser::getTokenNames() const’ marked ‘override’, but does not override
   44 |   virtual const std::vector<std::string>& getTokenNames() const override { return _tokenNames; }; // deprecated: use vocabulary instead.
      |                                           ^~~~~~~~~~~~~
make[2]: *** [demo/CMakeFiles/antlr4-demo.dir/build.make:97: demo/CMakeFiles/antlr4-demo.dir/Linux/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:414: demo/CMakeFiles/antlr4-demo.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

There’s also a new warning:

[ 12%] Building CXX object runtime/CMakeFiles/antlr4_shared.dir/src/Vocabulary.cpp.o
/home/felix/src/antlr4/runtime/Cpp/runtime/src/Vocabulary.cpp: In static member function ‘static void antlr4::dfa::Vocabulary::__static_initialization_and_destruction_0(int, int)’:
/home/felix/src/antlr4/runtime/Cpp/runtime/src/Vocabulary.cpp:12:18: warning: ‘antlr4::dfa::Vocabulary::EMPTY_VOCABULARY’ is deprecated: Use the default constructor of Vocabulary instead. [-Wdeprecated-declarations]
   12 | const Vocabulary Vocabulary::EMPTY_VOCABULARY;
      |                  ^~~~~~~~~~
/home/felix/src/antlr4/runtime/Cpp/runtime/src/Vocabulary.cpp:12:18: note: declared here

@jcking / @mike-lischke - I’m naively assuming this is related to one of your recent PRs. Could you please take a look? I haven’t spent the time to narrow down when exactly the error was introduced, but I can if you want me to.

Versions:

-- The C compiler identification is GNU 11.2.1
-- The CXX compiler identification is GNU 11.2.1

$ gcc --version
gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7)

$ java --version
openjdk 11.0.13 2021-10-19
OpenJDK Runtime Environment 18.9 (build 11.0.13+8)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8, mixed mode, sharing)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
jepperaskdkcommented, Apr 16, 2022

Probably not related, but I got this error when running with the CMakeLists.txt in the README:

terminate called after throwing an instance of 'std::system_error'
  what():  Unknown error -1
Aborted

I had to add:

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
...
target_link_libraries(demo Threads::Threads)
1reaction
jepperaskdkcommented, Apr 16, 2022

@jepperaskdk Thanks for the info. I have a ton of those errors while updating the build for 4.10 in github.com/antlr/grammars-v4.

I was only able to find that because I enabled debugging with set(CMAKE_CXX_FLAGS "-g") and stepped through the code. So I guess that’s also useful to include - but this is also my first CPP project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ANLTR4 Cpp demo fails to run because of a __gthread problem
I have compiled ANTLR4 runtime in a VirtualBox Ubuntu 20.04, with g++ 9.4.0. I want to learn how to integrate the ANTLR tool...
Read more >
Fix Microsoft Visual C++ Runtime Library Assertion Failed ...
How to Fix Adobe Microsoft Visual C++ Runtime Library Assertion Failed Vulcanadapter.cc Error on Windows 10/11Step 1) Install Visual C++ ...
Read more >
ARM Runtime Library does not build automatically - TI E2E
Hi, We have tried to change Code Generation Tools for Sitara from V5.0.5 to V5.2.5. At the end of the rebuild the linker...
Read more >
Upgrade in C++ runtime from 14.25.28610 to 14.27.29110 ...
Chromium compile error when I upgraded vs2019 windows from 16.5 to 16.7. ... error: expected ')' C:\Program Files (x86)\Microsoft Visual ...
Read more >
Difference between Compile Time Errors and Runtime Errors ...
Difference between Compile Time Errors and Runtime Errors in C Program - Error or exception is something that refers to the interruption of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found