VPU library - user project linkage fail

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

VPU library - user project linkage fail

ソリューションへジャンプ
2,784件の閲覧回数
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?

ラベル(4)
タグ(2)
0 件の賞賛
返信
1 解決策
1,679件の閲覧回数
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.

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,680件の閲覧回数
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.

0 件の賞賛
返信
1,679件の閲覧回数
alejandrolozan1
NXP Employee
NXP Employee

Hi,

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

Best Regards,

Alejandro

0 件の賞賛
返信