VPU library - user project linkage fail

cancel
Showing results for 
Search instead for 
Did you mean: 

VPU library - user project linkage fail

Jump to solution
1,182 Views
petersuciu
Contributor III

Hello,

I want to build a simple C file, where I try to initialize the VPU on my imx6Q.

The sysroot has been obtained via Yocto and bitbake (latest dora branch), poky toolchain version @ 1.5.3.

My code is:

----------------------------------

#include <vpu_io.h>

#include <vpu_lib.h>

void func(void)

{

    int ret = 0, i;

    // Init VPU

    if(vpu_Init (NULL) < 0)

   {

        printf(">> failed to call vpu_Init()\n");

        ret = -1;

    }

}

-----------------------------------

full GCC command:

----------------------------------

arm-poky-linux-gnueabi-g++  -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/home/raziel/Programming/SDKs/poky/1.5.3/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi -DHAVE_CONFIG_H -I. -I. -I..   --sysroot=/home/raziel/Programming/Workspace/Yocto/build/tmp/sysroots/nitrogen6x -I/home/raziel/Programming/Workspace/Yocto/build/tmp/sysroots/nitrogen6x/usr/include -I/home/raziel/Programming/Workspace/Yocto/build/tmp/sysroots/nitrogen6x/usr/src/kernel/include -fpermissive -g -O0  --sysroot=/home/raziel/Programming/Workspace/Yocto/build/tmp/sysroots/nitrogen6x -MT video_test.o -MD -MP -MF .deps/video_test.Tpo -c -o video_test.o video_test.cpp

arm-poky-linux-gnueabi-libtool --tag=CXX   --mode=link arm-poky-linux-gnueabi-g++  -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/home/raziel/Programming/SDKs/poky/1.5.3/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi -I/home/raziel/Programming/Workspace/Yocto/build/tmp/sysroots/nitrogen6x/usr/include -I/home/raziel/Programming/Workspace/Yocto/build/tmp/sysroots/nitrogen6x/usr/src/kernel/include -fpermissive -g -O0  --sysroot=/home/raziel/Programming/Workspace/Yocto/build/tmp/sysroots/nitrogen6x -lvpu --sysroot=/home/raziel/Programming/Workspace/Yocto/build/tmp/sysroots/nitrogen6x -o video_test

--------------------------------------

I am specifying -lvpu as an argument to GCC, except that libtool complains:

undefined reference to 'vpu_Init(void*)'

I fail to see what the issue is, given the fact that GCC finds the library just fine.

Manually specifying the full path to libvpu.a or libvpu.so from the Yocto sysroot dir lead to the same result, undefined reference.

What am I doing wrong?

Labels (4)
Tags (2)
0 Kudos
1 Solution
77 Views
petersuciu
Contributor III

Wrap the #include directive of vpu library headers inside extern "C".

new code:

extern "C"

{

#include <vpu_io.h>

#include <vpu_lib.h>

}

void func(void)

{

    int ret = 0, i;

    // Init VPU

    if(vpu_Init (NULL) < 0)

   {

        printf(">> failed to call vpu_Init()\n");

        ret = -1;

    }

}

this is because vpu library code is C compliant and I was using a C++ compiler to include a C generated library.

View solution in original post

0 Kudos
2 Replies
78 Views
petersuciu
Contributor III

Wrap the #include directive of vpu library headers inside extern "C".

new code:

extern "C"

{

#include <vpu_io.h>

#include <vpu_lib.h>

}

void func(void)

{

    int ret = 0, i;

    // Init VPU

    if(vpu_Init (NULL) < 0)

   {

        printf(">> failed to call vpu_Init()\n");

        ret = -1;

    }

}

this is because vpu library code is C compliant and I was using a C++ compiler to include a C generated library.

View solution in original post

0 Kudos
77 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

Thank you for sharing your solution. It is very appreciated.

Best Regards,

Alejandro

0 Kudos