Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #158010 > unrolled thread

Compiling coreutils from source

Started byFlorian Pelgrim <florian.pelgrim@craneworks.de>
First post2015-09-17 12:20 +0200
Last post2015-09-18 19:20 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.debian.user


Contents

  Compiling coreutils from source Florian Pelgrim <florian.pelgrim@craneworks.de> - 2015-09-17 12:20 +0200
    Re: Compiling coreutils from source Stephen Powell <zlinuxman@wowway.com> - 2015-09-17 13:50 +0200
    Re: Compiling coreutils from source Ansgar Burchardt <"Ansgar Burchardt"@43-1.org> - 2015-09-18 09:50 +0200
    Re: Compiling coreutils from source Sven Joachim <svenjoac@gmx.de> - 2015-09-18 19:20 +0200

#158010 — Compiling coreutils from source

FromFlorian Pelgrim <florian.pelgrim@craneworks.de>
Date2015-09-17 12:20 +0200
SubjectCompiling coreutils from source
Message-ID<q9Esj-wC-43@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

Hi everyone,

I'm trying to static linking the coreutils. But for some reasons it
fails with a cryptic bug for me.

For building I'm using the vagrant box deb/jessie-amd64. So anyone who
is interested can reproduce it.

I have done the following steps:
> $ apt-get source coreutils
> $ cd coreutils-8.23/
> $ export CFLAGS="-static -O2 -g"
> $ ./configure
> $ make

And ended up whit this error:
> /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.9/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC

I tried to recompile it with -fPIC options like mentioned from the error...
> $ make clean
> $ export CFLAGS="-static -O2 -g -fPIC"
> $ make
... and ended up with the same error.

I googled a bit around and found this stackoverflow questions which
sounds similar to my problem:
http://askubuntu.com/questions/530617/how-to-make-a-static-binary-of-coreutils
But also the approved solution did not work for me.

Can someone explain me what I'm missing? :)

I would also be interested what this message means and if it can be
ignored or anything should be done:
> /home/vagrant/coreutils-8.23/src/whoami.c:85: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

Cheers
Flo

[toc] | [next] | [standalone]


#158012

FromStephen Powell <zlinuxman@wowway.com>
Date2015-09-17 13:50 +0200
Message-ID<q9FRp-2rZ-7@gated-at.bofh.it>
In reply to#158010
On Thu, 17 Sep 2015 06:04:03 -0400 (EDT), Florian Pelgrim wrote:
> 
> I'm trying to static linking the coreutils. But for some reasons it
> fails with a cryptic bug for me.
> 
> For building I'm using the vagrant box deb/jessie-amd64. So anyone who
> is interested can reproduce it.
> 
> I have done the following steps:
>   $ apt-get source coreutils
>   $ cd coreutils-8.23/
>   $ export CFLAGS="-static -O2 -g"
>   $ ./configure
>   $ make
> 
> And ended up whit this error:
>   /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.9/crtbeginT.o: relocation R_X86_64_32
>   against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC

I don't pretend to understand the make process well enough to explain why
you got the error that you did.  What I can tell you is that, in the past,
I have been successful with making local modifications to the coretuils package
by following a procedure similar to the following:

   apt-get source coreutils
   rm coreutils_*
   cd coreutils-8.23
   .
   . make local modifications
   .
   dpkg-buildpackage -b -uc -rfakeroot

Once quirk of the build process for this package is that you use

   fakeroot debian/rules clean1

to do a clean, rather than the usual

   fakeroot debian/rules clean

I don't know if this helps or not.

-- 
  .''`.     Stephen Powell    <zlinuxman@wowway.com>
 : :'  :
 `. `'`
   `-

[toc] | [prev] | [next] | [standalone]


#158044

FromAnsgar Burchardt <"Ansgar Burchardt"@43-1.org>
Date2015-09-18 09:50 +0200
Message-ID<q9YAH-4B2-37@gated-at.bofh.it>
In reply to#158010
Hi,

Florian Pelgrim writes:
> I would also be interested what this message means and if it can be
> ignored or anything should be done:
>> /home/vagrant/coreutils-8.23/src/whoami.c:85: warning: Using
>> 'getpwuid' in statically linked applications requires at runtime the
>> shared libraries from the glibc version used for linking

`getpwuid' uses shared objects to implement modules for user information
lookup (/etc/passwd) and the like; this is configured in
/etc/nsswitch.conf. As far as I know, the interface between glibc and
these modules is not stable. I don't know how often it changes though.

If you link statically, you have to have the correct versions of these
shared objects around: they cannot be linked in as it is only decided at
runtime which ones to load. If they aren't available, I would expect
failures in programs relying on name lookup: for example whoami cannot
get the username associated with the uid if `getpwuid' fails.

Ansgar

[toc] | [prev] | [next] | [standalone]


#158055

FromSven Joachim <svenjoac@gmx.de>
Date2015-09-18 19:20 +0200
Message-ID<qa7uh-Bk-7@gated-at.bofh.it>
In reply to#158010
On 2015-09-17 12:04 +0200, Florian Pelgrim wrote:

> I'm trying to static linking the coreutils. But for some reasons it
> fails with a cryptic bug for me.
>
> For building I'm using the vagrant box deb/jessie-amd64. So anyone who
> is interested can reproduce it.
>
> I have done the following steps:
>> $ apt-get source coreutils
>> $ cd coreutils-8.23/
>> $ export CFLAGS="-static -O2 -g"
>> $ ./configure
>> $ make
>
> And ended up whit this error:
>> /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.9/crtbeginT.o:
>> relocation R_X86_64_32 against `__TMC_END__' can not be used when
>> making a shared object; recompile with -fPIC

This happens when building libstdbuf.so.  I'm not sure why, but you
could work around that by passing "--enable-no-install-program=stdbuf"
to configure to not build the offending plugin.  Or use CC=clang, it
does not seem to have this problem.

Cheers,
       Sven

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web