Проблемы с компиляцией fio против musl-gcc - PullRequest
2 голосов
/ 05 октября 2019

Я пытаюсь собрать FIO , используя musl-gcc (нам нужно использовать musl из-за проблем с лицензированием glibc). Я пытаюсь использовать заголовочные файлы, предоставленные musl вместо glibc, но до сих пор безуспешно при компиляции FIO. Сначала я запустил configure с этими параметрами:

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

Он прекрасно работает без использования musl, если я просто использую glibc. Как я могу успешно построить FIO, используя musl вместо glibc? Это возможно?

1 Ответ

2 голосов
/ 05 октября 2019

Смысл сценария-оболочки musl-gcc состоит в том, чтобы вызвать gcc с путями включения и библиотек, настроенными для его изоляции от хоста, включающего в себя и экосистему библиотеки (предполагается, что она основана на glibc). Это включает заголовки ядра для вашей хост-системы. Если вы хотите использовать какие-либо библиотеки (в том числе «библиотеки только для заголовков», такие как заголовки ядра) с musl-gcc, вам нужно создать версию для musl вместо glibc и установить ее по пути musl include / library.

Для заголовков ядра они фактически не зависят от libc и не имеют каких-либо библиотечных файлов;это просто заголовки. Таким образом, вы, вероятно, можете обойтись путем копирования (или символической ссылки) каталогов linux, asm и asm-generic из /usr/include в каталог musl include dir. В качестве альтернативы вы можете установить их из исходных кодов ядра.

Если вы обнаружите, что вам нужно какое-то значительное количество сторонних библиотечных материалов, имеет смысл просто отбросить musl-gcc и использовать настоящий кросс-компилятор. Вы можете получить готовые двоичные файлы, если хотите доверять им из musl.cc , или создать свой собственный (в настоящее время занимает около 15 минут в типичной системе) с помощью musl-cross-make . Это даст вам заголовки ядра автоматически, а также полный набор целевых библиотек GCC, которые позволят вам создавать программное обеспечение C ++, программное обеспечение с использованием OpenMP и т. Д.

...