linux子系统-ubuntu22.04安装开发环境

查看linux子系统文件路径方法:
在子系统中执行命令”explorer.exe .”即可打开linux文件夹

 

更换青华源/etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse

 

    #更新软件列表与升级
    apt-get update
    apt-get upgrade

 

    #安装cmake高版本
    #编译好的版本,直接复制
    wget https://github.com/Kitware/CMake/releases/download/v3.25.0-rc2/cmake-3.25.0-rc2-linux-x86_64.tar.gz
    tar -zxvf cmake-3.25.0-rc2-linux-x86_64.tar.gz
    cd cmake-3.25.0-rc2-linux-x86_64
    copy * /usr/local/ -r
    camke --version

 

    #安装其它软件
    apt install ninja-build clang make gcc -y
    apt install make-guile -y

 

    #编译安装openssl
    wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz
    tar -zxvf openssl-1.1.1q.tar.gz
    cd openssl-1.1.1q
    ./configure
    make
    make install
    
    #编译安装cURL
    wget https://curl.se/download/curl-7.86.0.tar.gz
    tar -zxvf curl-7.86.0.tar.gz
    cd curl-7.86.0
    ./configure --with-openssl --with-zlib --enable-websockets
    make
    make install

对GDB特殊处理,ubuntu 22.04安装的gdb版本为12+,使用vs调试会报以下错误

Unable to start debugging. Unexpected GDB output from command “-exec-run”. Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x80011b0
Cannot insert breakpoint 2.
Cannot access memory at address 0x80011bf

 

参考解决方案:https://github.com/microsoft/WSL/issues/8356 方法如下:

从ubuntu官网下载gdb 12.0.90版本  或者本站下载:gdb_12.0.90-0ubuntu1_amd64.deb

使用dpkg命令安装deb包

dpkg -i gdb_12.0.90-0ubuntu1_amd64.deb

再执行补丁命令

echo -ne '\x90\x90' | sudo dd of=/usr/bin/gdb seek=$((0x335bad)) bs=1 count=2 conv=notrunc

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注