Metaswitch / project-clearwater-issues

Issue list for Project Clearwater
0 stars 1 forks source link

Error building FreeDiameter on Debian 8 #22

Open jenkins-clearwater opened 7 years ago

jenkins-clearwater commented 7 years ago

[geoffroya]

Hello

I try to compile FreeDiameter on a freshly installed Debian Jessy. I installed all the dependencies described in INSTALL.Ubuntu During the make, I have the following error:

[  0%] Built target version_information
[ 14%] Built target libfdproto
[ 15%] Building C object libfdcore/CMakeFiles/libfdcore.dir/p_ce.c.o
In file included from /home/user/freeDiameter/libfdcore/fdcore-internal.h:41:0,
                 from /home/user/freeDiameter/libfdcore/p_ce.c:36:
/home/user/freeDiameter/libfdcore/p_ce.c: In function ‘add_CE_info’:
/home/user/freeDiameter/build/include/freeDiameter/freeDiameter-host.h:96:22: error: ‘FD_PROJECT_VENDOR_ID’ undeclared (first use in this function)
 #define MY_VENDOR_ID FD_PROJECT_VENDOR_ID
                      ^
/home/user/freeDiameter/libfdcore/p_ce.c:135:12: note: in expansion of macro ‘MY_VENDOR_ID’
  val.u32 = MY_VENDOR_ID;
            ^
/home/user/freeDiameter/build/include/freeDiameter/freeDiameter-host.h:96:22: note: each undeclared identifier is reported only once for each function it appears in
 #define MY_VENDOR_ID FD_PROJECT_VENDOR_ID
                      ^
/home/user/freeDiameter/libfdcore/p_ce.c:135:12: note: in expansion of macro ‘MY_VENDOR_ID’
  val.u32 = MY_VENDOR_ID;
            ^
libfdcore/CMakeFiles/libfdcore.dir/build.make:365: recipe for target 'libfdcore/CMakeFiles/libfdcore.dir/p_ce.c.o' failed
make[2]: *** [libfdcore/CMakeFiles/libfdcore.dir/p_ce.c.o] Error 1
CMakeFiles/Makefile2:1040: recipe for target 'libfdcore/CMakeFiles/libfdcore.dir/all' failed
make[1]: *** [libfdcore/CMakeFiles/libfdcore.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

When searching for the FD_PROJECT_ID macro, I find this:

~/freeDiameter/build$ find ../ -name "*.*" -type f -exec grep FD_PROJECT_VENDOR_ID {} \; -print
FD_PROJECT_VENDOR_ID:STRING=0
../build/CMakeCache.txt
/* #undef FD_PROJECT_VENDOR_ID */
#define MY_VENDOR_ID FD_PROJECT_VENDOR_ID
../build/include/freeDiameter/freeDiameter-host.h
#cmakedefine FD_PROJECT_VENDOR_ID @FD_PROJECT_VENDOR_ID@
#define MY_VENDOR_ID FD_PROJECT_VENDOR_ID
../include/freeDiameter/freeDiameter-host.h.in
SET(FD_PROJECT_VENDOR_ID 0 CACHE STRING "Project vendor ID")
../CMakeLists.txt

Thank you for your help.

Regards,

Geoff

[Used to be https://github.com/Metaswitch/freeDiameter/issues/28]

jenkins-clearwater commented 7 years ago

[geoffroya]

Actually, it seems the problme comes from a wrong use of the #cmakedefine for the FD_PROJECT_VENDOR_ID variable.

As it is set to 0 in CMakeLists.txt:

SET(FD_PROJECT_VENDOR_ID 0 CACHE STRING "Project vendor ID")

It has to be written like this in the header file include/freeDiameter/freeDiameter-host.h.in:

#cmakedefine01 FD_PROJECT_VENDOR_ID

Here's the diff:

diff --git a/include/freeDiameter/freeDiameter-host.h.in b/include/freeDiameter/freeDiameter-host.h.in
index d89b3f0..c6667e8 100644
--- a/include/freeDiameter/freeDiameter-host.h.in
+++ b/include/freeDiameter/freeDiameter-host.h.in
@@ -92,7 +92,8 @@ extern "C" {
 #cmakedefine DEFAULT_CONF_PATH "@DEFAULT_CONF_PATH@"
 #cmakedefine DEFAULT_EXTENSIONS_PATH "@DEFAULT_EXTENSIONS_PATH@"

-#cmakedefine FD_PROJECT_VENDOR_ID @FD_PROJECT_VENDOR_ID@
+/* #cmakedefine FD_PROJECT_VENDOR_ID @FD_PROJECT_VENDOR_ID@ */
+#cmakedefine01 FD_PROJECT_VENDOR_ID
 #define MY_VENDOR_ID FD_PROJECT_VENDOR_ID

 #ifndef FD_DEFAULT_CONF_FILENAME
jenkins-clearwater commented 7 years ago

[mirw]

Thanks for raising this, and sorry for the delay in replying.

I think the reason we haven't seen this is that we always set the FD_PROJECT_VENDOR_ID variable. This is actually a fork of the freeDiameter codebase specifically for the Project Clearwater IMS core - if you're looking for the master freeDiameter code, it's in mercurial at http://www.freediameter.net/hg/freeDiameter.

Having said that, I think you're right that this is a bug, and I'll look at fixing it.

jenkins-clearwater commented 7 years ago

[quentusrex]

To clarify for anyone else who hits this the steps to build without hitting this issue are: mkdir build && cd build cmake -DFD_PROJECT_VENDOR_ID=1234 ../

Specify your own project vendor id instead of 1234.

nchaigne commented 6 years ago

I've had the issue also. You might want to explicit that this is a fork, not the official freeDiameter repository. This statement on GitHub is misleading:

Git mirror of freeDiameter from http://www.freediameter.net/

(https://github.com/Metaswitch/freeDiameter)