简体   繁体   English

适用于ARM的ALSA库和交叉编译

[英]ALSA Library and Cross Compiling for ARM

I'm trying to make an "C" application for my NXP(Freescale) imx6 that Debian OS installed on it. 我正在尝试为Debian OS上安装的NXP(Freescale)imx6创建一个“ C”应用程序。 My host machine is Ubuntu 16.04. 我的主机是Ubuntu 16.04。 I'm using eclipse as an IDE and I can manage to cross compile until today. 我使用eclipse作为IDE,直到今天我都可以进行交叉编译。 I use arm-linux-gnueabihf-gcc as an compiler and arm-linux-gnueabihf-ld as an linker. 我将arm-linux-gnueabihf-gcc用作编译器,将arm-linux-gnueabihf-ld用作链接器。 I added -lasound option to my linker parameter, but still can not build the application. 我在链接器参数中添加了-lasound选项,但仍无法构建该应用程序。 I get an error 我得到一个错误

arm-linux-gnueabihf-ld: cannot find -lasound arm-linux-gnueabihf-ld:找不到-lasound

I think I don't have the libasound.so file on my Ubuntu (Host) machine and my linker couldn't link to library to my application. 我认为我的Ubuntu(主机)计算机上没有libasound.so文件,而且链接程序无法将库链接到应用程序。

I copied the libasound.so file from my ARM machine to my host machine to the /home/user/Downloads folder, but still couldn't compile. 我将libasound.so文件从我的ARM机器复制到了主机,再复制到了/home/user/Downloads文件夹,但是仍然无法编译。

Is there a step to use ALSA library in Cross Compilation project before build? 在构建之前,有没有步骤在交叉编译项目中使用ALSA库?

Here is the output of build operation 这是构建操作的输出

Building target: tihc_linux_application
Invoking: GCC C Linker
/usr/bin/arm-linux-gnueabihf-ld -static -L/home/user/Downloads -pthread -lasound -o "main"  ./src/main.o   
/usr/bin/arm-linux-gnueabihf-ld: mode armelf_linux_eabi
/usr/bin/arm-linux-gnueabihf-ld: cannot find -lasound

You ask for static link (via -static ) but provide shared library so ld probably ignores it (to be sure you can run with -Wl,--verbose ). 您要求静态链接(通过-static ),但提供共享库,因此ld可能会忽略它(确保可以使用-Wl,--verbose来运行)。 One option is to cross-compile libalsa from scratch and then use resulting static lib to link your app. 一种选择是从头开始交叉编译libalsa,然后使用生成的静态lib链接您的应用程序。 Another option is to search for pre-compiled gnueabihf libalsa somewhere... 另一种选择是在某处搜索预编译的gnueabihf libalsa ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM