shockerli / shockerli.github.io

My personal blog
https://shockerli.net
0 stars 0 forks source link

post/mysql-source-macos-vscode-debug-5-7/ #10

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

MySQL 源码阅读 —— macOS VSCode 编译调试 MySQL 5.7 - 格物

在 macOS Big Sur 下,通过 VSCode 编译调试 MySQL 5.7 源码

https://shockerli.net/post/mysql-source-macos-vscode-debug-5-7/

kyao233 commented 2 years ago

Hello 楼主,我用mac+vscode编译的时候即使使用brew 安装了Openssl 1.1之后,cmake也提示找不到openssl,在settings.json里面直接指定openssl目录就可以了。

"WITH_SSL":"/opt/homebrew/Cellar/openssl@1.1/1.1.1q"

参考: https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/source-ssl-library-configuration.html

顺便给别的同学也提个醒~

shockerli commented 2 years ago

@kyao233

Hello 楼主,我用mac+vscode编译的时候即使使用brew 安装了Openssl 1.1之后,cmake也提示找不到openssl,在settings.json里面直接指定openssl目录就可以了。

"WITH_SSL":"/opt/homebrew/Cellar/openssl@1.1/1.1.1q"

参考: https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/source-ssl-library-configuration.html

顺便给别的同学也提个醒~

安装 openssl@1.1 后,是否忘记添加到 PATH,从而导致找不到

brew info openssl@1.1

···

If you need to have openssl@1.1 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
kyao233 commented 2 years ago

刚刚试了这种方式,还是无法找到openssl

If you need to have openssl@1.1 first in your PATH, run: echo 'export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set: export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib" export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"

ghost commented 11 months ago

1.遇到的问题:生成可执行文件后直接运行mysqld命令可以启动数据库,但是使用debug一直退出。 2.解决:通过上面问题可以判断应该是debug配置文件launch.json存在问题,结合vscode官方文档修改了配置文件后可以正常启动,修改内容: {"type": "cppdbg","MIMode": "lldb"},大家最好去官方文档看一下:https://code.visualstudio.com/docs/cpp/config-clang-mac#_explore-the-debugger