Arch/GentooLinux开发环境构建与常用软件一览

编辑器

Emacs

  • Arch Linux

    yay -S clang emacs
    
  • Gentoo Linux

    sudo emerge --ask clang emacs
    

visual-studio-code

  • Gentoo Linux
    sudo emerge --ask app-editors/visual-studio-code
    

sublime-text

  • Gentoo Linux
    sudo emerge --ask app-editors/sublime-text
    

Git

  • Gentoo Linux
    sudo emerge --ask dev-vcs/git
    

Makefile

  • makefile三要素
    Target : Depend
    `TAB` Command
    

makefile的变量说明

  • $@ => Target

  • $^ => All Depend

  • $< => First dependency

  • $? => The first change of dependency

  • 自定义变量

    Objfile=xxx.c xxx.c xxx.c
    # Use variable
    app:$(Objfile)
    gcc -----
    

基础格式

  • 最简单一个模板, 但文件数量多了的话每次make都会逐个编译.
    app:main.c add.c sub.c div.c mul.c
        gcc -o app -I ./includemain.c add.c sub.c div.c mul.c
    

更新版本

  • 先编译为.o文件, 如果源码未修改则不编译
    ObjFile=main.o add.o sub.o div.o mul.o
    app:$(ObjFile)
        gcc -o app -I./include $(ObjFile)
    
    main.o:main.c
        gcc -c main.c -I ./include
    add.o:add.c
        gcc -c add.c -I ./include
    sub.o:sub.c
        gcc -c sub.c -I ./include
    div.o:div.c
        gcc -c div.c -I ./include
    mul.o:mul.c
        gcc -c mul.c -I ./include
    

万能模板

  • 一个可以重复使用makefile模板

    # Get all .c files
    SrcFiles=$(wildcard *.c)
    # Convert the .c to .o
    ObjFiles=$(patsubst %.c,%.o,$(SrcFiles))
    
    all:app app1
    
    app:$(ObjFiles)
        gcc -o $@ -I./include $(ObjFiles)
    app1:$(ObjFiles)
        gcc -o $@ -I./include $(ObjFiles)
    %.o:%.c
        gcc -o $@ -c $^ -I ./include
    
    test:
        @echo $(SrcFiles)
        @echo $(ObjFiles)
    
    # Non-target statement
    .PHONY:clean all
    
    clean:
        -rm *.o
        -rm app app1
    
  • @: Stands for Don't print command

  • -: Stands for Don't handle error

GDB

使用Gdb

  • 若要使用gdb就在gcc编译的时候添加上-g参数来支持gdb.

  • 在gdb中运行程序

    • r(un): 执行程序
    • start: 执行程序并在main函数位置暂停
    • n(ext): 执行下一条指令
    • s(tep): 执行下一条指令并进入子函数
    • q(uit): 退出gdb
  • 设置程序参数

    set args xx xx(as: set args 10 9)
    
  • 显示main函数的参数

    show args
    
  • 打印变量的值

    p variable
    
  • 打印变量类型

    ptype variable
    
  • 设置变量的值

    set argc=4
    
    set argv[1]="12" ## or
    set argv[2]="7"
    

添加与删除程序断点

  • 根据行号添加断点

    b numberline (as: b 15)
    
  • 根据函数名添加断点

    b function name (as: b hello)
    
  • 根据文件名定位到xx行添加断点

    b file:xx (as b text.c:15)
    
  • 删除程序断点

    d(el) number(as d 1)
    

显示与跳转断点

  • 显示程序断点

    info b (get breakpoint number)
    
  • 跳转到下一个断点

    c(ontinue) (jump to next program breakpoint)
    

条件断点与显示程序代码

  • 条件断点

    b line if i == 1
    
  • 显示程序代码

    l(ist) show the code, show 10 line by default
    - l -- Display the file where the main function is located
    - l filename:line
    

数据追踪

  • 添加数据追踪

    display variablename (for use tracking)
    
  • 显示数据追踪的行号

    info display(get the data tracking number)
    
  • 取消显示数据追踪

    undisplay number
    

开发库

OpenGL

  • 安装
    sudo emerge --ask x11-apps/mesa-progs
    
    glxinfo | grep rendering
    
    sudo glxgears
    

开发环境

语言环境

Python环境

  • 安装ipython
    sudo emerge --ask dev-python/ipython
    

Java环境

  • 安装配置文件的默认JDK运行
    sudo emerge --ask --oneshot virtual/jdk
    

集成开发环境(IDE)

CodeBlocks

  • Gentoo Linux
    sudo emerge --ask dev-util/codeblocks
    

Qt-Creator

  • Gentoo Linux
    sudo emerge --ask dev-qt/qt-creator
    
    sudo emerge --ask dev-qt/qt-docs
    

Android Studio

  • Gentoo Linux
    sudo emerge --ask dev-util/android-studio
    

Android Studio 下载fastutil.jar文件连接失败

  • 解决方法: 换国内的源.
  • 打开项目文件中的buld.gradle
  • buildscriptallprojectsrepositories 中分别注释掉jcenter()
  • buildscriptallprojectsrepositories 分别添加: maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'}
  • 继续在 buildscriptrepositories 添加: maven{url "https://jitpack.io"}

Mysql数据库

Install dev-db/mariadb

  • 安装mariadb

    sudo emerge --ask mariadb
    
  • To have Mariadb startd automatically at boot, add it to the default runlevel

    sudo rc-update add mysql default
    
    sudo rc-service mysql start
    
  • The configuration will create a database, set proper permissions, and assist you in creating a secure root password(this is for the Mariadb root account, which is not related to the linux root account)

    sudo emerge --config dev-db/mariadb
    
    • if the event Mariadb configuration fails due 'localhost' as hostname, update the system hostname variable to a name other than 'localhost' in /etc/conf.d/hostname
      • sed -i 's/localhost/larry/g' /etc/conf.d/hostname
      • rc-service hostname restart
      • emerge –config dev-db/mariadb
  • When the database is set up and running, conncet to MariaDB using the mysql client application

    mysql -u root -p
    

嵌入式

电子电路设计

KiCad

  • Arch Linux
    yay -S kicad
    
    yay -S kicad-library-3d
    

截图工具

  • flameshot自带图像处理的截图工具
    sudo emerge --ask media-gfx/flameshot
    

多媒体

图像处理

  • Gimp

    sudo emerge --ask media-gfx/gimp
    
  • Krita

    sudo emerge --ask media-gfx/krita
    

图形绘图

思维导图

  • Freeplace
    • 直接去官网下载

数学绘图

  • geogebra
    sudo emerge --ask sci-mathematics/geogebra
    

三维动画

  • Blender
    sudo emerge --ask --verbose blender
    

图片浏览器

  • shotwell
    sudo emerge --ask media-gfx/shotwell
    

视频播放器

  • SMPlayer
    sudo emerge --ask --verbose media-video/smplayer
    

浏览器

Google-Chrome

安装Chrome

  • Emerge
    sudo emerge --ask www-client/google-chrome
    

Saladict(翻译)

  • github 从源码创建

    git clone git@github.com:crimx/ext-saladict.git
    cd ext-saladict
    yarn install
    yarn pdf
    
  • Add a .env file following the .env.example format(leave cmpty if you don't use these dictionaries).

    yarn bulid
    
  • Artifacts can be found in build/

  • Saladict安装与下载

    https://pictureknow.com/extensions
    
    • then search "saladict"
  • Chrome插件

    google address bar:
    chrome://extensions/
    

Firefox

  • Gentoo
    sudo emerge --ask www-client/firefox
    

字典工具

  • goldendict
    sudo emerge --ask app-text/goldendict
    

办公软件

PDF渲染器

  • Evince
    sudo emerge --ask app-text/evince
    

表格字处理

  • libreoffice
    sudo emerge --ask app-office/libreoffice
    
原文地址:https://www.cnblogs.com/ieeqc/p/14218587.html