交叉编译过程中遇到fatal error: xxx.h: No such file or directory compilation terminated.

交叉编译过程中遇到fatal error: seccomp.h或者ltdl.h: No such file or directory compilation terminated.

  • 在x86容器中进行交叉编译arm单板的程序

在x86容器中进行交叉编译arm单板的程序

  • 在环境centos8 镜像中进行编译
  • 在交叉编译过程中,出现fatal error: seccomp.h: No such file or directory compilation terminated.
    fatal error:ltdl.h: No such file or directory compilation terminated.
    等问题,尝试过网上许多方法,都没有解决。最后找人帮忙看的:
    在x86环境下用的arm的工具链,编译过程中提示许多库不存在,可能存在的原因是相关的动态链接库不兼容,类似会报incompatible这样的错误。我的解决办法:直接去github或者pkg.org网站下载相关源码,然后用对应的gcc工具链进行编译安装
  • 下载上述必要依赖库后(进入到源码文件下)进行编译并安装
编译:
> ./configure \
--host=arm-linux \
--enable-shared \
--disable-static \
CC=/usr/local/x86_64_gcc/bin/x86_64-pc-linux-gnu-gcc \
CFLAGS=-fPIC \
--prefix=/usr/local/x86_64_gcc/x86_64-pc-linux-gnu
安装:
> make -j4 && make install
  • 工具链我选择采用的拿来主义。且我们代码包含go、cgo

你可能感兴趣的:(bash,arm,golang)