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

企业网站的建立要做的准备营销软文200字

企业网站的建立要做的准备,营销软文200字,免费ppt模板下载医学类,班级网页模板html源码文章目录 VScode clangd 插件浏览 linux 源码clangd 安装与配置VScode 插件安装clangd 安装方法一方法二 clangd 配置 cmake 生成bear 生成 compile_commands.json触发 clangd linux 内核脚本生成 compile_commands.json 文件三种方式对比 VScode clangd 插件浏览 linux 源码 …

文章目录

  • VScode clangd 插件浏览 linux 源码
    • clangd 安装与配置
      • VScode 插件安装
      • clangd 安装
        • 方法一
        • 方法二
      • clangd 配置
    • cmake 生成
    • bear 生成 `compile_commands.json`
      • 触发 clangd
    • linux 内核脚本生成 `compile_commands.json` 文件
    • 三种方式对比

VScode clangd 插件浏览 linux 源码

VScode clangd 插件浏览代码却决于 compile_commands.json 文件
生成该文件有很多种方法

  • bear 命令
  • linux 内核脚本
  • cmake 编译选项

clangd 安装与配置

VScode 插件安装

在 VScode 插件商城搜索安装即可

clangd 安装

方法一

插件下载好之后任意打开一个 C/CPP 文件,vscode 下方会出现弹窗直接 install 即可(若网络原因或其他原因这里一直下载不出来请参考方式二)
在这里插入图片描述

方法二

从GitHub上下载 clangd-language,网址:https://githubfast.com/clangd/clangd/releases/
在这里插入图片描述
选择适合自己的即可,解压之后需要告诉 VScode 你的 clangd 的地址

Ctrl + , 打开配置,输入 clangd
在这里插入图片描述
输入自己的 path 即可(如果是方法一这里会自动填充)

/home/tyustli/.vscode-server/data/User/globalStorage/llvm-vs-code-extensions.vscode-clangd/install/16.0.2/clangd_16.0.2/bin/clangd

clangd 配置

由于 clangd 插件和 c/c++ 插件会存在冲突,在 ./vscode/settings.json 文件中添加下面一行配置,将 C/C++ 功能禁止掉

"C_Cpp.intelliSenseEngine": "disabled",

cmake 生成

cmake工程生成 compile_commands.json 文件比较简单,定义 CMAKE_EXPORT_COMPILE_COMMANDS 即可。

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1

bear 生成 compile_commands.json

不过很多工程都是用 Makefile 来编译的,例如 linux 内核,没有现成的选项生成 compile_commands.json 文件。我们可以通过 bear 来生成。

bear 生成之前需要确保没有编译过,或者 make clean 一下,否则生成的文件是空的!!!

安装 bear

sudo apt-get install bear

使用 bear -- make 编译(之前的命令是 bear make)

编译 linux 内核生成

export ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf-   # 设置编译平台和工具链
make vexpress_defconfig                                 # 加载板子的配置信息
make dtbs                                               # 编译设备树
bear -- make -j8                                                # 编译内核

生成之后将 /usr/bin/gcc 全局搜索替换为自己工具链路径 /home/tyustli/cross_tool/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-gcc

生成的部分 compile_commands.json 文件如下

  {"arguments": ["/home/tyustli/cross_tool/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-gcc","-Wp,-MMD,scripts/mod/.empty.o.d","-nostdinc","-I./arch/arm/include","-I./arch/arm/include/generated","-I./include","-I./arch/arm/include/uapi","-I./arch/arm/include/generated/uapi","-I./include/uapi","-I./include/generated/uapi","-include","./include/linux/compiler-version.h","-include","./include/linux/kconfig.h","-include","./include/linux/compiler_types.h","-D__KERNEL__","-mlittle-endian","-D__LINUX_ARM_ARCH__=7","-fmacro-prefix-map=./=","-std=gnu11","-fshort-wchar","-funsigned-char","-fno-common","-fno-PIE","-fno-strict-aliasing","-Wall","-Wundef","-Werror=implicit-function-declaration","-Werror=implicit-int","-Werror=return-type","-Werror=strict-prototypes","-Wno-format-security","-Wno-trigraphs","-fno-dwarf2-cfi-asm","-mno-fdpic","-fno-ipa-sra","-mtp=cp15","-mabi=aapcs-linux","-mfpu=vfp","-funwind-tables","-marm","-Wa,-mno-warn-deprecated","-march=armv7-a","-msoft-float","-Uarm","-fno-delete-null-pointer-checks","-Wno-frame-address","-Wno-format-truncation","-Wno-format-overflow","-Wno-address-of-packed-member","-O2","-fno-allow-store-data-races","-Wframe-larger-than=1024","-fstack-protector-strong","-Wno-main","-Wno-unused-but-set-variable","-Wno-unused-const-variable","-fomit-frame-pointer","-fno-stack-clash-protection","-Wvla","-Wno-pointer-sign","-Wcast-function-type","-Wno-stringop-truncation","-Wno-stringop-overflow","-Wno-restrict","-Wno-maybe-uninitialized","-Wno-alloc-size-larger-than","-Wimplicit-fallthrough=5","-fno-strict-overflow","-fno-stack-check","-fconserve-stack","-Werror=date-time","-Werror=incompatible-pointer-types","-Werror=designated-init","-Wno-packed-not-aligned","-g","-fplugin=./scripts/gcc-plugins/arm_ssp_per_task_plugin.so","-DKBUILD_MODFILE=\"scripts/mod/empty\"","-DKBUILD_BASENAME=\"empty\"","-DKBUILD_MODNAME=\"empty\"","-D__KBUILD_MODNAME=kmod_empty","-c","-o","scripts/mod/empty.o","scripts/mod/empty.c"],"directory": "/home/tyustli/code/open_source/kernel/linux-6.5.7","file": "/home/tyustli/code/open_source/kernel/linux-6.5.7/scripts/mod/empty.c","output": "/home/tyustli/code/open_source/kernel/linux-6.5.7/scripts/mod/empty.o"},

从该文件可以看到,每个编译的文件的详细信息都被记录在 compile_commands.json 文件中。

触发 clangd

在 VScode 里打开任意一个 C 文件,就会触发 clangd 建立索引:
在这里插入图片描述
如果正在建立索引,显示的是 indexing:1276/1699

索引建立完成之后
在这里插入图片描述
如果索引建立完成轴,显示的是 clangd: idle

此时 linux 代码可以任意跳转了。

linux 内核脚本生成 compile_commands.json 文件

linux 内核提供了生成该文件的脚本

scripts/clang-tools/gen_compile_commands.py 

执行该脚本之前需要确保内核已经编译过!!!

执行该脚本即可生成 compile_commands.json 文件

python3 ./scripts/clang-tools/gen_compile_commands.py 

生成的部分内容如下

  {"command": "arm-none-linux-gnueabihf-gcc -Wp,-MMD,block/.genhd.o.d -nostdinc -I./arch/arm/include -I./arch/arm/include/generated  -I./include -I./arch/arm/include/uapi -I./arch/arm/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -mlittle-endian -D__LINUX_ARM_ARCH__=7 -fmacro-prefix-map=./= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -Wall -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -fno-dwarf2-cfi-asm -mno-fdpic -fno-ipa-sra -mtp=cp15 -mabi=aapcs-linux -mfpu=vfp -funwind-tables -marm -Wa,-mno-warn-deprecated -march=armv7-a -msoft-float -Uarm -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fomit-frame-pointer -fno-stack-clash-protection -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g -fplugin=./scripts/gcc-plugins/arm_ssp_per_task_plugin.so -fplugin-arg-arm_ssp_per_task_plugin-offset=1248    -DKBUILD_MODFILE='\"block/genhd\"' -DKBUILD_BASENAME='\"genhd\"' -DKBUILD_MODNAME='\"genhd\"' -D__KBUILD_MODNAME=kmod_genhd -c -o block/genhd.o block/genhd.c","directory": "/home/tyustli/code/open_source/kernel/linux-6.5.7","file": "/home/tyustli/code/open_source/kernel/linux-6.5.7/block/genhd.c"},

三种方式对比

  • cmake
    • 优点:简单,加入 cmake 选项即可
    • 缺点: 依赖于 cmake 工程
  • bear(未编译之前使用)
    • 优点:任意 Makefile 工程都能使用
    • 缺点:如果改动了源码或者文件依赖,bear 每次都要重新编译
  • linux 脚本(编译之后使用)
    • 优点:简单,只需要 python 执行一下即可
    • 缺点:局限于 linux 工程

对于研究 linux 内核,直接使用 linux 提供的脚本这种方法最合适。

http://www.tj-hxxt.cn/news/128655.html

相关文章:

  • 网页游戏链接大全南京seo排名优化
  • 创办公司的基本流程搜索优化整站优化
  • 怎么建设公司小程序网站建网站找哪个平台好呢
  • 公司自己买服务器建设网站推广竞价
  • 我做动作你来猜的网站广州网站到首页排名
  • 什么网站免费做游戏吸引人的推广标题
  • 不错的网站建设公郑州网络推广厂家
  • 长沙网站优化对策百度广告投放价格
  • 提供商城网站建设品牌策划公司排名
  • 别人做的网站会植入病毒吗杭州seo建站
  • 网站中页面模板设计广告文案
  • 咸宁网站建设哪家专业杭州网站建设 seo
  • 高端 网站建设网络营销产品策略分析
  • 安 网站建设广告推广app
  • 用php做一网站有哪些东西搜狗seo怎么做
  • 亚翔建设集团有限公司网站在线建站平台
  • 网站建设中英文表述如何自己创建网站
  • 武汉网站制作服务应用商店下载安装
  • 武汉做网站价格网络推广策划
  • 那个网站教做仙芋鲜电商运营工作内容
  • 装修网站开发前的准备工作18款禁用看奶app入口
  • 为什么几年前做的网站视频看不了模板式自助建站
  • 网站制作难点百度投放
  • 网站怎么做自然优化创建免费网站
  • h5网站建设服务免费关键词排名优化软件
  • 官方网站minecraftseo关键词排名技术
  • 广东省建设厅官方网站多少钱百度贴吧人工客服
  • 网站怎么做多级菜单搭建网站的软件
  • 外贸网站推广中山网站模板建站
  • 当前最流行的网络营销是什么长春seo优化