ubuntu22.04使用时遇到的问题

应用软件

网易云音乐无法打开

sudo gedit /opt/netease/netease-cloud-music/netease-cloud-music.bash

将内容改成下面这样

#!/bin/sh
HERE="$(dirname "$(readlink -f "${0}")")"
export LD_LIBRARY_PATH=/opt/netease/netease-cloud-music/libs
export QT_PLUGIN_PATH="${HERE}"/plugins
export QT_QPA_PLATFORM_PLUGIN_PATH="${HERE}"/plugins/platforms
cd /lib/x86_64-linux-gnu/ # <<<<<<<<<<<<<<<<<<<<<唯一插入的命令<<<<<<<<<<<<<<<
exec "${HERE}"/netease-cloud-music $@

腾讯会议无法打开

sudo vi /etc/gdm3/custom.conf

把其中的 #WaylandEnable=false 的注释井号去掉,保存退出

sudo service gdm3 restart

程序调试

pstack运行错误:

sudo rm -rf /usr/bin/pstak
sudo nano /usr/bin/pstack

在nano界面中粘贴以下内容并保存。

#!/bin/sh

if test $# -ne 1; then
    echo "Usage: `basename $0 .sh` <process-id>" 1>&2
    exit 1
fi

if test ! -r /proc/$1; then
    echo "Process $1 not found." 1>&2
    exit 1
fi

# GDB doesnt allow "thread apply all bt" when the process isnt
# threaded; need to peek at the process to determine if that or the
# simpler "bt" should be used.

backtrace="bt"
if test -d /proc/$1/task ; then
    # Newer kernel; has a task/ directory.
    if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
	backtrace="thread apply all bt"
    fi
elif test -f /proc/$1/maps ; then
    # Older kernel; go by it loading libpthread.
    if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
	backtrace="thread apply all bt"
    fi
fi

GDB=${GDB:-/usr/bin/gdb}

if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
    readnever=--readnever
else
    readnever=
fi

# Run GDB, strip out unwanted noise.
$GDB --quiet $readnever -nx /proc/$1/exe $1 <<EOF 2>&1 | 
set width 0
set height 0
set pagination no
$backtrace
EOF
/bin/sed -n 
    -e s/^((gdb) )*// 
    -e /^#/p 
    -e /^Thread/p

内核学习

make生成配置菜单时:‘make menuconfig’ requires the ncurses libraries.

sudo apt-get install libncurses5-dev

make编译linux内核时:“Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel”. Stop.

sudo apt install libelf-dev
sudo apt install libssl-dev

make编译linux内核时:thunk_64.o: warning: objtool: missing symbol table

可以使用make menuconfig为内核启用CONFIG_PREEMPT;只需从菜单选项中选择它。要验证它是否已启用,请检查make menuconfig为以下行生成的.config文件:

CONFIG_PREEMPT=y

也可以手动进行修改(make menuconfig只是一个用于创建.config文件的GUI)。

qemu-linux报错‘Read-only file system’

查看系统启动log,发现加载方式确实是只读的, 采用如下命令可以解决

mount -o remount rw /

glibc编译问题:all warnings being treated as errors

因为启用了“所有警告都当作是错误”的功能。在运行make命令之前,先运行

./configure --with-cc-opt=-Wno-error

可以禁用这个功能。 或者,找到相应的Makefile,去掉编译选项中的 -Werror

经验分享 程序员 微信小程序 职场和发展