- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试构建 FIO使用 musl-gcc (由于 glibc 的许可问题,我们需要使用 musl)。我正在尝试使用 musl 提供的头文件而不是 glibc,但到目前为止编译 FIO 没有成功。我首先使用这些选项运行配置:
my@desktop % ./configure --cc="/usr/local/musl/bin/musl-gcc -I/usr/local/musl/include" --cpu="x86_64" --prefix="/usr/bin"
Operating system Linux
CPU x86_64
Big endian no
Compiler /usr/local/musl/bin/musl-gcc -I/usr/local/musl/include
Cross compile no
Static build no
Wordsize 64
zlib no
Linux AIO support no
POSIX AIO support yes
POSIX AIO support needs -lrt no
POSIX AIO fsync yes
POSIX pshared support yes
Solaris AIO support no
__sync_fetch_and_add yes
__sync_synchronize yes
__sync_val_compare_and_swap yes
libverbs no
rdmacm no
asprintf() yes
vasprintf() yes
Linux fallocate no
POSIX fadvise yes
POSIX fallocate yes
sched_setaffinity(3 arg) yes
sched_setaffinity(2 arg) no
clock_gettime yes
CLOCK_MONOTONIC yes
CLOCK_MONOTONIC_RAW yes
CLOCK_MONOTONIC_PRECISE no
clockid_t yes
gettimeofday yes
fdatasync yes
sync_file_range no
EXT4 move extent yes
Linux splice(2) yes
GUASI no
libnuma no
strsep yes
strcasestr yes
strlcat yes
getopt_long_only() yes
inet_aton yes
socklen_t yes
__thread yes
RUSAGE_THREAD yes
SCHED_IDLE yes
TCP_NODELAY yes
Net engine window_size yes
TCP_MAXSEG yes
RLIMIT_MEMLOCK yes
pwritev/preadv yes
pwritev2/preadv2 no
IPv6 helpers yes
http engine no
Rados engine no
Rados Block Device engine no
setvbuf yes
Gluster API engine no
s390_z196_facilities no
HDFS engine no
MTD no
libpmem no
libpmemblk no
PMDK pmemblk engine no
PMDK dev-dax engine no
PMDK libpmem engine no
DDN's Infinite Memory Engine no
iscsi engine no
lex/yacc for arithmetic no
getmntent yes
getmntinfo no
Static Assert no
bool yes
strndup yes
Valgrind headers no
Zoned block device support no
march_armv8_a_crc_crypto no
cuda no
mkdir(a, b) yes
Build march=native no
CUnit no
__kernel_rwf_t no
-Wimplicit-fallthrough no
MADV_HUGEPAGE yes
gettid no
Consider installing zlib-dev (zlib-devel, some fio features depend on it.
TCMalloc support no
然后运行 make:
my@desktop % make
CC crc/crc16.o
CC crc/crc32.o
CC crc/crc32c-arm64.o
In file included from crc/../os/os.h:38,
from crc/crc32c-arm64.c:2:
crc/../os/os-linux.h:16:26: error: linux/unistd.h: No such file or directory
crc/../os/os-linux.h:17:23: error: linux/raw.h: No such file or directory
crc/../os/os-linux.h:18:25: error: linux/major.h: No such file or directory
crc/../os/os-linux.h:19:22: error: linux/fs.h: No such file or directory
In file included from crc/../os/os.h:38,
from crc/crc32c-arm64.c:2:
crc/../os/os-linux.h: In function ‘fio_lookup_raw’:
crc/../os/os-linux.h:175: error: storage size of ‘rq’ isn’t known
crc/../os/os-linux.h:178: error: ‘RAW_MAJOR’ undeclared (first use in this function)
crc/../os/os-linux.h:178: error: (Each undeclared identifier is reported only once
crc/../os/os-linux.h:178: error: for each function it appears in.)
crc/../os/os-linux.h:192: error: ‘RAW_GETBIND’ undeclared (first use in this function)
crc/../os/os-linux.h:175: warning: unused variable ‘rq’
make: *** [crc/crc32c-arm64.o] Error 1
我不明白为什么我得到这个文件的错误 - 它看起来是 crc/crc32c-arm64.c,当我试图为 x86_64 构建时(在配置选项中使用它)。它会查找 linux/*.h,但/usr/local/musl/include 中没有“linux”文件夹。我通过包含/usr/include 来再次运行它(它确实有 linux/*.h),就像这样:
my@desktop % ./configure --cc="/usr/local/musl/bin/musl-gcc -I/usr/include" --cpu="x86_64" --prefix="/usr/bin"
但现在我在运行 make 时遇到了不同的错误:
my@desktop % make
CC crc/crc16.o
CC crc/crc32.o
CC crc/crc32c-arm64.o
CC crc/crc32c-intel.o
CC crc/crc32c.o
CC crc/crc64.o
CC crc/crc7.o
CC crc/fnv.o
CC crc/md5.o
CC crc/murmur3.o
CC crc/sha1.o
CC crc/sha256.o
CC crc/sha3.o
CC crc/sha512.o
CC crc/test.o
In file included from /usr/include/stdio.h:75,
from crc/test.c:2:
/usr/include/libio.h:491: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/libio.h:493: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
In file included from crc/test.c:2:
/usr/include/stdio.h:80: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘va_list’
In file included from crc/test.c:2:
/usr/include/stdio.h:371: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/stdio.h:370: warning: conflicting types for built-in function ‘vfprintf’
/usr/include/stdio.h:376: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/stdio.h:376: warning: conflicting types for built-in function ‘vprintf’
/usr/include/stdio.h:379: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/stdio.h:378: warning: conflicting types for built-in function ‘vsprintf’
/usr/include/stdio.h:390: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/stdio.h:389: warning: conflicting types for built-in function ‘vsnprintf’
/usr/include/stdio.h:399: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/stdio.h:417: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/stdio.h:476: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/stdio.h:475: warning: conflicting types for built-in function ‘vfscanf’
/usr/include/stdio.h:483: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/stdio.h:483: warning: conflicting types for built-in function ‘vscanf’
/usr/include/stdio.h:488: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/stdio.h:487: warning: conflicting types for built-in function ‘vsscanf’
In file included from crc/test.c:2:
/usr/include/stdio.h:899: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
In file included from /usr/include/stdio.h:932,
from crc/test.c:2:
/usr/include/bits/stdio2.h:28: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h:26: warning: conflicting types for built-in function ‘__vsprintf_chk’
/usr/include/bits/stdio2.h:44: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h: In function ‘vsprintf’:
/usr/include/bits/stdio2.h:48: error: ‘__ap’ undeclared (first use in this function)
/usr/include/bits/stdio2.h:48: error: (Each undeclared identifier is reported only once
/usr/include/bits/stdio2.h:48: error: for each function it appears in.)
/usr/include/bits/stdio2.h: At top level:
/usr/include/bits/stdio2.h:58: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h:56: warning: conflicting types for built-in function ‘__vsnprintf_chk’
/usr/include/bits/stdio2.h:75: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h: In function ‘vsnprintf’:
/usr/include/bits/stdio2.h:79: error: ‘__ap’ undeclared (first use in this function)
/usr/include/bits/stdio2.h: At top level:
/usr/include/bits/stdio2.h:90: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h:89: warning: conflicting types for built-in function ‘__vfprintf_chk’
/usr/include/bits/stdio2.h:92: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h:91: warning: conflicting types for built-in function ‘__vprintf_chk’
/usr/include/bits/stdio2.h:115: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h: In function ‘vprintf’:
/usr/include/bits/stdio2.h:118: error: ‘__ap’ undeclared (first use in this function)
/usr/include/bits/stdio2.h:118: error: too many arguments to function ‘__vfprintf_chk’
/usr/include/bits/stdio2.h: At top level:
/usr/include/bits/stdio2.h:126: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h: In function ‘vfprintf’:
/usr/include/bits/stdio2.h:128: error: ‘__ap’ undeclared (first use in this function)
/usr/include/bits/stdio2.h:128: error: too many arguments to function ‘__vfprintf_chk’
/usr/include/bits/stdio2.h: At top level:
/usr/include/bits/stdio2.h:137: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h:142: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h:151: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h:196: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h: In function ‘vasprintf’:
/usr/include/bits/stdio2.h:199: error: ‘__ap’ undeclared (first use in this function)
/usr/include/bits/stdio2.h:199: error: too many arguments to function ‘__vasprintf_chk’
/usr/include/bits/stdio2.h: At top level:
/usr/include/bits/stdio2.h:203: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h: In function ‘vdprintf’:
/usr/include/bits/stdio2.h:205: error: ‘__ap’ undeclared (first use in this function)
/usr/include/bits/stdio2.h:205: error: too many arguments to function ‘__vdprintf_chk’
/usr/include/bits/stdio2.h: At top level:
/usr/include/bits/stdio2.h:209: error: expected declaration specifiers or ‘...’ before ‘__gnuc_va_list’
/usr/include/bits/stdio2.h: In function ‘obstack_vprintf’:
/usr/include/bits/stdio2.h:213: error: ‘__ap’ undeclared (first use in this function)
/usr/include/bits/stdio2.h:213: error: too many arguments to function ‘__obstack_vprintf_chk’
make: *** [crc/test.o] Error 1
使用的版本:musl-1.1.23,fio-3.15,gcc-4.4.6
如果我只使用 glibc,它可以在不使用 musl 的情况下构建得很好。如何使用 musl 而不是 glibc 成功构建 FIO?这可能吗?
最佳答案
musl-gcc
包装器脚本的全部要点是调用 gcc
并调整包含和库路径以将其与主机包含和库生态系统隔离(假定是基于 glibc 的)。这包括您的主机系统的内核头文件。如果你想在 musl-gcc
中使用任何库(包括像内核头文件这样的“header-only libraries”),你需要构建一个针对 musl 而不是 glibc 的版本并将它安装在 musl include 中/库路径。
对于内核头文件,它们实际上并不依赖于 libc,也没有任何库文件;这只是标题。因此,您可能可以从 /usr/复制(或符号链接(symbolic link))
到 musl include 目录。或者,您可以从内核源安装它们。linux
、asm
和 asm-generic
目录include
但是,如果您发现需要大量的第三方库内容,那么放弃 musl-gcc
并使用真正的交叉编译器会更有意义。如果您愿意从 musl.cc 中信任它们,您可以获得预构建的二进制文件。 ,或使用 musl-cross-make 构建您自己的(如今在典型系统上大约需要 15 分钟) .这将自动为您提供内核头文件,以及一整套 GCC 目标库,让您可以构建 C++ 软件、使用 OpenMP 的软件等。
关于c - 针对 musl-gcc 编译 fio 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58245567/
我正在尝试在 Conda 环境中编译一些代码,在那里我 之前安装的编译包gcc_linux-64 . 然而,即使在停用和重新激活环境之后,gcc还在/usr/bin/gcc . 我该怎么做才能让 Co
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 7 年前。 Improve
这其实是两个问题: 1 - 在我的 debian amd64 系统上,我似乎无法构建与 gmp/mpfr/mpc 动态链接的交叉 GCC。即使我删除 --disable-shared,它也总是静态链接
研究ELF格式的结果,可以看到目标文件中有一个符号对应每个函数,对应的符号表项的值为st_size,表示大小的功能。 问题是,即使我更改了目标文件中特定函数的 st_size 并链接了它,但可执行文件
海湾合作委员会的 documentation for #line directives说他们是这样的: #line "myfile.cpp" 123 但是当我用 g++ 5.1 检查输出时,它们实际上
我正在使用 as 和 gcc 来汇编和创建 ARM 汇编程序的可执行文件,正如 this 所推荐的那样教程,如下: 给定一个汇编源文件,program.s,我运行: as -o program.o p
long long x; double n; x=long long(n); 这不起作用。什么是正确的方法? 最佳答案 显而易见的: x = (long long) n; 关于gcc - 转换为长长
我想知道用于 gcc 的原子内置函数的头文件是什么? 我想使用这 2 个函数为我当前创建的线程库实现互斥锁。 bool __sync_bool_compare_and_swap (type *ptr,
它出现在 another question :gcc调用的程序和部件是什么? (特别是在编译 C 或 C++ 时)以便有人可以设计一些拦截和更改流程的方案以用于各种自定义编码目的? 最佳答案 编译器二
可能吗?我想使用 gcc喜欢 assembler并在将其编译为 ubuntu 上的可执行文件后。 我尝试过这个: gcc a.asm -o out.o 来自 out.o文件编译成.out可执行文件。
我写了一个简单的 C 程序 test.c : #include #include int add(int a, int b); int main() { int i=5,j=10;
即。所以如果你使用任何八进制文字,它会给你一个警告。 微软编译器的同样问题。 如果没有,是否有任何其他工具可以检测八进制文字。 (vim 似乎有一个很酷的技巧,它突出了第一个领先的将不同的颜色归零,但
我在旧线程中搜索。但没有找到任何线程回答我的问题。 gcc 是否像 vc++ 一样支持函数级链接? 如果是,我应该提供什么选项来链接目标文件和库? 最佳答案 看起来 gcc 不直接支持函数级链接。您可
也许标题并没有把问题说得那么准确:我知道当我运行 gcc foo.c 时,GCC 会调用其他为它完成所有工作的子程序,从而生成主 gcc 程序只是一个界面。但这究竟是如何完成的呢? 它是否使用syst
我听说最近版本的 gcc 非常擅长将通过函数指针的调用转换为直接调用。但是,我在网上或快速浏览 gcc 的源代码上找不到任何关于它的信息。有谁知道这是否真的是真的,如果是这样,它使用什么算法来做到这一
gcc/g++ 链接器选项“-Map”生成的“.map”文件用于什么? 以及如何阅读它们? 最佳答案 我建议为您投入生产的任何软件生成一个映射文件并保留一份副本。 它可用于破译崩溃报告。根据系统的不同
gcc信息文件在有关x86-64特定标志的部分中说 其他事情: There is no `-march=generic' option because `-march' ind
我想知道 gcc 链接器选项(例如:-Wl,options)是否可以更改编译后的可执行文件中的汇编指令,因为如果您使用某些 gcc 优化选项会发生这种情况? 当您比较编译后的二进制文件(例如比较签名)
是否有GCC编译指示会停止,暂停或中止编译过程? 我正在使用gcc 4.1,但也希望在gcc 3.x版本上也可以使用该编译指示。 最佳答案 您可能需要#error: edd@ron:/tmp$ g++
当我使用gcc编译C程序时我通常使用 -g 将一些调试信息放入 elf 文件中这样 gdb 就可以在需要时帮助我。 但是,我注意到有些程序使用 -ggdb,因为它应该使调试信息对 gdb 更加友好。
我是一名优秀的程序员,十分优秀!