Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

[SOLVED] app-emulation/qemu fails to build on musl

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
11 posts • Page 1 of 1
Author
Message
yamabiko
n00b
n00b
User avatar
Posts: 10
Joined: Sat Jul 22, 2017 4:59 pm

[SOLVED] app-emulation/qemu fails to build on musl

  • Quote

Post by yamabiko » Sat Jul 29, 2017 6:34 pm

Hello,
when I try to compile qemu I run in the following error:

Code: Select all

 gcc -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/user-build/linux-user -Ilinux-user -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/tcg -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/tcg/i386 -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/linux-headers -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/user-build/linux-headers -I. -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0 -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/include -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong  -I../linux-headers -I.. -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/target/i386 -DNEED_CPU_H -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/include -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/linux-user/x86_64 -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/linux-user/host/x86_64 -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/linux-user -MMD -MP -MT linux-user/syscall.o -MF linux-user/syscall.d -march=core2 -Os -pipe  -c -o linux-user/syscall.o /var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/linux-user/syscall.c
/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/linux-user/ioctls.h:174:9: error: ‘SIOCGSTAMPNS’ undeclared here (not in a function)
   IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
         ^
/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/linux-user/syscall.c:5597:23: note: in definition of macro ‘IOCTL’
     { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
                       ^
gcc -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/user-build/linux-user -Ilinux-user -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/tcg -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/tcg/i386 -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/linux-headers -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/user-build/linux-headers -I. -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0 -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/include -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong  -I../linux-headers -I.. -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/target/i386 -DNEED_CPU_H -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/include -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/linux-user/x86_64 -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/linux-user/host/x86_64 -I/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/linux-user -MMD -MP -MT linux-user/strace.o -MF linux-user/strace.d -march=core2 -Os -pipe  -c -o linux-user/strace.o /var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/linux-user/strace.c
make[1]: *** [/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/rules.mak:69: linux-user/syscall.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/var/tmp/portage/app-emulation/qemu-2.9.0-r2/work/qemu-2.9.0/user-build/x86_64-linux-user'
make: *** [Makefile:327: subdir-x86_64-linux-user] Error 2
 * ERROR: app-emulation/qemu-2.9.0-r2::musl failed (compile phase):
 *   emake failed 
I'm on the hardened musl profile. Any idea?
Last edited by yamabiko on Tue Aug 01, 2017 7:13 am, edited 1 time in total.
Top
Ant P.
Watchman
Watchman
Posts: 6920
Joined: Sat Apr 18, 2009 7:18 pm
Contact:
Contact Ant P.
Website

  • Quote

Post by Ant P. » Sat Jul 29, 2017 10:59 pm

Looks like it's missing. Best thing to do is file a bug upstream.

As a temporary workaround, you could try adding "-DSIOCGSTAMPNS=0x8907" to CFLAGS for this one package.
Top
ntnn
n00b
n00b
Posts: 10
Joined: Mon Mar 20, 2017 1:07 pm

  • Quote

Post by ntnn » Sun Jul 30, 2017 7:36 am

Are you using the musl overlay?
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Sun Jul 30, 2017 5:41 pm

The macro SIOCGSTAMPNS is defined in the linux header file named /usr/include/asm/sockios.h

[code="grep -Rl "SIOCGSTAMPNS" /usr/include"]/usr/include/asm/sockios.h[/code]

Code: Select all

sys-kernel/linux-headers
In a glibc based system, the header file <asm/sockios.h> is probably imported in this way:

Code: Select all

linux-user/syscall.c
-> ./glibc/include/sys/socket.h         # /usr/include/sys/socket.h or <sys/socket.h>
--> ./glibc/socket/sys/socket.h
---> ./glibc/include/bits/socket.h              # <bits/socket.h>
----> /usr/include/asm/socket.h                 # <asm/socket.h>
-----> /usr/include/asm-generic/socket.h        # <asm-generic/socket.h>
------> /usr/include/asm/sockios.h              # <asm/sockios.h>
[code="grep -Rl "SIOCGSTAMPNS" ./glibc/"]sysdeps/unix/sysv/linux/bits/socket.h[/code]

Code: Select all

...
error "Never include <bits/socket.h> directly: use <sys/socket.h> instead."
...
In a musl libc based system, however, the header file <asm/sockios.h> is probably not imported:

Code: Select all

linux-user/syscall.c
-> /usr/include/sys/socket.h
--> /usr/include/bits/socket.h

Code: Select all

sys-libs/musl

Code: Select all

helecho $ grep -Rl "sockios\.h" ./qemu-2.9.0/
./qemu-bridge-helper.c
helecho $ grep -n "#include" ./qemu-2.9.0/qemu-bridge-helper.c
#include <linux/sockios.h>
helecho $ grep -n "#include" /usr/include/linux/sockios.h
#include <asm/sockios.h>
In my opinion, I would have added #include <linux/sockios.h> in the header file ./qemu-2.9.0/linux-user/ioctls.h
Top
Ant P.
Watchman
Watchman
Posts: 6920
Joined: Sat Apr 18, 2009 7:18 pm
Contact:
Contact Ant P.
Website

  • Quote

Post by Ant P. » Sun Jul 30, 2017 6:01 pm

helecho wrote:In my opinion, I would have added #include <linux/sockios.h> in the header file ./qemu-2.9.0/linux-user/ioctls.h
Great, so now instead of one missing define you've caused an entire file not found error. Don't post misleading crap where you clearly don't know what you're talking about, this is an obnoxiously common theme with your posts.
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Sun Jul 30, 2017 6:13 pm

I do not understand your fuzzy/crazy answer! Please, at least, you have to be polite and respectful.

I may have had to clarify that I did not install qemu. I have only fetch qemu-2.9.0!

edit:

Code: Select all

 117: #include "qemu.h" # -> ./qemu-2.9.0/linux-user/syscall_defs.h (l.997): #define TARGET_SIOCGSTAMPNS 0x8907
5596: #include "ioctls.h"
[code="grep -n "SIOCGSTAMPNS" ./qemu-2.9.0/linux-user/ioctls.h"]174: IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))[/code]

Code: Select all

static IOCTLEntry ioctl_entries[] = {
#define IOCTL(cmd, access, ...) \
    { TARGET_ ##cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } },
#define IOCTL_SPECIAL(cmd, access, dofn, ...)
    { TARGET_ ##cmd, cmd, #cmd, acces, dofn, { __VA_ARGS__ } },
#define IOCTL_IGNORE(cmd) \
    { TARGET_ ##cmd, 0, #cmd },
#include "ioctls.h"
    { 0, 0, },
};
Maybe, the #include <linux/sockios.h> directive/instruction should be added at the beginning of the ./qemu-2.9.0/linux-user/syscall.c file?

I feel that the above structure is strange!
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Mon Jul 31, 2017 6:27 am

Ant. P wrote:[...] you've caused an entire file not found error [...]
Please, could you post the complete build log? I could make progress as well.

Yamabiko, have you solved the issue? Could you post the complete build log, please? If your issue is solved, please edit your first post and add [SOLVED] to the title.

In addition, in case of resolution, you should indicate how the problem has been solved!

N.B n°1:
We can read the source code of QEMU on GitHub.

N.B n°2: I do not know how the preprocessor parses its content (files) (separately or in a whole). Moreover, the issue could be solved in a more suitable way (e.g. using the "configure" script)?
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Tue Aug 01, 2017 6:52 am

yamabiko,

the extract of the build log indicates that the symbol SIOCGSTAMPNS is not declared. The bug tracker of the software does not indicate a build failure related to this symbol.
This symbol must be declared somewhere: either in the source file where it appears or in a header file. We know this symbol is not defined in the header files of glibc,
musl libc or in the header files of the software. Nevertheless, this symbol is defined in the Linux header file <asm/sockios.h> (/usr/include/asm/sockios.h) and is indirectly
included in the glibc header file <sys/socket.h> whereas it is *not included* in the same header file of musl libc. However, we know that the file ./quemu-2.9.0/qemu-bridge-helper.c
includes it indirectly via <linux/sockios.h> so it may be a good idea to include this last one in the file where the undeclared symbol appears: ./qemu-2.9.0/linux-user/syscall.c

helecho.
Top
yamabiko
n00b
n00b
User avatar
Posts: 10
Joined: Sat Jul 22, 2017 4:59 pm

  • Quote

Post by yamabiko » Tue Aug 01, 2017 7:13 am

The workaround suggested by Ant P. works fine. Sorry for the late reply.
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Tue Aug 01, 2017 7:28 am

yamabiko wrote:The workaround suggested by Ant P. works fine. Sorry for the late reply.
Ant. P wrote:As a temporary workaround, you could try adding "-DSIOCGSTAMPNS=0x8907" to CFLAGS for this one package.
This is a temporary workaround and it is not the best one. Moreover, the issue may be met by other than you: it would have been nice to propose a patch to the musl libc team.
  1. We do not know why the symbol is not declared.
  2. The symbol is only declared during one compilation and for each source file.
  3. This issue will appear again with newer version of qemu.
Top
yamabiko
n00b
n00b
User avatar
Posts: 10
Joined: Sat Jul 22, 2017 4:59 pm

  • Quote

Post by yamabiko » Tue Aug 01, 2017 8:53 am

I'll report the bug to the musl mailing list.
Top
Post Reply

11 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic