Building ANTLR runtime on Linux fails with an error - No package 'uuid' found

1,519 views
Skip to first unread message

Karthik Gunasekaran

unread,
Mar 1, 2021, 2:55:19 PM3/1/21
to antlr-discussion
Hi, 

I have a Debian GNU/Linux 9.3 (stretch) machine.


and tried building the ANTLR runtime using:

The build displayed the following error:
Found PkgConfig: /usr/bin/pkg-config (found version "0.29") 
-- Checking for module 'uuid'
--   No package 'uuid' found
CMake Error at /usr/share/cmake-3.7/Modules/FindPkgConfig.cmake:415 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-3.7/Modules/FindPkgConfig.cmake:588 (_pkg_check_modules_internal)
  CMakeLists.txt:44 (pkg_check_modules)

I removed the line:
pkg_check_modules(UUID REQUIRED uuid)

and then the Makefile was generated without any issues. I was then able to generate the runtime using the Makefile. But received a warning for a missing UUID target due to the dependencies:

target_link_libraries(antlr4_shared ${UUID_LIBRARIES}) 
target_link_libraries(antlr4_static ${UUID_LIBRARIES})

in:

What is the UUID package that it requires? Is it this package?

Why does the ANTLR runtime use UUID? Is this just a build time dependency?

Regards,
Karthik

Mike Lischke

unread,
Mar 2, 2021, 3:47:17 AM3/2/21
to 'rtm...@googlemail.com' via antlr-discussion
Hi Karthik,



What is the UUID package that it requires? Is it this package?

Why does the ANTLR runtime use UUID? Is this just a build time dependency?

ANTLR4 marks features in the serialised ATN with UUIDs. And processing them requires some UUID code. In the runtime I have used the Guid class from Graeme Hill, which uses different approaches depending on the platform it is used on. For Linux it uses the uuid lib, for Android JNI, on Windows COM etc.

See also runtime/support/guid.cpp.


Karthik Gunasekaran

unread,
Mar 2, 2021, 7:06:42 PM3/2/21
to antlr-di...@googlegroups.com
Hi Mike,

Thanks for your reply.

Cmake did not find uuid on my Linux machine.

The required header file '#include <uuid/uuid.h>' belongs to the 'libuuid' library(https://linux.die.net/man/3/libuuid) and on my machine the library has this name:
>> ldconfig -p | grep libuuid

libuuid.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libuuid.so.1
libuuid.so.1 (libc6) => /lib/i386-linux-gnu/libuuid.so.1

 So, I replaced the lines in:

find_package(PkgConfig REQUIRED)
pkg_check_modules(UUID REQUIRED uuid)

with

 find_library(UUID_LIBRARY libuuid.so.1)

and:
target_link_libraries(antlr4_static ${UUID_LIBRARIES})
target_link_libraries(antlr4_shared ${UUID_LIBRARIES})

 in with:

target_link_libraries(antlr4_static ${UUID_LIBRARY})
target_link_libraries(antlr4_shared ${UUID_LIBRARY})

to build the runtime from the source files.

 I couldn't figure out a way to get the cmake command: 

pkg_check_modules(UUID REQUIRED uuid)

 working on my machine.

Does this look correct to you?

Regards,
Karthik

--
You received this message because you are subscribed to a topic in the Google Groups "antlr-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antlr-discussion/8mgirwEo5c0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antlr-discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/antlr-discussion/968A3047-CE4E-48E4-A729-4BAF40AEA9A5%40googlemail.com.

Mike Lischke

unread,
Mar 3, 2021, 2:38:28 AM3/3/21
to 'rtm...@googlemail.com' via antlr-discussion
Cmake did not find uuid on my Linux machine.

The required header file '#include <uuid/uuid.h>' belongs to the 'libuuid' library(https://linux.die.net/man/3/libuuid) and on my machine the library has this name:
>> ldconfig -p | grep libuuid

libuuid.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libuuid.so.1
libuuid.so.1 (libc6) => /lib/i386-linux-gnu/libuuid.so.1

 So, I replaced the lines in:

find_package(PkgConfig REQUIRED)
pkg_check_modules(UUID REQUIRED uuid)

with

 find_library(UUID_LIBRARY libuuid.so.1)

and:
target_link_libraries(antlr4_static ${UUID_LIBRARIES})
target_link_libraries(antlr4_shared ${UUID_LIBRARIES})

 in with:

target_link_libraries(antlr4_static ${UUID_LIBRARY})
target_link_libraries(antlr4_shared ${UUID_LIBRARY})

to build the runtime from the source files.

 I couldn't figure out a way to get the cmake command: 

pkg_check_modules(UUID REQUIRED uuid)

 working on my machine.

Does this look correct to you?

I have no clue about cmake, but I guess if it works for you it's probably fine :-)

What's interesting here is whether this is a specific issue of your box or a general problem with the cmake file(s)? If the latter then we should probably fix it in the ANTLR4 repo.


Karthik Gunasekaran

unread,
Mar 3, 2021, 2:40:57 PM3/3/21
to antlr-di...@googlegroups.com

What's interesting here is whether this is a specific issue of your box or a general problem with the cmake file(s)? 


--- My guess is that there is some cmake configuration missing in the github project that is causing this issue. But I might be wrong.


I came across this link that suggests using find_library instead of find_package for finding libuuid with cmake as well. So, I will be using this for now.



Regards,

Karthik

 


--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/antlr-discussion/80CE8A55-6C0C-48B7-B9D8-FA39A474AC32%40googlemail.com.

Karthik Gunasekaran

unread,
Mar 3, 2021, 5:55:32 PM3/3/21
to antlr-di...@googlegroups.com
ANTLR runtime build with the provided configuration requires:
https://packages.debian.org/stretch/amd64/uuid-dev/filelist

which was missing on my Debian machine. 

I installed uuid-dev and the line:

pkg_check_modules(UUID REQUIRED uuid)

found the required uuid module. Without installing uuid-dev, I had to link against the libuuid1 library:


with find_library. 


Regards,
Karthik

Gene Weber

unread,
Nov 23, 2021, 9:50:40 AM11/23/21
to antlr-discussion
Hi,

Just want to let you know that I had the same problem as Karthik. I'm running Linux CentOS 7. 

The uuid_devel library was installed:  sudo yum install uuid-devel-1.6.2-26.el7.x86_64.rpm

But "cmake .. -DANTLR_JAR_LOCATION=/home/antlr4/antlr4/antlr-4.9.3-complete.jar" gives the following error message:
  -- Checking for module 'uuid'
  --   No package 'uuid' found
  CMake Error at /usr/local/share/cmake-3.20/Modules/FindPkgConfig.cmake:556 (message):
    A required package was not found

I used Karthik's suggested edits (thank you), and they appear to have worked since the demo compiles and runs without any errors or warnings.

Best,

Gene

Michal Widera

unread,
Nov 24, 2021, 6:26:48 PM11/24/21
to antlr-discussion
Reply all
Reply to author
Forward
0 new messages