OpenVZ Forum


Home » Mailing lists » Devel » linking with vzctl library
linking with vzctl library [message #12248] Sun, 22 April 2007 22:50 Go to next message
Standa Kunc is currently offline  Standa Kunc
Messages: 3
Registered: April 2007
Junior Member
Hello,

I would like to link my C program with vzctl library to be able to
start and stop virtual machines.

My question is the same as Mateus Baur had, see
http://forum.openvz.org/index.php?t=msg&goto=10586&# msg_10586

Error message:
/usr/lib/libvzctl-0.0.2.so: undefined reference to `g_log'
collect2: ld returned 1 exit status

How should I link it properly?

Thank you in advance
S. Kunc
Re: linking with vzctl library [message #12259 is a reply to message #12248] Mon, 23 April 2007 10:02 Go to previous messageGo to next message
ldv is currently offline  ldv
Messages: 24
Registered: June 2006
Junior Member
Hi,

On Mon, Apr 23, 2007 at 12:50:19AM +0200, Standa Kunc wrote:
> I would like to link my C program with vzctl library to be able to
> start and stop virtual machines.
>
> My question is the same as Mateus Baur had, see
> http://forum.openvz.org/index.php?t=msg&goto=10586&# msg_10586
>
> Error message:
> /usr/lib/libvzctl-0.0.2.so: undefined reference to `g_log'
> collect2: ld returned 1 exit status

The question I had to ask here long time ago: why g_log symbol is not
provided by the library? Asking every client to provide the g_log
structure just to link executable does not look wise.
JFYI, I had to move the g_log symbol to the library in the ALT's vzctl
package, otherwise clients won't link with -Wl,--as-needed at all.


--
ldv
Re: linking with vzctl library [message #12263 is a reply to message #12259] Mon, 23 April 2007 13:06 Go to previous messageGo to next message
Standa Kunc is currently offline  Standa Kunc
Messages: 3
Registered: April 2007
Junior Member
Dmitry,

would you mind to describe me you workaround?

I compile with -l/usr/lib/libvzctl-0.0.2.so. Should I include some
header file (which)? And where should I add g_log structure?

Thank you in advance
S. Kunc

On 23/04/07, Dmitry V. Levin <ldv@altlinux.org> wrote:
> Hi,
>
> On Mon, Apr 23, 2007 at 12:50:19AM +0200, Standa Kunc wrote:
> > I would like to link my C program with vzctl library to be able to
> > start and stop virtual machines.
> >
> > My question is the same as Mateus Baur had, see
> > http://forum.openvz.org/index.php?t=msg&goto=10586&# msg_10586
> >
> > Error message:
> > /usr/lib/libvzctl-0.0.2.so: undefined reference to `g_log'
> > collect2: ld returned 1 exit status
>
> The question I had to ask here long time ago: why g_log symbol is not
> provided by the library? Asking every client to provide the g_log
> structure just to link executable does not look wise.
> JFYI, I had to move the g_log symbol to the library in the ALT's vzctl
> package, otherwise clients won't link with -Wl,--as-needed at all.
>
>
> --
> ldv
>
Re: linking with vzctl library [message #12264 is a reply to message #12263] Mon, 23 April 2007 14:34 Go to previous messageGo to next message
ldv is currently offline  ldv
Messages: 24
Registered: June 2006
Junior Member
On Mon, Apr 23, 2007 at 03:06:15PM +0200, Standa Kunc wrote:
> Dmitry,
>
> would you mind to describe me you workaround?

My workaround is library fix, you probably don't want to follow this way
yet.

> I compile with -l/usr/lib/libvzctl-0.0.2.so. Should I include some
> header file (which)? And where should I add g_log structure?

Include logger.h and add
LOG_DATA
line to your client source.


--
ldv
Re: linking with vzctl library [message #12269 is a reply to message #12248] Mon, 23 April 2007 17:43 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

current libvzctl imho is brain damaged as it was never actually been designed properly.
after the licensing question will be resolved I think it will be greately reworked.
If you still want to give it a try then follow Dmitry Levin recommendations.

Thanks,
Kirill

Standa Kunc wrote:
> Hello,
>
> I would like to link my C program with vzctl library to be able to
> start and stop virtual machines.
>
> My question is the same as Mateus Baur had, see
> http://forum.openvz.org/index.php?t=msg&goto=10586&# msg_10586
>
> Error message:
> /usr/lib/libvzctl-0.0.2.so: undefined reference to `g_log'
> collect2: ld returned 1 exit status
>
> How should I link it properly?
>
> Thank you in advance
> S. Kunc
>
Re: linking with vzctl library [message #12276 is a reply to message #12264] Mon, 23 April 2007 23:10 Go to previous message
Standa Kunc is currently offline  Standa Kunc
Messages: 3
Registered: April 2007
Junior Member
Thank you Dmitry, now I am able to use libvzctl.

Is it possible to link libvzctl without access to openvz source code?

Is there or are there header files installed in system path which
provide all needed declarations?

Something simple like math library for C language?
#include <math.h>
cc mathprog.c -o mathprog -lm

I will need it eventually.

Best regards,
S. Kunc



On 23/04/07, Dmitry V. Levin <ldv@altlinux.org> wrote:
> On Mon, Apr 23, 2007 at 03:06:15PM +0200, Standa Kunc wrote:
> > Dmitry,
> >
> > would you mind to describe me you workaround?
>
> My workaround is library fix, you probably don't want to follow this way
> yet.
>
> > I compile with -l/usr/lib/libvzctl-0.0.2.so. Should I include some
> > header file (which)? And where should I add g_log structure?
>
> Include logger.h and add
> LOG_DATA
> line to your client source.
>
>
> --
> ldv
>
Previous Topic: mailing list settings removes From: ?
Next Topic: [PATCH -mm] utrace: fix double free re __rcu_process_callbacks()
Goto Forum:
  


Current Time: Fri Oct 18 14:01:10 GMT 2024

Total time taken to generate the page: 0.05018 seconds