public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* How can I link the binutils using the static 'libc.a' instead of the dynamic 'libc.so'?
@ 2017-04-26  9:02 Martin J. O'Riordan
  2017-05-02 15:51 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Martin J. O'Riordan @ 2017-04-26  9:02 UTC (permalink / raw)
  To: binutils

I am building Binutils v2.27, but need to have the executables linked
against the static 'libc.a' rather than the default which uses the dynamic
'libc.so'.

How can I instruct 'configure' to do this?  Is it even possible?

I have experimented with setting CFLAGS, CFLAGS_FOR_BUILD,
CFLAGS_FOR_TARGET, LDFLAGS, LDFLAGS_FOR_BUILD and LDFLAGS_FOR_TARGET to
'-static' and/or '-static-libgcc' but 'ldd' still shows the executables as
being bound to '/lib64/libc.so.6'.

My build system is "CentOS Linux release 7.1.1503" and the installed version
of GCC is "gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)".

Thanks,

	MartinO


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How can I link the binutils using the static 'libc.a' instead of the dynamic 'libc.so'?
  2017-04-26  9:02 How can I link the binutils using the static 'libc.a' instead of the dynamic 'libc.so'? Martin J. O'Riordan
@ 2017-05-02 15:51 ` Nick Clifton
       [not found]   ` <CAESLzoNHJu0v1mtVtGf+Fj+SJVZ=cVE4O4mbifP1Syh_S4M8bw@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2017-05-02 15:51 UTC (permalink / raw)
  To: Martin J. O'Riordan, binutils

Hi Martin,

> How can I instruct 'configure' to do this?  Is it even possible?

No!  I was surprised to find this out, but it seems that the configure
and build system really does not want you to link with a static C library.

You can do it by hand of course, but that does not make for a reproducible build.
You can edit the makefiles too, but again this is not reliable in the long term.

Sorry - it looks like there is no easy solution to this problem.

Cheers
  Nick


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How can I link the binutils using the static 'libc.a' instead of the dynamic 'libc.so'?
       [not found]   ` <CAESLzoNHJu0v1mtVtGf+Fj+SJVZ=cVE4O4mbifP1Syh_S4M8bw@mail.gmail.com>
@ 2017-05-04  7:12     ` Martin O'Riordan
  0 siblings, 0 replies; 3+ messages in thread
From: Martin O'Riordan @ 2017-05-04  7:12 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

On 4 May 2017 at 08:06, Martin O'Riordan <martin.oriordan@movidius.com> wrote:
> Thanks Nick,
>
> Good to know that I wasn't stumped over something simple that I should've
> spotted.  My goal was to statically link the whole tool-chain, but reckoned
> I'd better get Binutils figured out before I tackled Gcc.  I won't make and
> hand-written changes, as you say, this is not reliable or future proof.
>
> All the best,
>
> MartinO
>
>
> On 2 May 2017 at 16:51, Nick Clifton <nickc@redhat.com> wrote:
>>
>> Hi Martin,
>>
>> > How can I instruct 'configure' to do this?  Is it even possible?
>>
>> No!  I was surprised to find this out, but it seems that the configure
>> and build system really does not want you to link with a static C library.
>>
>> You can do it by hand of course, but that does not make for a reproducible
>> build.
>> You can edit the makefiles too, but again this is not reliable in the long
>> term.
>>
>> Sorry - it looks like there is no easy solution to this problem.
>>
>> Cheers
>>   Nick
>>
>>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-04  7:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-26  9:02 How can I link the binutils using the static 'libc.a' instead of the dynamic 'libc.so'? Martin J. O'Riordan
2017-05-02 15:51 ` Nick Clifton
     [not found]   ` <CAESLzoNHJu0v1mtVtGf+Fj+SJVZ=cVE4O4mbifP1Syh_S4M8bw@mail.gmail.com>
2017-05-04  7:12     ` Martin O'Riordan

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 read-only IMAP folder(s) and NNTP newsgroup(s).