[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] Probs compiling nbd-2.9.24 on CentOS 6.0, 64bit - undefined reference to `g_key_file_get_int64'



On Thu, Nov 03, 2011 at 09:07:31PM +0100, Daniel Schwager wrote:
> Hi Wouter,
> 
> I tried to compile the current nbd 2.9.24 on
> a centos 6.0, 64bit system and get the following error:
> 
> [root@...956... /opt/nbd-2.9.24/src/nbd-2.9.24]$ make install
> ....
> make[1]: Entering directory `/opt/nbd-2.9.24/src/nbd-2.9.24'
> gcc -std=gnu99 -g -O2 -I/usr/include/glib-2.0
> -I/usr/lib64/glib-2.0/include   -g -O2   -o nbd-server
> nbd_server-nbd-server.o -lglib-2.0   
> nbd_server-nbd-server.o: In function `parse_cfile':
> /opt/nbd-2.9.24/src/nbd-2.9.24/nbd-server.c:911: undefined reference to
> `g_key_file_get_int64'
> collect2: ld returned 1 exit status
> make[1]: *** [nbd-server] Error 1
> 
> The current installed glib's are 
> glibc-headers-2.12-1.7.el6_0.5.x86_64
> glib2-2.22.5-5.el6.x86_64

You need glib2 2.26 or higher for the get_int64 call. You may need to
upgrade.

Alternatively, you can apply the following patch:

diff --git a/nbd-server.c b/nbd-server.c
index afb82de..4f2b1f2 100644
--- a/nbd-server.c
+++ b/nbd-server.c
@@ -899,6 +899,7 @@ GArray* parse_cfile(gchar* f, bool have_global, GError** e) {
 			g_assert(p[j].ptype==PARAM_INT||p[j].ptype==PARAM_STRING||p[j].ptype==PARAM_BOOL||p[j].ptype==PARAM_INT64);
 			switch(p[j].ptype) {
 				case PARAM_INT:
+				case PARAM_INT64:
 					ival = g_key_file_get_integer(cfile,
 								groups[i],
 								p[j].paramname,
@@ -907,15 +908,6 @@ GArray* parse_cfile(gchar* f, bool have_global, GError** e) {
 						*((gint*)p[j].target) = ival;
 					}
 					break;
-				case PARAM_INT64:
-					i64val = g_key_file_get_int64(cfile,
-								groups[i],
-								p[j].paramname,
-								&err);
-					if(!err) {
-						*((gint64*)p[j].target) = i64val;
-					}
-					break;
 				case PARAM_STRING:
 					sval = g_key_file_get_string(cfile,
 								groups[i],

but note that if you do this, the 'filesize' config file parameter will
not function correctly.

-- 
The volume of a pizza of thickness a and radius z can be described by
the following formula:

pi zz a



Reply to: