Building Orthanc 1.5.6 on FreeBSD 12

Dears,

I tried to build Orthanc on my FreeBSD machine, but I faced an error related to linking to “uuid” library :

Switching to C++11 standard in gcc/clang, as version of JsonCpp is >= 1.0.0
– Looking for uuid/uuid.h
– Looking for uuid/uuid.h - found
– Looking for uuid_generate_random in uuid
– Looking for uuid_generate_random in uuid - not found
CMake Error at Resources/CMake/UuidConfiguration.cmake:119 (message):
Unable to find the uuid library
Call Stack (most recent call first):
Resources/CMake/OrthancFrameworkConfiguration.cmake:421 (include)
CMakeLists.txt:49 (include)

/usr/bin/cc -I/usr/local/include
-DCHECK_FUNCTION_EXISTS=uuid_generate_random
CMakeFiles/cmTC_7e17b.dir/CheckFunctionExists.c.o -o cmTC_7e17b -luuid
/usr/bin/ld: error: unable to find library -luuid

I’m pretty sure that I’ve “e2fsprogs-libuuid” package installed before building.
Tried to clean up the Build directory and build again but still failed.

Any help will be appreciated. Thanks.

Dear Hadi,

I’ve been through this and patched the [ORTHANC-SRC-ROOT]/Resources/CMake/UuidConfiguration.cmake

Here’s the fix, it should be applied at about line 117:

    IF( CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" )
      FIND_LIBRARY( LIBUUID uuid "/usr/local/lib" )
    ELSE()
      FIND_LIBRARY( LIBUUID uuid "/usr/lib" )
    ENDIF()

To be clear, the file is basically a if-wi dows-else-xnix-systems, you’ll want this fix to be applied in the else section.

What’s happens is FreeBSD installs most of its libraries in /use/local for as opposed to Linux usually doing it at /usr.

To be technically precise, this patch works on 1.5.5 but I see no reason for it not to work on the latest version.

Let me know if it helps. Should you need further assistance, just hit reply!

Best,
Luiz

Hello Luiz,

Thanks for the reply, I think your solution is actually correct.

I’ve modified “UuidConfiguration.cmake” file according to your suggestion:

111 else()
112 CHECK_INCLUDE_FILE(uuid/uuid.h HAVE_UUID_H)
113 if (NOT HAVE_UUID_H)
114 message(FATAL_ERROR “Please install uuid-dev, e2fsprogs (OpenBSD) or e2fsprogs-libuuid (FreeBSD)”)
115 endif()
116
117 IF( CMAKE_SYSTEM_NAME STREQUAL “FreeBSD” )
118 FIND_LIBRARY( LIBUUID uuid “/usr/local/lib” )
119 ELSE()
120 FIND_LIBRARY( LIBUUID uuid “/usr/lib” )
121 ENDIF()
122
123 check_library_exists(uuid uuid_generate_random “” HAVE_UUID_LIB)
124 if (NOT HAVE_UUID_LIB)
125 message(FATAL_ERROR “Unable to find the uuid library”)
126 endif()

But I still receive same errors.

Here it is where the uuid librray is located:

$ ls -ltr /usr/local/lib/libuuid*
-r-xr-xr-x 1 root wheel 16536 Dec 25 04:41 /usr/local/lib/libuuid.so.1.2
lrwxr-xr-x 1 root wheel 14 Dec 25 04:41 /usr/local/lib/libuuid.so.1 → libuuid.so.1.2
lrwxr-xr-x 1 root wheel 12 Dec 25 04:41 /usr/local/lib/libuuid.so → libuuid.so.1
-r–r–r-- 1 root wheel 26740 Dec 25 04:41 /usr/local/lib/libuuid.a

I didn’t know the reply went off the group. Tis why I’m replying and cc’ing the group. Anyways, glad to know it worked!

:heart:

Hello,

Thanks for pointing this issue. It is now fixed by the following changeset:
https://bitbucket.org/sjodogne/orthanc/commits/9c8e119d0c5b48a4b23872d6295399938d07979b

Sébastien-