首页 > 其他分享 >x86 docker 20.04 交叉编译 jetson xavier nx 20.04

x86 docker 20.04 交叉编译 jetson xavier nx 20.04

时间:2024-08-29 10:37:14浏览次数:3  
标签:用户名 cmake x86 straight CrossCompileTest nx CCTest jetson 20.04

前文: https://www.cnblogs.com/odesey/p/18381407

1. jetson 和 x86 交叉编译

https://developer.nvidia.com/embedded/jetson-linux-r3541, 下载:Bootlin Toolchain gcc 9.3

解压得到,并创建文件夹:

/home/用户名/docker_workspace/mycrosscompile/Bootlin-Toolchain-gcc-9.3

在 mycrosscompile 创建一个文件夹 CrossCompileTest。

vim main.cpp
#include <iostream>

int main(int, char**) {
    std::cout << "Hello, world!\n";
}

1.1 直接使用gcc指令编译c或者cpp文件

交叉编译工具使用的本质就是将原有 g++ 使用的x86_64-linux-gnu指定为交叉工具里的aarch64-linux-gnu

(base) ➜  CrossCompileTest ../Bootlin-Toolchain-gcc-9.3/bin/aarch64-buildroot-linux-gnu-g++ main.cpp -o CCTest-straight
(base) ➜  CrossCompileTest ls   
CCTest-straight  main.cpp
(base) ➜  CrossCompileTest ./CCTest-straight
qemu-aarch64-static: Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory

# 传输到 jetson 设备上面:
(base) ➜  CrossCompileTest scp CCTest-straight 用户名@ip地址:/ssd/workspace/
用户名@ip地址's password: 
CCTest-straight                                          100% 9544    89.0KB/s   00:00

在 jetson 设备上:

用户名@ubuntu:/ssd/workspace$ ./CCTest-straight
Hello, world!

1.2 使用 cmake 编译

vim CMakeLists.txt
cmake_minimum_required(VERSION 3.0.0)
project(CCTest VERSION 0.1.0)

add_executable(CCTest main.cpp)
mkdir build && cd build 
cmake  -DCMAKE_TOOLCHAIN_FILE=/home/h/docker_workspace/mycrosscompile/Bootlin-Toolchain-gcc-9.3/share/buildroot/toolchainfile.cmake .. 
make
ls
CCTest  CMakeCache.txt  CMakeFiles  cmake_install.cmake  Makefile

# 传输到 jetson 设备上面:
(base) ➜  CrossCompileTest scp CCTest 用户名@ip地址:/ssd/workspace/
用户名@ip地址's password: 
CCTest                                          100% 9544    89.0KB/s   00:00

在 jetson 设备上:

用户名@ubuntu:/ssd/workspace$ ./CCTest
Hello, world!

参考:

  1. https://zhuanlan.zhihu.com/p/627218667
  2. https://blog.csdn.net/qq_25776687/article/details/135653087

待实践:

  1. https://www.cnblogs.com/sherlock-lin/p/15916143.html

标签:用户名,cmake,x86,straight,CrossCompileTest,nx,CCTest,jetson,20.04
From: https://www.cnblogs.com/odesey/p/18384052

相关文章

  • nginx rewrite模块之if和return
    ngx_http_rewrite_module将用户请求的URI基于PCREregex所描述的模式进行检查,而后完成重定向替换 if:Syntax: if(condition){...}Default: —Context: server,location条件满足时,执行配置块中的配置指令condition:比较操作符: =相同!=不同 ......
  • nginx之http跳转https
    http跳转https实现示例:ssl配置参考“https”实现文章法一:2个虚拟主机配置:[[email protected]]#vim/apps/nginx4/conf/conf.d/test.confserver{listen443ssl;#listen80;server_namewww.magedu.org;root/data/site14/;......
  • nginx rewrite模块之rewrite
    未完成ngx_http_rewrite_module rewriteregexreplacement[flag]将用户请求的URI基于regex所描述的模式进行检查,匹配到时将其替换为replacement指定的新的URI注意:如果在同一级配置块中存在多个rewrite规则,那么会自下而下逐个检查;被某条件规则替换完成后,会重新一轮......
  • nginx之错误url重定向到首页
    nginx之错误url重定向到首页1、配置:[[email protected]~]#vitest.confserver{listen443ssl;listen80;server_namewww.magedu.org;root/data/site14/;#sslon;ssl_certificate/apps/nginx4/ssl/magedu.org.crt;......
  • nginx扩展之支持多个ssl加密虚拟主机
    nginx支持一台服务器唯一IP:PORT,根据server_name创建区分多个经过ssl加密的https虚拟主机,apache不支持 生成www.magedu.net域名证书:[[email protected]]#cd/etc/pki/tls/certs/[[email protected]]#vimMakefile%.key:umask77;\#/usr/bin/ope......
  • nginx共享资源站点
    配置nginx文件下载服务模块:ngx_http_autoindex_module常用指令:autoindexon|off;自动文件索引功能,默为offDefault: autoindexoff;Context: http,server,locationautoindex_exact_sizeon|off;计算文件确切大小(单位bytes),off显示大概大小(单位K、M),默......
  • nginx基于用户的访问控制
    ngx_http_auth_basic_module模块 实现基于用户的访问控制,使用basic机制进行用户认证auth_basicstring|off;auth_basic_user_filefile;Default: —Context: http,server,location,limit_exceptlocation/admin/{ auth_basic"AdminArea"......
  • nginx日志格式
    ngx_http_log_modulengx_http_log_module模块指定日志格式记录请求log_formatnamestring...;string可以使用nginx核心模块及其它模块内嵌的变量Default:log_formatcombined"...";Context: httpaccess_logpath[format[buffer=size][gzip[=level]......
  • nginx第三方模块echo和变量
    第三方模块:echo第三模块是对nginx的功能扩展,第三方模块需要在编译安装nginx的时候使用参数--add-module=PATH指定路径添加,有的模块是由公司的开发人员针对业务需求定制开发的,有的模块是开源爱好者开发好之后上传到github进行开源的模块,nginx支持第三方模块,需要重新编译源码......
  • nginx输出nginx的基本状态信息
    输出nginx的基本状态信息模块:ngx_http_stub_status_module输出信息示例:Activeconnections:291server   accepts  handled  requests#下面三个数分别对应accepts,handled,requests      166309481663094831070465Reading:6Writing:179Wait......