[Xen-devel] Xen 4.4 & 4.5 - Various problems (mostly undefined references to libxenctrl functions)

2015-09-11 Thread Sébastien Frémal
Hello,

I'm working with Xen to develop new communication modules to improve data
transfer between xen domains. As I had a really old version of Xen
(installed in 2012 !!) and some functionnalities didn't work (sharing
already allocated pages with grant references), I reinstalled my entire
system (new linux, new xen). Therefore, I installed Ubuntu LTS 14.04 and
the xen hypervisor coming with its packages (xen 4.4). I had no problem to
create a virtual machine, but when I tried to compile the test program
which uses my modules, the battle began. Here is my compilation line :

gcc gntring3_read_async.c
/home/fremals/GVirtus9/modules/gntring/libgntring4.o -lxenctrl -o
ring3_read_async -lm -I /home/fremals/GVirtus9/modules/

libgntring4.o contains the code using libxenctrl : xc_interface_open,
xc_map_foreign_pages and xc_interface_close. With Xen 4.4, I had no problem
to compile libgntring.o, but when I tried to compile ring3_read_async, I
got the message error :
libgntring4.c:(.text+0x328): undefined reference to «
xc_interface_open(xentoollog_logger*, xentoollog_logger*, unsigned int) »
libgntring4.c:(.text+0x328): undefined reference to «
xc_map_foreign_pages(arg list) »
libgntring4.c:(.text+0x365): undefined reference to «
xc_interface_close(xc_interface_core*) »

I checked libxenctrl.so with nm and it was empty. However, libxenctrl.a had
all needed symbols. I tried again with the following command line :
gcc gntring3_read_async.c
/home/fremals/GVirtus9/modules/gntring/libgntring4.o
/usr/local/lib/libxenctrl.a -o ring3_read_async -lm -I
/home/fremals/GVirtus9/modules/
and the compilation fails with only two errors :
libgntring4.c:(.text+0x328): undefined reference to «
xc_interface_open(xentoollog_logger*, xentoollog_logger*, unsigned int) »
libgntring4.c:(.text+0x365): undefined reference to «
xc_interface_close(xc_interface_core*) »
It found the xc_map_foreign_pages ! But not the other two functions. I
thought that there could be a problem with libxenctrl, I therefore
downloaded the xen source code and tried to compile the code of this tool
but I had errors with xen headers (I didn't kept the errors).

At this point, I wanted to do things right and reinstall Xen from source
code, not with an ubuntu package. I removed Xen 4.4 and took Xen 4.5.1. As
I rapidly got an error with this code (I don't remind which one), I used
Xen 4.5 instead. Once I succesfully installed xen, I tried to run my
compilation again. This time with -lxenctrl. I had the same problem than
before :
libgntring4.c:(.text+0x328): undefined reference to «
xc_interface_open(xentoollog_logger*, xentoollog_logger*, unsigned int) »
libgntring4.c:(.text+0x365): undefined reference to «
xc_interface_close(xc_interface_core*) »

To check that previous steps were all right, I tried to recompile
libgntring4.o and it lead to new errors :
g++ -c -O3 -fPIC ../modules/gntring/libgntring4.c -o
../modules/gntring/libgntring4.o
In file included from /usr/local/include/xenctrl.h:50:0,
 from ../modules/gntring/libgntring4.c:12:
/usr/local/include/xen/platform.h:156:31: error: field ‘set_time’ has
incomplete type
 struct xenpf_efi_time set_time;
   ^
/usr/local/include/xen/platform.h:160:31: error: field ‘get_wakeup_time’
has incomplete type
 struct xenpf_efi_time get_wakeup_time;
   ^
/usr/local/include/xen/platform.h:164:31: error: field ‘set_wakeup_time’
has incomplete type
 struct xenpf_efi_time set_wakeup_time;
   ^
/usr/local/include/xen/platform.h:184:35: error: field ‘vendor_guid’ has
incomplete type
 struct xenpf_efi_guid vendor_guid;
   ^
make: *** [libgntring4.o] Erreur 1

I talked to some members of my team about the "unefined reference"
problems, but no one knows what's the problem. Can I ask if someone have an
idea of what's wrong here please ?

Best regards,

Sebastien Fremal
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [BUG] xenctrl.h : error with xc_error_code declaration

2015-09-10 Thread Sébastien Frémal
Hello,

I just write to signal a bug and its solution. I installed the 14.04 LTS
ubuntu version and installed the xen version through synaptic. As I'm
developping modules for Xen I also installed the xen dev package. The
installed Xen version is 4.4.2.

I tried to compile one of my C files including xenctrl.h but I got the
following errors :
In file included from ../modules/gntring/libgntring4.c:12:0:
/usr/include/xenctrl.h:122:14: error: use of enum ‘xc_error_code’ without
previous declaration
 typedef enum xc_error_code xc_error_code;
  ^
/usr/include/xenctrl.h:122:41: error: invalid type in declaration before
‘;’ token
 typedef enum xc_error_code xc_error_code;
 ^
/usr/include/xenctrl.h:1759:6: error: using typedef-name ‘xc_error_code’
after ‘enum’
 enum xc_error_code {
  ^
/usr/include/xenctrl.h:122:28: note: ‘xc_error_code’ has a previous
declaration here
 typedef enum xc_error_code xc_error_code;
^
/usr/include/xenctrl.h:1770:8: error: using typedef-name ‘xc_error_code’
after ‘enum’
   enum xc_error_code code;
^
/usr/include/xenctrl.h:122:28: note: ‘xc_error_code’ has a previous
declaration here
 typedef enum xc_error_code xc_error_code;




I looked at xenctrl.h and the typedef is put before the declaration of the
enum :

typedef enum xc_error_code xc_error_code;

...

enum xc_error_code {
  XC_ERROR_NONE = 0,
  XC_INTERNAL_ERROR = 1,
  XC_INVALID_KERNEL = 2,
  XC_INVALID_PARAM = 3,
  XC_OUT_OF_MEMORY = 4,
  /* new codes need to be added to xc_error_level_to_desc too */
};




I swapped the two declarations and that works just fine :

enum xc_error_code {
  XC_ERROR_NONE = 0,
  XC_INTERNAL_ERROR = 1,
  XC_INVALID_KERNEL = 2,
  XC_INVALID_PARAM = 3,
  XC_OUT_OF_MEMORY = 4,
  /* new codes need to be added to xc_error_level_to_desc too */
};

typedef enum xc_error_code xc_error_code;




Best regards,

Sebastien Fremal
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel