找不到-lgcc,即使安装了gcc-multilib

plupiseo  于 2023-02-11  发布在  其他
关注(0)|答案(1)|浏览(248)

我无法编译我的c程序-m32选项,即使安装了gcc-multilib。我在Windows上使用Ubuntu x86_64虚拟机。在使用dpkg -l | grep gcc时,我看到

ii  gcc                                        4:7.4.0-1ubuntu2.3                              amd64        GNU C compiler
ii  gcc-11-base:amd64                          11.1.0-1ubuntu1~18.04.1                         amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-7                                      7.5.0-3ubuntu1~18.04                            amd64        GNU C compiler
ii  gcc-7-base:amd64                           7.5.0-3ubuntu1~18.04                            amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-7-multilib                             7.5.0-3ubuntu1~18.04                            amd64        GNU C compiler (multilib support)
ii  gcc-8-base:amd64                           8.4.0-1ubuntu1~18.04                            amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-9                                      9.4.0-1ubuntu1~18.04                            amd64        GNU C compiler
ii  gcc-9-base:amd64                           9.4.0-1ubuntu1~18.04                            amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-multilib                               4:7.4.0-1ubuntu2.3                              amd64        GNU C compiler (multilib files)
ii  lib32gcc-7-dev                             7.5.0-3ubuntu1~18.04                            amd64        GCC support library (32 bit development files)
ii  lib32gcc-s1                                11.1.0-1ubuntu1~18.04.1                         amd64        GCC support library (32 bit Version)
ii  lib32gcc1                                  1:11.1.0-1ubuntu1~18.04.1                       amd64        GCC support library (dependency package, 32bit)
ii  libgcc-7-dev:amd64                         7.5.0-3ubuntu1~18.04                            amd64        GCC support library (development files)
ii  libgcc-9-dev:amd64                         9.4.0-1ubuntu1~18.04                            amd64        GCC support library (development files)
ii  libgcc-s1:amd64                            11.1.0-1ubuntu1~18.04.1                         amd64        GCC support library
ii  libgcc1                                    1:11.1.0-1ubuntu1~18.04.1                       amd64        GCC support library (dependency package)
ii  libx32gcc-7-dev                            7.5.0-3ubuntu1~18.04                            amd64        GCC support library (x32 development files)
ii  libx32gcc-s1                               11.1.0-1ubuntu1~18.04.1                         amd64        GCC support library (x32)
ii  libx32gcc1                                 1:11.1.0-1ubuntu1~18.04.1                       amd64        GCC support library (x32)

我看到此错误

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
llycmphe

llycmphe1#

当您按照错误消息所暗示的那样使用gcc-9时,您需要安装gcc-9-multilib包:

sudo apt-get install gcc-9-multilib

相关问题