public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* Build libc6-2.28 from source: ld-2.28.so cause errors when installing deb package
@ 2021-07-01  6:01 Kenny Bian
  2021-07-01  6:42 ` Florian Weimer
  0 siblings, 1 reply; 5+ messages in thread
From: Kenny Bian @ 2021-07-01  6:01 UTC (permalink / raw)
  To: libc-help

We try to build libc6-2.28 from source code. Our board runs Ubuntu
18.04 in armhf architecture. We downloaded the source code from
https://launchpad.net/ubuntu/+source/glibc/2.28-0ubuntu1.
Here is what we did to create the deb package:
1. We build it by using these bash commands:
/usr/bin/dpkg-source -x glibc_2.28-0ubuntu1.dsc libc6-2.28
pushd libc6-2.28/
mkdir build
pushd build/
../configure \
    --host=arm-linux-gnueabihf \
    --prefix=/tmp/armhf/libc6/usr \
    --enable-obsolete-nsl
make
make install

2. Create a deb folder and copy files to this folder. Also put the
control file and post/pre scripts in "DEBIAN" folder in the deb
folder.
3. Create deb file: /usr/bin/dpkg-deb --build --root-owner-group $deb_folder/

The deb file was created. But there are errors when we install the deb
in our armhf board(sudo dpkg -i libc6_2.28-0ubuntu1-my_armhf.deb):
Unpacking libc6:armhf (2.28-0ubuntu1) over (2.28-0ubuntu1) ...
/bin/sh: error while loading shared libraries: libc.so.6: cannot open
shared object file: No such file or directory
dpkg: warning: old libc6:armhf package post-removal script subprocess
returned error exit status 127
dpkg: trying script from the new package instead ...
/bin/sh: error while loading shared libraries: libc.so.6: cannot open
shared object file: No such file or directory
dpkg: error processing archive libc6_2.28-0ubuntu1-my_armhf.deb (--install):
 new libc6:armhf package post-removal script subprocess returned error
exit status 127

After investigation, we finally narrowed it down to "ld-2.28.so". Its
path in the deb file is "lib/arm-linux-gnueabihf/ld-2.28.so". The file
ld-2.28.so built by us will cause the errors above. But the one from
the official deb works fine. We used the file ld-2.28.so from
https://launchpad.net/ubuntu/+source/glibc/2.28-0ubuntu1/+build/15300581/+files/libc6_2.28-0ubuntu1_armhf.deb
to replace the built one in our deb. There will be no errors. The deb
package can be installed properly.

I used the tool readelf, nm and objdump to check the files. There
seems to be no difference between the built file by me and the one
from the official deb. Could you tell me what could be wrong? Is there
anything I can do to investigate it?

Help please!
Thanks in advance!

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

* Re: Build libc6-2.28 from source: ld-2.28.so cause errors when installing deb package
  2021-07-01  6:01 Build libc6-2.28 from source: ld-2.28.so cause errors when installing deb package Kenny Bian
@ 2021-07-01  6:42 ` Florian Weimer
  2021-07-01 15:52   ` Mike Frysinger
  2021-07-02  7:52   ` Kenny Bian
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Weimer @ 2021-07-01  6:42 UTC (permalink / raw)
  To: Kenny Bian via Libc-help

* Kenny Bian via Libc-help:

> We try to build libc6-2.28 from source code. Our board runs Ubuntu
> 18.04 in armhf architecture. We downloaded the source code from
> https://launchpad.net/ubuntu/+source/glibc/2.28-0ubuntu1.
> Here is what we did to create the deb package:
> 1. We build it by using these bash commands:
> /usr/bin/dpkg-source -x glibc_2.28-0ubuntu1.dsc libc6-2.28
> pushd libc6-2.28/
> mkdir build
> pushd build/
> ../configure \
>     --host=arm-linux-gnueabihf \
>     --prefix=/tmp/armhf/libc6/usr \
>     --enable-obsolete-nsl
> make
> make install

make install without a temporary DESTDIR is not supported.
Unfortunately the instructions do not make this clear.

The issue is that make uses separate commands for installing files, and
half-way through the update, the system is in an inconsistent state and
further commands fail, and the installation is not able to complete as a
result.

Using a temporary directory with DESTDIR and then rsync avoids the issue
(cp truncates the destination file, causing other issues).

Thanks,
Florian


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

* Re: Build libc6-2.28 from source: ld-2.28.so cause errors when installing deb package
  2021-07-01  6:42 ` Florian Weimer
@ 2021-07-01 15:52   ` Mike Frysinger
  2021-07-01 21:02     ` Florian Weimer
  2021-07-02  7:52   ` Kenny Bian
  1 sibling, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2021-07-01 15:52 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Kenny Bian via Libc-help

On 01 Jul 2021 08:42, Florian Weimer via Libc-help wrote:
> * Kenny Bian via Libc-help:
> 
> > We try to build libc6-2.28 from source code. Our board runs Ubuntu
> > 18.04 in armhf architecture. We downloaded the source code from
> > https://launchpad.net/ubuntu/+source/glibc/2.28-0ubuntu1.
> > Here is what we did to create the deb package:
> > 1. We build it by using these bash commands:
> > /usr/bin/dpkg-source -x glibc_2.28-0ubuntu1.dsc libc6-2.28
> > pushd libc6-2.28/
> > mkdir build
> > pushd build/
> > ../configure \
> >     --host=arm-linux-gnueabihf \
> >     --prefix=/tmp/armhf/libc6/usr \
> >     --enable-obsolete-nsl
> > make
> > make install
> 
> make install without a temporary DESTDIR is not supported.
> Unfortunately the instructions do not make this clear.

should we add an $(error) in this case ?  shouldn't be too hard to do ...
-mike

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

* Re: Build libc6-2.28 from source: ld-2.28.so cause errors when installing deb package
  2021-07-01 15:52   ` Mike Frysinger
@ 2021-07-01 21:02     ` Florian Weimer
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Weimer @ 2021-07-01 21:02 UTC (permalink / raw)
  To: Kenny Bian via Libc-help

* Mike Frysinger via Libc-help:

> On 01 Jul 2021 08:42, Florian Weimer via Libc-help wrote:
>> * Kenny Bian via Libc-help:
>> 
>> > We try to build libc6-2.28 from source code. Our board runs Ubuntu
>> > 18.04 in armhf architecture. We downloaded the source code from
>> > https://launchpad.net/ubuntu/+source/glibc/2.28-0ubuntu1.
>> > Here is what we did to create the deb package:
>> > 1. We build it by using these bash commands:
>> > /usr/bin/dpkg-source -x glibc_2.28-0ubuntu1.dsc libc6-2.28
>> > pushd libc6-2.28/
>> > mkdir build
>> > pushd build/
>> > ../configure \
>> >     --host=arm-linux-gnueabihf \
>> >     --prefix=/tmp/armhf/libc6/usr \
>> >     --enable-obsolete-nsl
>> > make
>> > make install
>> 
>> make install without a temporary DESTDIR is not supported.
>> Unfortunately the instructions do not make this clear.
>
> should we add an $(error) in this case ?  shouldn't be too hard to do ...

Yeah, I was thinking that, too.  I thought I even had a patch for it,
but doesn't look like it.  Along with an update to INSTALL, that would
be quite useful, I think.

Thanks,
Florian


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

* Re: Build libc6-2.28 from source: ld-2.28.so cause errors when installing deb package
  2021-07-01  6:42 ` Florian Weimer
  2021-07-01 15:52   ` Mike Frysinger
@ 2021-07-02  7:52   ` Kenny Bian
  1 sibling, 0 replies; 5+ messages in thread
From: Kenny Bian @ 2021-07-02  7:52 UTC (permalink / raw)
  To: Florian Weimer, libc-help

[-- Attachment #1: Type: text/plain, Size: 3055 bytes --]

Thanks for your info, Florian!

I updated my build script like this:
pushd build/
../configure \
    --host=arm-linux-gnueabihf \
    --prefix=/usr \
    --enable-obsolete-nsl
make
make install DESTDIR=/tmp/armhf/libc6

Then I copied the files from the new location /tmp/armhf/libc6 to the
deb folder. Then I built the deb file. When I tried to install the new
deb on my board, I got the same error as yesterday.
I checked. Even though I added "DESTDIR=/tmp/armhf/libc6" in "make
install". The ld-2.28.so has the same size as the one I built
yesterday. Again, I copied the ld-2.28.so from the "official" deb
file, then rebuilt my deb - the rebuilt deb works for installation.

I'm sure it's correct to add DESTDIR in "make install". But I guess
there may be other reasons why ld-2.28.so doesn't work. Potentially I
guess there is a chance that other "so" files may not work either
because they don't get a chance to run yet. This ld-2.28.so shows
error is just because the installation of the deb file triggers it. Is
there any debug approach to narrow down the problem?

By the way, here is how I build the deb file:
- Create the folder structure
- Copy files in the folders. Also copy or create soft links in the folder.
- Strip binary files by using arm-linux-gnueabihf-strip. This will
help reduce the size of the files.
- Run this command to build the deb: dpkg-deb --build
--root-owner-group deb_folder/

I used this approach to build libtinfo and libread packages. It seems
to be working.

I attach the deb file built by me. Not sure if you can receive it.
Hopefully it's not blocked by the mail server.
To extract the DEBIAN which has control file and post/pre scripts:
dpkg -e ./libc6_2.28-0ubuntu1-my_armhf.deb.deb
To extract file: dpkg-deb -xv libc6_2.28-0ubuntu1-my_armhf.deb.deb deb_folder/

If you have more info, let me know please.
Thanks!

On Wed, Jun 30, 2021 at 11:42 PM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Kenny Bian via Libc-help:
>
> > We try to build libc6-2.28 from source code. Our board runs Ubuntu
> > 18.04 in armhf architecture. We downloaded the source code from
> > https://launchpad.net/ubuntu/+source/glibc/2.28-0ubuntu1.
> > Here is what we did to create the deb package:
> > 1. We build it by using these bash commands:
> > /usr/bin/dpkg-source -x glibc_2.28-0ubuntu1.dsc libc6-2.28
> > pushd libc6-2.28/
> > mkdir build
> > pushd build/
> > ../configure \
> >     --host=arm-linux-gnueabihf \
> >     --prefix=/tmp/armhf/libc6/usr \
> >     --enable-obsolete-nsl
> > make
> > make install
>
> make install without a temporary DESTDIR is not supported.
> Unfortunately the instructions do not make this clear.
>
> The issue is that make uses separate commands for installing files, and
> half-way through the update, the system is in an inconsistent state and
> further commands fail, and the installation is not able to complete as a
> result.
>
> Using a temporary directory with DESTDIR and then rsync avoids the issue
> (cp truncates the destination file, causing other issues).
>
> Thanks,
> Florian
>

[-- Attachment #2: libc6_2.28-0ubuntu1-my_armhf.deb --]
[-- Type: application/octet-stream, Size: 2346156 bytes --]

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

end of thread, other threads:[~2021-07-02  7:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01  6:01 Build libc6-2.28 from source: ld-2.28.so cause errors when installing deb package Kenny Bian
2021-07-01  6:42 ` Florian Weimer
2021-07-01 15:52   ` Mike Frysinger
2021-07-01 21:02     ` Florian Weimer
2021-07-02  7:52   ` Kenny Bian

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).