Инструменты компилятора, execv и "ошибка формата exec" в chroot s390x

2792
jww

У меня машина Debian 8 x86_64 с двумя средами chroot. Первый есть, armelа второй есть s390x. armelбыл установлен на прошлой неделе, и s390xбыл установлен недавно. armelхорошо как до, так и после s390xустановки. Но я ловлю ошибки при компиляции под недавно установленный s390x.

# chroot debian-s390x # g++ -dumpmachine s390x-linux-gnu  # cd /home/cryptopp-5.6.3/  # make g++ -DNDEBUG -g2 -O2 -pipe -c osrng.cpp g++: error trying to exec '/usr/lib/gcc/s390x-linux-gnu/5/cc1plus': execv: Exec format error GNUmakefile:382: recipe for target 'osrng.o' failed make: *** [osrng.o] Error 1 

Я не могу найти информацию при поиске /usr/lib/gcc/s390x-linux-gnu/5/cc1plus': execv: Exec format error.

Я нашел некоторые чтения, связанные с cc1plus, но я не вижу, где есть проблемы с установкой:

# file /usr/lib/gcc/s390x-linux-gnu/5/cc1plus /usr/lib/gcc/s390x-linux-gnu/5/cc1plus: ELF 64-bit MSB executable, IBM S/390, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld64.so.1, for GNU/Linux 2.6.32, BuildID[sha1]=aaa1e442e47e5e41c36b70d5e6a8f538da4ca3e7, not stripped 

Я также выполнил переустановку g++с apt-get install --reinstall g++, но это не помогло.

В чем проблема и каково ее решение?


РЕДАКТИРОВАТЬ : это может быть проблема, или может быть связанная проблема: Ошибка Debian 684909: qemu-system-s390x не работает, нет загрузчика 's390-zipl.rom' .


Я не верю, что это связано с проектом, который я пытаюсь скомпилировать:

# cat test.cxx  #include <iostream>  int main(int argc, char* argv[]) { return argc; }  # g++ test.cxx  g++: error trying to exec '/usr/lib/gcc/s390x-linux-gnu/5/cc1plus': execv: Exec format error 

Вот 5-секундный обзор процедуры установки среды debian-s390x :

# apt-get install qemu-user-static debootstrap # qemu-debootstrap --arch=s390x --keyring /usr/share/keyrings/debian-archive-keyring.gpg --variant=buildd --exclude=debfoster unstable debian-s390x http://ftp.debian.org/debian # chroot debian-s390x # apt-get install locales build-essentials emacs-nox 
0

1 ответ на вопрос

0
jww

This turned out to be an issue with binfmt registrations. Taking from Michael Tokarev's message in Debian Issue 799120: cc1/cc1plus fails with "execv: exec format error” under QEMU s390x, can't compile C++ program:

This has been fixed in the version which you reported this prob against, 1:2.4+dfsg-3, where I updated the binfmt masks to include OSABI_GNU too. This was #784605.

However, it looks like we've a problem with updating binfmt registrations. If you had qemu-user-static package previously installed (which registers only OSABI_SYSV variant) and update it to current version (which should register both SYSV and GNU variants), the in-kernel registration isn't updated. It will be updated at reboot, or you can remove and reinstall qemu-user-static package, after which it'll work.

Похожие вопросы