如何在 ubuntu 20.04 上安装 x86_64-elf-ld?

问题描述

我正在尝试编写一个操作系统内核,我需要一定的依赖项才能将程序集编译为 iso 二进制文件。依赖项是 x86_64-elf-ld。我在网上找不到在 ubuntu 上安装它的任何资源,所以我想我会问互联网。

解决方法

如果确实需要,您可以使用以下命令从最新的 x86_64-elf-ld 源代码构建 binutils

wget https://ftp.gnu.org/gnu/binutils/binutils-2.36.1.tar.xz
tar Jxf binutils-2.36.1.tar.xz
mkdir binutils
pushd binutils
 ../binutils-2.36.1/configure --prefix=/usr/local --target=x86_64-elf --program-prefix=x86_64-elf- 
make all
sudo make install
popd

ls -ail /usr/local/bin/x86_64-elf-*
13136197 -rwxr-xr-x 1 root root  5946864 Feb 27 23:53 /usr/local/bin/x86_64-elf-addr2line
13136193 -rwxr-xr-x 2 root root  6194776 Feb 27 23:53 /usr/local/bin/x86_64-elf-ar
13136205 -rwxr-xr-x 2 root root  9218448 Feb 27 23:53 /usr/local/bin/x86_64-elf-as
13136202 -rwxr-xr-x 1 root root  5890200 Feb 27 23:53 /usr/local/bin/x86_64-elf-c++filt
13136199 -rwxr-xr-x 1 root root   262680 Feb 27 23:53 /usr/local/bin/x86_64-elf-elfedit
13136206 -rwxr-xr-x 1 root root  6624808 Feb 27 23:53 /usr/local/bin/x86_64-elf-gprof
13136209 -rwxr-xr-x 4 root root 10380024 Feb 27 23:53 /usr/local/bin/x86_64-elf-ld
13136209 -rwxr-xr-x 4 root root 10380024 Feb 27 23:53 /usr/local/bin/x86_64-elf-ld.bfd
13136200 -rwxr-xr-x 2 root root  5996448 Feb 27 23:53 /usr/local/bin/x86_64-elf-nm
13136196 -rwxr-xr-x 2 root root  6900392 Feb 27 23:53 /usr/local/bin/x86_64-elf-objcopy
13136192 -rwxr-xr-x 2 root root 10369928 Feb 27 23:53 /usr/local/bin/x86_64-elf-objdump
13136195 -rwxr-xr-x 2 root root  6194800 Feb 27 23:53 /usr/local/bin/x86_64-elf-ranlib
13136198 -rwxr-xr-x 2 root root  4391904 Feb 27 23:53 /usr/local/bin/x86_64-elf-readelf
13136191 -rwxr-xr-x 1 root root  5936152 Feb 27 23:53 /usr/local/bin/x86_64-elf-size
13136194 -rwxr-xr-x 1 root root  5932576 Feb 27 23:53 /usr/local/bin/x86_64-elf-strings
13136201 -rwxr-xr-x 2 root root  6900384 Feb 27 23:53 /usr/local/bin/x86_64-elf-strip

请注意,您可能需要先在 Ubuntu 或 Debian 上安装以下一个或多个软件包:build-essential、flex、bison、libisl-dev、texinfo texlive。

,

当您安装编译器时,ld 与其他程序一起安装在一个包中。你可以试试使用

from bs4 import BeautifulSoup # remove <!-- ********* html = """<div class="d-none d-md-block"> <a class="btn btn-outline-secondary arrow-r" href="https://www.tk-aerztefuehrer.de/TK/Suche_SN/index.js?a=DD&amp;sid=&amp;e_id=799433&amp;Db=" title="Zur Detailseite">Zur Detailseite</a> <!-- OTB Termin finden desktop **** --> <!-- *** --> </div> <!-- <img class="mapicons" src="https://www.tk-aerztefuehrer.de/TK/images/GoogleImages/E.png" alt=" " /><br> --> <br> <img src="https://www.tk-aerztefuehrer.de/TK/img/entfernung.svg" alt=" " /> 0.3 km<br /> <br> Am Rathausplatz 4<br /> 33014 Bad Driburg<br /> <br />""" soup = BeautifulSoup(html,'lxml') # if you use html.parser the code below will be different # find <img> element first,then get text element next to it addressLine1 = str(soup.find('img',class_='').findNextSibling(text=True).findNextSibling(text=True).findNextSibling(text=True)).strip() # Am Rathausplatz 4 addressLine2 = str(soup.find('img',class_='').findNextSibling(text=True).findNextSibling(text=True).findNextSibling(text=True).findNextSibling(text=True)).strip() # 33014 Bad Driburg print(addressLine1) print(addressLine2)

这个解决方案帮助了我

You can look here