标签: compiling

GCC - 在 64 位系统上编译 32 位代码

我正在学习汇编,我需要将一段 C 代码编译成一个 32 位可执行文件。问题是我不断收到此错误。我试过安装 gcc-multilib 和 g++-lib,但没有帮助。有谁知道可能会发生什么?

> gcc main.s -m32 -o main

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

在 Ubuntu 16.10 上使用 gcc 版本 4.8.5 (Ubuntu 4.8.5-4ubuntu4)。

更新:添加了编译命令。我事先编译了 .s 文件,gcc -m32 -S main.c因为我需要查看汇编代码。

64-bit compiling 32-bit gcc

3
推荐指数
1
解决办法
2万
查看次数

从源代码构建 Firefox

我只想得到代码,编辑一些东西,然后构建它,就这样,为什么它这么复杂?

我尝试了这个似乎是我需要的指南,但是如果您看到原始指南,它是完全不同且复杂的,使用bzr和东西。

我按照脚本:

sudo apt-get build-dep firefox
sudo apt-get install -y fakeroot
apt-get source firefox
# here it gets firefox_55.0.2+build1-0ubuntu0.16.04.1.debian.tar.xz, firefox_55.0.2+build1-0ubuntu0.16.04.1.dsc and firefox_55.0.2+build1.orig.tar.xz
tar xf firefox_55.0.2+build1-0ubuntu0.16.04.1.debian.tar.xz
tar xf firefox_55.0.2+build1.orig.tar.xz
vim debian/config/mozconfig.in
# trying to fix https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/1710993
# echo 'ac_add_options --enable-alsa' >> debian/config/mozconfig.in
dpkg-buildpackage -b -us -uc
# some bugs of missing SOURCE_CHANGESET file
touch SOURCE_CHANGESET
dpkg-buildpackage -b -us -uc
# some issues with missing browser/config/version.txt file
ln -s firefox-55.0.2+build1 browser
touch browser/config/version.txt
dpkg-buildpackage -b …
Run Code Online (Sandbox Code Playgroud)

configuration package-management dpkg compiling

3
推荐指数
1
解决办法
2323
查看次数

一些 R 包不会安装

我有 R 版本 3.4.2,试图安装ggplot2install.packages("ggplot2", dependencies = TRUE)在 RStudio 中运行。它最终告诉我它以非零退出状态退出并且错误很难阅读,因为消息太长,但我看到在这个过程中Matrix是一个也无法安装的依赖项,所以我尝试直接安装它,这是我在错误消息中看到的:

/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'Matrix.so' failed
make: *** [Matrix.so] Error 1
ERROR: compilation failed for package ‘Matrix’
* removing ‘/usr/local/lib/R/site-library/Matrix’
Run Code Online (Sandbox Code Playgroud)

我不清楚到底ld是什么,以及我是否需要研究它来解决这个问题。看起来它可能交替与Matrix.so.

package-management compiling r

3
推荐指数
1
解决办法
4129
查看次数

使用非 retpoline 编译器构建内核

我正在尝试在 Ubuntu 上构建 rtl wifi 驱动程序,当我使用make命令时,它给了我这条消息

make[1]: Entering directory '/usr/src/linux-headers-4.15.0-50-generic'
arch/x86/Makefile:156: CONFIG_X86_X32 enabled but no binutils support
arch/x86/Makefile:245: *** You are building kernel with non-retpoline compiler, please update your compiler..  Stop.
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-50-generic'
Makefile:58: recipe for target 'all' failed
make: *** [all] Error 2
Run Code Online (Sandbox Code Playgroud)

compiling kernel make drivers

3
推荐指数
1
解决办法
9080
查看次数

GCC 错误:500:没有这样的文件或目录

我用 C 编写了一个程序,我试图用参数在命令行上编译它,但是当我写一个整数时,例如:

gcc findtopk.c -o findtopk 500 5 test1.txt test2.txt test3.txt test4.txt test5.txt outfile.txt
Run Code Online (Sandbox Code Playgroud)

它说:

gcc: error: 500: No such file or directory
gcc: error: 5: No such file or directory
Run Code Online (Sandbox Code Playgroud)

command-line compiling gcc

3
推荐指数
1
解决办法
1423
查看次数

内核 - 使 menuconfig 出错

使用带有 Ubuntu Server 18.04.4 LTS 的 Headless Raspberry PI 4.. 我正在尝试配置源内核。我已经安装了 libncurses-dev、kernel-package、qt4-dev-tools。

当我在目录 /linux-5.7 中运行“make menuconfig”时,它显示:

  LEX     scripts/kconfig/lexer.lex.c
/bin/sh: 1: flex: not found
scripts/Makefile.host:9: recipe for target 'scripts/kconfig/lexer.lex.c' failed
make[1]: *** [scripts/kconfig/lexer.lex.c] Error 127
Makefile:588: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2
Run Code Online (Sandbox Code Playgroud)

不知道该怎么做,到目前为止我读过的所有内容都没有帮助。我的目标是开始编写设备驱动程序,为此我需要在磁盘上配置和构建内核源代码树。

bash scripts compiling kernel drivers

3
推荐指数
2
解决办法
8534
查看次数

gfortran 不同版本

在此处输入图片说明在我的Ubuntu 18.04 中,默认的gfortran 是 7.5。但是默认的gcc版本显示为8.4。我已经安装了gfortran-8.4。我需要将我的默认 gfortran 版本设为 8.4。怎么做?

在此处输入图片说明

compiling gcc 18.04

3
推荐指数
1
解决办法
772
查看次数

如何在 Ubuntu 18(仿生)上使用 C++17/文件系统头文件获取 libstdc++?

在 Docker 的 ubuntu 仿生上,我得到了这个:

No such file or directory
 #include <filesystem>
Run Code Online (Sandbox Code Playgroud)

在执行此操作的 C++ 文件上:

#if __cplusplus >= 201703L
#include <filesystem>
#endif
Run Code Online (Sandbox Code Playgroud)

尝试使用 clang 6.0 进行编译时。不幸的是,我无法移动,experimental/filesystem因为它不是我的图书馆,它来自 OpenVPN3。我尝试了 clang 10,但仍然出现错误。

Ubuntu 20.04(专注于 docker)工作!但是我想使用更旧的版本来与旧系统兼容。

这是编译给出错误的文件时 cmake/make 产生的输出:

cd /workspaces/libopenvpnclient/build/src && /usr/local/clang/bin/clang++  -DASIO_STANDALONE

 -DHAVE_LZ4 -DLZ4_DISABLE_DEPRECATE_WARNINGS -DMBEDTLS_DEPRECATED_REMOVED -DUSE_ASIO 

-DUSE_OPENSSL -I/workspaces/libopenvpnclient/src/../openvpn3 -I/workspaces/libopenvpnclient

/src/../libtins/include -I/workspaces/libopenvpnclient/src/../asio/asio/include -I/workspaces

/libopenvpnclient/src/../literal_ipaddr -I/workspaces/libopenvpnclient/openvpn3/cmake/..

 -I/workspaces/libopenvpnclient/openvpn3/cmake/../../deps/asio/asio/include  -Wall -Wsign-

compare -Wno-missing-field-initializers -std=c++1z -o CMakeFiles/libopenvpn_example.dir

/OpenVPNClient.cpp.o -c /workspaces/libopenvpnclient/src/OpenVPNClient.cpp
Run Code Online (Sandbox Code Playgroud)

我猜 Ubuntu 18 上的 libstdc++ 有问题?

Dockerfile:

FROM ubuntu:bionic

RUN export DEBIAN_FRONTEND=noninteractive && apt-get update …
Run Code Online (Sandbox Code Playgroud)

compiling c++ make docker 18.04

3
推荐指数
1
解决办法
9103
查看次数

如何在 Ubuntu 20.04 上安装 libhandy 1.0.0(或更高版本)?

我正在尝试构建一个代码库(使用 Meson),它对我大喊大叫我没有 libhandy。我发现了这个问题,但是那里提到的所有链接和 PPA 似乎都已死。

我需要 libhandy 1.0.0 或更高版本,我使用的是 Ubuntu 20.04。我该如何安装它(以这样的方式,它会被 pkgconfig 之类的构建系统接收到)?

gnome dependencies compiling libraries 20.04

3
推荐指数
1
解决办法
726
查看次数

编译C程序时出错

我是 ubuntu 编程的新手。当我尝试编译一个 C 程序时,它显示了这种错误

fowler_nordheim_current.c:27:10: fatal error: gsl/gsl_sf.h: No such file or directory
 #include <gsl/gsl_sf.h>
          ^~~~~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud)

请帮帮我。谢谢。

compiling gcc c

3
推荐指数
1
解决办法
93
查看次数