emulators/qemu: qemu ports failing due to compiler error on 12-CURRENT

Dimitry Andric dim at FreeBSD.org
Wed Dec 7 22:31:19 UTC 2016

On 07 Dec 2016, at 10:42, O. Hartmann <ohartmann at walstatt.org> wrote:
> I try my first steps in cross compiling ports with poudriere and therefore I try to setup
> an appropriate jail and QEMU environment.
> Well, I'm failing at the jail setup due to the non-exitence of any suitable QEMU
> environment and for that I tried to figure out to find some proper HOWTO.
> Searching via google ave some hints, but in questions which QEMU from ports should be
> used, all leave me alone, so I tried
> emulators/qemu
> emulators/qemu-devel
> emulators/qemu-static
> emulators/qemu is known for me to fail since months and the days of 11-CURRENT, there is a
> compiler error spit out with clang 3.8 and now 3.9. The very same for qemu-devel (both
> ports used with standard options, no extras). See also Bug 214873
> (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214873) and Bug 215100
> (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215100).

I couldn't reproduce the compilation errors, it builds fine for me until
the link phase.

> I tried also emulators/qemu-static, but it also fails compiling on most recent 12-CURRENT
> (as the others, too, also my poudriere environment, which has also CURRENT jails) with
> [...]
> /usr/bin/ld:../config-host.ld:14: syntax error
> c++: error: linker command failed with exit code 1 (use -v to see invocation)
> [...]

But this I *can* reproduce.  It appears qemu wants to set the text
segment start address, using the -Ttext-segment=0x60000000 option to ld.

However, our base ld does not yet support this option, and then the
configure script tries to patch the default linker script using the
following construct:

      $ld --verbose | sed \
        -e '1,/==================================================/d' \
        -e '/==================================================/,$d' \
        -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
        -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld

Unfortunately, it seems to run /usr/local/bin/ld in this case, and this
results in the following busted linker script line, which cannot be

  PROVIDE (__executable_start = 0x60000000SEGMENT_START("text-segment", 0x08048000)); . = SEGMENT_START("text-segment", 0x08048000) + SIZEOF_HEADERS;

If it would use /usr/bin/ld instead, the patching would succeed, and
the line would become:

  PROVIDE (__executable_start = 0x60000000); . = 0x60000000 + SIZEOF_HEADERS;

which is probably what was intended.

Probably, the configure script needs to be patched to run base ld,
or use the same ld invocation for both checking the -Ttext-segment
option support and patching the linker script.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20161207/4a8d9f14/attachment.sig>

More information about the freebsd-ports mailing list