当前位置: 首页 > wzjs >正文

wordpress grace 下载浙江seo博客

wordpress grace 下载,浙江seo博客,如何做网站搜索引擎优化,网站建设项目竞争性招标文件linux下编译arm64可执行程序 一.gn ninja安装二.交叉编译工具链安装1.arm交叉编译工具2.安装arm64编译器 三. gn文件添加arm及arm64工具链四.编译验证 本文以gn nijia安装中demo为例,将其编译为在arm64(rk_3568_a开发板)环境下可运行的程序 一.gn ninja安装 安装g…

linux下编译arm64可执行程序

  • 一.gn ninja安装
  • 二.交叉编译工具链安装
    • 1.arm交叉编译工具
    • 2.安装arm64编译器
  • 三. gn文件添加arm及arm64工具链
  • 四.编译验证

本文以gn nijia安装中demo为例,将其编译为在arm64(rk_3568_a开发板)环境下可运行的程序

一.gn ninja安装

安装gn ninja,参考文章gn nijia安装

二.交叉编译工具链安装

1.arm交叉编译工具

arm交叉编译工具链为: arm-linux-gnueabihf,官网有编译好的二进制文件,直接下载解压即可

1.创建目录存放下载的文件

mkdir ~/linux/tools&&cd ~/linux/tools

2.下载交叉编译链 gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz

wget https://releases.linaro.org/components/toolchain/binaries/4.9-2017.01/arm-linux-gnueabihf/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz

3./usr/local下创建目录并将其解压到该目录下

sudo mkdir /usr/local/arm&&sudo tar -vxf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz -C /usr/local/arm

4.配置环境变量

sudo vim ~/.bashr

在最下面添加一行

export PATH=$PATH:/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin

环境变量立即生效

source ~/.bashrc

5.安装其他库

sudo apt-get install lsb-core lib32stdc++6

6.查看安装是否成功

arm-linux-gnueabihf-gcc -v

输出

ubuntu:~/Downloads/gn_test$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/../libexec/gcc/arm-linux-gnueabihf/4.9.4/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: /home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/snapshots/gcc-linaro-4.9-2017.01/configure SHELL=/bin/bash --with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libmudflap --enable-lto --enable-objc-gc --enable-shared --without-included-gettext --enable-nls --disable-sjlj-exceptions --enable-gnu-unique-object --enable-linker-build-id --disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu --enable-libstdcxx-debug --enable-long-long --with-cloog=no --with-ppl=no --with-isl=no --disable-multilib --with-float=hard --with-mode=thumb --with-tune=cortex-a9 --with-arch=armv7-a --with-fpu=vfpv3-d16 --enable-threads=posix --enable-multiarch --enable-libstdcxx-time=yes --with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/_build/sysroots/arm-linux-gnueabihf --with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu/arm-linux-gnueabihf/libc --enable-checking=release --disable-bootstrap --enable-languages=c,c++,fortran,lto --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=arm-linux-gnueabihf --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu
Thread model: posix
gcc version 4.9.4 (Linaro GCC 4.9-2017.01)

2.安装arm64编译器

步骤与安装arm编译链相同
1.创建目录存放下载的文件并进入

mkdir ~/linux/tools&&cd ~/linux/tools

2.下载交叉编译链 gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz

wget https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz

3./usr/local下创建目录并将其解压到该目录下

sudo mkdir /usr/local/arm64&&sudo tar -vxf gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz -C /usr/local/arm

4.配置环境变量

sudo vim ~/.bashr

在最下面添加一行

export PATH=$PATH:/usr/local/arm64gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin

环境变量立即生效

source ~/.bashrc

5.验证是否安装成功

ubuntu:~/linux/tools$ aarch64-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/local/arm64/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/../libexec/gcc/aarch64-linux-gnu/7.5.0/lto-wrapper
Target: aarch64-linux-gnu
Configured with: '/home/tcwg-buildslave/workspace/tcwg-make-release_0/snapshots/gcc.git~linaro-7.5-2019.12/configure' SHELL=/bin/bash --with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libmudflap --enable-lto --enable-shared --without-included-gettext --enable-nls --with-system-zlib --disable-sjlj-exceptions --enable-gnu-unique-object --enable-linker-build-id --disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu --enable-libstdcxx-debug --enable-long-long --with-cloog=no --with-ppl=no --with-isl=no --disable-multilib --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 --with-arch=armv8-a --enable-threads=posix --enable-multiarch --enable-libstdcxx-time=yes --enable-gnu-indirect-function --with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/sysroots/aarch64-linux-gnu --with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu/aarch64-linux-gnu/libc --enable-checking=release --disable-bootstrap --enable-languages=c,c++,fortran,lto --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=aarch64-linux-gnu --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu
Thread model: posix
gcc version 7.5.0 (Linaro GCC 7.5-2019.12)

三. gn文件添加arm及arm64工具链

修改gn nijia安装中的toolchain目录下的BUILD.gn文件
修改为下面内容

toolchain("arm") {toolprefix = "arm-linux-gnueabihf-"cc = "${toolprefix}gcc"cxx = "${toolprefix}g++"ar = "${toolprefix}ar"
#    #ld = cxx
#    #readelf = "${toolprefix}readelf"
#    #nm = "${toolprefix}nm"
#
#    toolchain_args = {
#      current_cpu = "arm"
#      current_os = "linux"
#      is_clang = false
#    }tool("cc") {depfile = ".d"command = "${cc} -MMD -MF $depfile -c {{source}} -o {{output}}"depsformat = "gcc"description = "CXX"outputs = ["{{target_output_name}}.{{source_name_part}}.o",]}tool("cxx") {depfile = ".d"command = "${cxx} -MMD -MF $depfile -c {{source}} -o {{output}}"depsformat = "gcc"description = "CXX"outputs = ["{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",]}tool("link") {outfile = "{{output_dir}}/bin/{{target_output_name}}{{output_extension}}"rspfile = "{{output}}.rsp"command = "${cxx} -o $outfile @$rspfile"description = "LINK $outfile"rspfile_content = "{{inputs}}"outputs = [outfile,]default_output_dir = "{{root_out_dir}}"}tool("solink") {soname = ""sofile = "/$soname"rspfile = "{{output}}.rsp"command = "${cxx} -shared -o $sofile -Wl, -soname=$soname @$rspfile"description = "SOLINK $soname"rspfile_content = "{{inputs}}"outputs = [sofile,]default_output_extension = ".so"default_output_dir = ""link_output = sofiledepend_output = sofileoutput_prefix = "lib"}tool("alink") {rspfile = "{{output}}.rsp"command = "${ar} rcs {{output}} @\"$rspfile\""description = "AR"rspfile_content = "{{inputs}}"outputs = ["{{target_out_dir}}/{{target_output_name}}{{output_extension}}",]default_output_extension = ".a"output_prefix = "lib"}}toolchain("arm64") {toolprefix = "aarch64-linux-gnu-"cc = "${toolprefix}gcc"cxx = "${toolprefix}g++"ar = "${toolprefix}ar"#ld = cxx#readelf = "${toolprefix}readelf"#nm = "${toolprefix}nm"#toolchain_args = {#  current_cpu = "arm64"#  current_os = "linux"#  is_clang = false#}tool("cc") {depfile = ".d"command = "${cc} -MMD -MF $depfile -c {{source}} -o {{output}}"depsformat = "gcc"description = "CXX"outputs = ["{{target_output_name}}.{{source_name_part}}.o",]}tool("cxx") {depfile = ".d"command = "${cxx} -MMD -MF $depfile -c {{source}} -o {{output}}"depsformat = "gcc"description = "CXX"outputs = ["{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",]}tool("link") {outfile = "{{output_dir}}/bin/{{target_output_name}}{{output_extension}}"rspfile = "{{output}}.rsp"command = "${cxx} -o $outfile @$rspfile"description = "LINK $outfile"rspfile_content = "{{ldflags}} {{inputs}}"outputs = [outfile,]default_output_dir = "{{root_out_dir}}"}tool("solink") {soname = ""sofile = "/$soname"rspfile = "{{output}}.rsp"command = "${cxx} -shared -o $sofile -Wl, -soname=$soname @$rspfile"description = "SOLINK $soname"rspfile_content = "{{ldflags}} {{inputs}}"outputs = [sofile,]default_output_extension = ".so"default_output_dir = ""link_output = sofiledepend_output = sofileoutput_prefix = "lib"}tool("alink") {rspfile = "{{output}}.rsp"command = "${ar} rcs {{output}} @\"$rspfile\""description = "AR"rspfile_content = "{{inputs}}"outputs = ["{{target_out_dir}}/{{target_output_name}}{{output_extension}}",]default_output_extension = ".a"output_prefix = "lib"}}

修改BUILDCONFIG.gn文件,将工具链指向arm64

set_default_toolchain("//build/toolchain:arm64")

修改与main.cc同目录下的BUILD.gn文件,使用静态编译,避免链接器不同导致的无法执行问题

# 声明一个可执行文件目标
executable("hello") {# 源文件列表sources = [ "main.cc" ]# 编译选项(可选)cflags = ["-Wall","-Werror",]# 链接选项(可选)ldflags = [ "-static"]
}

四.编译验证

在main.cc所在目录下执行如下命令

gn gen out/arm64 --args='target_cpu="arm64"'
ninja -v -C out/arm64/

生成的目标文件位于out/arm64/bin目录下
file查看该文件属性

@ubuntu:~/Downloads/gn_test$ file out/arm64/bin/hello
out/arm64/bin/hello: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.7.0, BuildID[sha1]=2e4c0e468fd229cb5875041d4afb5a529cd41206, with debug_info, not stripped

将该文件推送到arm64环境下,添加可执行权限并执行

# chmod a+x hello
# ./hello
Hello, World!

成功运行

参考:
https://www.jianshu.com/p/5d762cca83a0
https://blog.csdn.net/p1279030826/article/details/105021536


文章转载自:

http://FoGBwmAW.xbyyd.cn
http://8FOyI98e.xbyyd.cn
http://8QftuOOC.xbyyd.cn
http://RBKKHveF.xbyyd.cn
http://eW2u7gmu.xbyyd.cn
http://qJycmBHM.xbyyd.cn
http://UmfbOM3u.xbyyd.cn
http://5acbGaIc.xbyyd.cn
http://u3k9dPAe.xbyyd.cn
http://6WNHn9Z4.xbyyd.cn
http://OiJe8eNq.xbyyd.cn
http://0vkGQDIv.xbyyd.cn
http://wI8JCUOc.xbyyd.cn
http://SIscvKnK.xbyyd.cn
http://rSQO6lBf.xbyyd.cn
http://J6I4sxIl.xbyyd.cn
http://3t8eGSlr.xbyyd.cn
http://a3IDntP3.xbyyd.cn
http://qj0med91.xbyyd.cn
http://AwNaxYtK.xbyyd.cn
http://CW6nDLd6.xbyyd.cn
http://RKIFJuwR.xbyyd.cn
http://lCdfitgy.xbyyd.cn
http://BoLXUukR.xbyyd.cn
http://72k3QhGh.xbyyd.cn
http://baYfW6g1.xbyyd.cn
http://fLix7Ucd.xbyyd.cn
http://De6loR9B.xbyyd.cn
http://hfWBsyWG.xbyyd.cn
http://GnzcLLlO.xbyyd.cn
http://www.dtcms.com/wzjs/763946.html

相关文章:

  • 网站icp备案查询截图重庆企业seo网络推广外包
  • 上传文档网站开发建设运营平台网站的方法
  • 1920的网站做字体大小企业网站维护怎么做
  • 重庆大良网站建设用ps制作海报教程方法步骤
  • 房屋网在线seo
  • 推荐几个安全没封的网站2021深圳专业网站建设企
  • 仿魔酷阁网站源码网页游戏传奇世界网页版
  • 广西建设培训中心网站2021百度新算法优化
  • 贵阳网站建设托管物联网设计方案
  • 宁陵视频网站建设贵阳网站seo
  • 做动画的网站有哪些QQ点钓鱼网站后怎么做
  • 四会建设局网站织梦设置中英文网站
  • 黄岐建网站网页设计基础知识点总结
  • 太原商城网站建设wordpress新闻直播系统
  • 做网站练手项目前端wordpress后端python
  • 自建网站做电商800元做网站
  • 获取网站访客qq号兰州北山生态建设局网站
  • 只用html5可以做网站吗武安建设局网站
  • 原型图网站做网站运营需要做哪些
  • 好看的学校网站模板免费下载discuz做网站
  • 设计师应该知道的网站支付宝网站开发流程
  • 怎么自己做单页网站织梦后台网站栏目空白
  • 江西省建设协会网站门户wordpress主题下载
  • 苏州沧浪区做网站的盐城网站开发市场
  • 做个什么样的网站比较好企业网站报价
  • 湖南北山建设集团股份有限公司官方网站西安 网站建设 培训学校
  • 专业的网站建设网络周口网站优化
  • 网站关键字优化技巧小程序定制 seo营销
  • 钱宝网站怎么做任务做网站如何把栏目放到首页
  • 网站开发项目方案书2017织梦网站怎么做seo