Raspberry Pi/Ubuntu安装build-essential遇到问题

本文介绍了解决在Ubuntu系统中安装build-essential时遇到的问题的方法。关键在于更改软件源配置,将squeeze或wheezy替换为testing,之后通过更新系统并重新安装来解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述

在Ubuntu下面使用命令 $ sudo apt-get install build-essential 安装build-essential的时候,可能会遇到如下问题:
问题

解决方案

关键问题出在软件源上,把source.list中的所有 squeeze 或者 wheezy 都批量替换成 testing,然后重新更新升级系统再安装。

apt-get update
apt-get upgrade
apt-get install build-essential

参考:
Debian 6 Squeeze - installing build-essentials - gcc / g++

ubuntu@raspberrypi:~$ bash ./PX4-Autopilot/Tools/setup/ubuntu.sh --fix-missing [ubuntu.sh] Starting... [ubuntu.sh] arch: aarch64 [ubuntu.sh] Ubuntu 20.04 [ubuntu.sh] Installing PX4 general dependencies Hit:1 http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu focal InRelease Hit:2 http://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu focal InRelease Hit:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports focal InRelease Hit:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports focal-updates InRelease Hit:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports focal-backports InRelease Hit:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports focal-security InRelease Reading package lists... Reading package lists... Building dependency tree... Reading state information... ccache is already the newest version (3.7.7-1). file is already the newest version (1:5.38-4). g++ is already the newest version (4:9.3.0-1ubuntu2). gcc is already the newest version (4:9.3.0-1ubuntu2). make is already the newest version (4.2.1-1.2). python3 is already the newest version (3.8.2-0ubuntu2). python3-dev is already the newest version (3.8.2-0ubuntu2). zip is already the newest version (3.0-11build1). astyle is already the newest version (3.1-2build1). cppcheck is already the newest version (1.90-4build1). lcov is already the newest version (1.14-2). ninja-build is already the newest version (1.10.0-1build1). shellcheck is already the newest version (0.7.0-2build2). build-essential is already the newest version (12.8ubuntu1.1). cmake is already the newest version (3.16.3-1ubuntu1.20.04.1). gdb is already the newest version (9.2-0ubuntu1~20.04.2). git is already the newest version (1:2.25.1-1ubuntu3.14). git set to manually installed. libssl-dev is already the newest version (1.1.1f-1ubuntu2.24). libxml2-dev is already the newest version (2.9.10+dfsg-5ubuntu0.20.04.10). libxml2-utils is already the newest version (2.9.10+dfsg-5ubuntu0.20.04.10). python3-setuptools is already the newest version (45.2.0-1ubuntu0.3). rsync is already the newest version (3.1.3-8ubuntu0.9). rsync set to manually installed. unzip is already the newest version (6.0-25ubuntu1.2). python3-pip is already the newest version (20.0.2-5ubuntu1.11). python3-wheel is already the newest version (0.34.2-1ubuntu0.1). 0 upgraded, 0 newly installed, 0 to remove and 163 not upgraded. [ubuntu.sh] Installing PX4 Python3 dependencies Collecting argcomplete (from -r /home/ubuntu/PX4-Autopilot/Tools/setup/requirements.txt (line 1)) Downloading argcomplete-3.6.2-py3-none-any.whl.metadata (16 kB) Collecting cerberus (from -r /home/ubuntu/PX4-Autopilot/Tools/setup/requirements.txt (line 2)) Downloading Cerberus-1.3.7-py3-none-any.whl.metadata (5.5 kB) Collecting coverage (from -r /home/ubuntu/PX4-Autopilot/Tools/setup/requirements.txt (line 3)) Downloading coverage-7.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (8.3 kB) Requirement already satisfied: empy<4,>=3.3 in /usr/lib/python3/dist-packages (from -r /home/ubuntu/PX4-Autopilot/Tools/setup/requirements.txt (line 4)) (3.3.2) Requirement already satisfied: future in /usr/lib/python3/dist-packages (from -r /home/ubuntu/PX4-Autopilot/Tools/setup/requirements.txt (line 5)) (0.18.2) Requirement already satisfied: jinja2>=2.8 in /usr/lib/python3/dist-packages (from -r /home/ubuntu/PX4-Autopilot/Tools/setup/requirements.txt (line 6)) (2.10.1) Requirement already satisfied: jsonschema in /usr/lib/python3/dist-packages (from -r /home/ubuntu/PX4-Autopilot/Tools/setup/requirements.txt (line 7)) (3.2.0) Collecting kconfiglib (from -r /home/ubuntu/PX4-Autopilot/Tools/setup/requirements.txt (line 8)) Downloading kconfiglib-14.1.0-py2.py3-none-any.whl.metadata (39 kB) Collecting lxml (from -r /home/ubuntu/PX4-Autopilot/Tools/setup/requirements.txt (line 9)) Downloading lxml-6.0.0.tar.gz (4.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.1/4.1 MB 4.0 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [3 lines of output] Building lxml version 6.0.0. Building without Cython. Error: Please make sure the libxml2 and libxslt development packages are installed. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip.
08-10
ubuntu@raspberrypi:~$ cat ~/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic/CMakeFiles/CMakeError.log Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output: Change Dir: /home/ubuntu/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic/CMakeFiles/CMakeTmp Run Build Command(s):/bin/ninja cmTC_778f9 && [1/2] Building C object CMakeFiles/cmTC_778f9.dir/src.c.o [2/2] Linking C executable cmTC_778f9 FAILED: cmTC_778f9 : && /bin/cc -DCMAKE_HAVE_LIBC_PTHREAD CMakeFiles/cmTC_778f9.dir/src.c.o -o cmTC_778f9 && : /bin/ld: CMakeFiles/cmTC_778f9.dir/src.c.o: in function `main': src.c:(.text+0x48): undefined reference to `pthread_create' /bin/ld: src.c:(.text+0x50): undefined reference to `pthread_detach' /bin/ld: src.c:(.text+0x5c): undefined reference to `pthread_join' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. Source file was: #include <pthread.h> void* test_func(void* data) { return data; } int main(void) { pthread_t thread; pthread_create(&thread, NULL, test_func, NULL); pthread_detach(thread); pthread_join(thread, NULL); pthread_atfork(NULL, NULL, NULL); pthread_exit(NULL); return 0; } Determining if the function pthread_create exists in the pthreads failed with the following output: Change Dir: /home/ubuntu/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic/CMakeFiles/CMakeTmp Run Build Command(s):/bin/ninja cmTC_1816c && [1/2] Building C object CMakeFiles/cmTC_1816c.dir/CheckFunctionExists.c.o [2/2] Linking C executable cmTC_1816c FAILED: cmTC_1816c : && /bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_1816c.dir/CheckFunctionExists.c.o -o cmTC_1816c -lpthreads && : /bin/ld: cannot find -lpthreads collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. 我的系统是aarch64 ubuntu20.04
最新发布
08-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值