bluetoothlover_doc icon indicating copy to clipboard operation
bluetoothlover_doc copied to clipboard

[windows][WSL] 使用windows wsl开发的一些常用技巧记录

Open xupenghu opened this issue 3 years ago • 20 comments

  • windows wsl 1 默认不支持32位程序的编译 可以参考这篇文章来处理 https://kiprey.github.io/2021/04/i386_WSL64/
  • 建议直接升级为WSL2,默认支持32位程序

xupenghu avatar Sep 28 '21 06:09 xupenghu

  • 我用的是WSL Ubuntu20.04 默认自带gcc 9.3 但是有些工程如果用新的gcc来编译会报错,因为gcc/g++高版本新增了很多语法特性
  • 如何切换到低版本的gcc?
  • 参考这篇文章 https://blog.csdn.net/u014421520/article/details/119445020

xupenghu avatar Sep 28 '21 07:09 xupenghu

Wsl有哪些优劣势?

supperthomas avatar Sep 28 '21 08:09 supperthomas

Wsl有哪些优劣势?

优势:

  1. 轻量化,不需要安装虚拟机再装系统
  2. 快速,可以像使用power shell那样来使用Ubuntu,用windows的vscode开发,终端使用的是wsl 开发效率高
  3. 绝大部分的功能和虚拟机Ubuntu是一样的

劣势:

  1. 没有界面,只有命令行终端
  2. 无法使用NFS server

xupenghu avatar Sep 28 '21 10:09 xupenghu

WSL中的文件,好像,只能放在C盘,另外,我目前安装的是WSL1如何,好升级到WSL2吗?

chenyingchun0312 avatar Sep 29 '21 03:09 chenyingchun0312

WSL中的文件,好像,只能放在C盘,另外,我目前安装的是WSL1如何,好升级到WSL2吗?

参考这篇文章 https://kiprey.github.io/2021/04/i386_WSL64/

xupenghu avatar Sep 29 '21 06:09 xupenghu

https://mp.weixin.qq.com/s/IIXHviOaj2UEJ6CD45asFQ

supperthomas avatar Oct 21 '21 08:10 supperthomas

  1. WSL 安装: https://docs.microsoft.com/zh-cn/windows/wsl/install 先决条件 必须运行 Windows 10 版本 2004 及更高版本(内部版本 19041 及更高版本)或 Windows 11 如果是旧版的,比较麻烦 windows 必须是19041以上的才能运行比较方便 运行里面是输入‘winver’ 可以看到版本号。
  2. powershell 管理员权限运行wsl --install 直接安装

supperthomas avatar Oct 26 '21 13:10 supperthomas

安装之后遇到这个问题: 图片

supperthomas avatar Oct 26 '21 13:10 supperthomas

docker 教程 https://www.runoob.com/docker/docker-tutorial.html

supperthomas avatar Oct 26 '21 14:10 supperthomas

脚本一键自动安装:

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

supperthomas avatar Oct 26 '21 14:10 supperthomas

后续继续使用。

supperthomas avatar Nov 07 '21 12:11 supperthomas

https://zhuanlan.zhihu.com/p/147233604

supperthomas avatar Nov 15 '21 15:11 supperthomas

发现一个比较难受的确定,WSL 的 IO操作太慢了,具体体现在编译工程的时候超慢。

xupenghu avatar Nov 16 '21 01:11 xupenghu

还有一个缺点 WSL不支持音频 无法播放声音

xupenghu avatar Nov 16 '21 01:11 xupenghu

还有一个缺点 WSL不支持音频 无法播放声音

这个具体是指?

chenyingchun0312 avatar Nov 17 '21 06:11 chenyingchun0312

还有一个缺点 WSL不支持音频 无法播放声音

这个具体是指?

比如无法通过mplayer播放音频,因为WSL不支持音频驱动,要实现还要转发到windows,比较麻烦

xupenghu avatar Nov 18 '21 01:11 xupenghu

VMware虚拟机与WSL2不兼容问题解决

https://www.jianshu.com/p/20ae65d1b7a1

supperthomas avatar Nov 19 '21 06:11 supperthomas

将WSL移出C盘

https://blog.csdn.net/yihuajack/article/details/119915303

image

image

chenyingchun0312 avatar Mar 01 '22 02:03 chenyingchun0312

使用VS Code + WSL + nRF52 SDK开发很舒服,可以通过JLink Remote Server调试:使用WSL远程调试nRF52

image

hyhkjiy avatar Apr 11 '23 09:04 hyhkjiy