mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Samuel Sadok <innovation-labs@appinstall.ch>
To: musl@lists.openwall.com
Subject: Re: Unable to build with --enable-shared
Date: Sun, 23 Oct 2016 02:22:28 +0200	[thread overview]
Message-ID: <CAJ4e7SWaAyy7cuU1x_G2DRKWzmNsyoJiQ8o8yPZY0+B57CUTgA@mail.gmail.com> (raw)
In-Reply-To: <20161022215829.GA5749@port70.net>

2016-10-22 23:58 GMT+02:00 Szabolcs Nagy <nsz@port70.net>:
> * Samuel Sadok <innovation-labs@appinstall.ch> [2016-10-22 22:37:46 +0200]:
>> I am unable to build musl with --enable-shared. Multiple issues in
>> unrelated projects (e.g. here: https://bugs.swift.org/browse/SR-1023)
>> suggest that the culprit is a change in behaviour between binutils
>> 2.25 and 2.26.
>>
>
> that bug is different, that's about object symbols
>
> (swift seems to misuse protected visibility objects,
> and instead of fixing the problem they switched to the
> gold linker which does not yet have the bfd linker fix,
> such incompetence is frustrating..  however the issue
> does not affect musl: we don't mark objects protected
> to avoid issues with broken toolchains.)

That's precisely why I'm trying to get away from Apple.

>
>> $ make
>> [...]
>> x86_64-pc-linux-gnu-gcc  -D_XOPEN_SOURCE=700 -I./arch/x86_64
>> -I./arch/generic -Iobj/src/internal -I./src/internal -Iobj/include
>> -I./include  -include vis.h -B/usr/local/bin/x86_64-pc-linux-gnu-
>> -fPIC -c -o obj/src/process/posix_spawn.lo src/process/posix_spawn.c
>
> some flags are missing here.. e.g. freestanding flags

Thanks for the pointer, that turned out to be the problem.

I should mention that I am cross-compiling from macOS. Since I had a
Linux VM flying around, I tried to build musl there (success) and
compared the logs.
Looking at config.mak, there apparently was a serious misconfiguration:

config.mak on the cross-build system (macOS):

CFLAGS_AUTO = -include vis.h
CFLAGS_C99FSE =
CFLAGS_MEMOPS =
CFLAGS_NOSSP =
LDFLAGS_AUTO =
LIBCC =

config.mak on Ubuntu:

CFLAGS_AUTO = -Os -pipe -fomit-frame-pointer -fno-unwind-tables
-fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections
-Werror=implicit-function-declaration -Werror=implicit-int
-Werror=pointer-sign -Werror=pointer-arith -include vis.h
CFLAGS_C99FSE = -std=c99 -nostdinc -ffreestanding
-fexcess-precision=standard -frounding-math -Wa,--noexecstack
CFLAGS_MEMOPS = -fno-tree-loop-distribute-patterns
CFLAGS_NOSSP = -fno-stack-protector
LDFLAGS_AUTO = -Wl,--sort-section,alignment -Wl,--sort-common
-Wl,--gc-sections -Wl,--hash-style=both -Wl,--no-undefined
-Wl,--exclude-libs=ALL -Wl,-Bsymbolic-functions
LIBCC = -lgcc -lgcc_eh

After adding the missing flags (except the seemingly unused -lgcc_eh),
the build succeeded on macOS.

I'm not sure if this can be fixed cleanly by passing appropriate
arguments to configure or if the script should be patched. My
experience with configure scripts is limited, but I will try to look
further into what went wrong exactly.


  reply	other threads:[~2016-10-23  0:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-22 20:37 Samuel Sadok
2016-10-22 21:58 ` Szabolcs Nagy
2016-10-23  0:22   ` Samuel Sadok [this message]
2016-10-23 16:17     ` Rich Felker
2016-10-23 22:20       ` Samuel Sadok
2016-10-24  0:19         ` Laine Gholson
2016-10-24  0:28           ` Rich Felker
2016-10-24 10:22             ` Samuel Sadok

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ4e7SWaAyy7cuU1x_G2DRKWzmNsyoJiQ8o8yPZY0+B57CUTgA@mail.gmail.com \
    --to=innovation-labs@appinstall.ch \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).