rebuilding rpm SRPM on RISC-V Linux

50 views
Skip to first unread message

Billa Surendra

unread,
May 17, 2022, 8:27:32 AM5/17/22
to RISC-V SW Dev
Dear All,

I am trying to rebuild rpm-4.17.0-1 SRPM in my RISC-V Linux distro. I am rebuilding with rpmbuild -ba rpm.spec command. The rebuilding went fine for some time, after that it gave an error.

Error:

libtool: link: gcc -shared  -fPIC -DPIC  .libs/argv.o .libs/base64.o .libs/digest.o .libs/expression.o .libs/macro.o .libs/rpmhook.o .libs/rpmio.o .libs/rpmlog.o .libs/rpmmalloc.o .libs/rpmpgp.o .libs/rpmsq.o .libs/rpmsw.o .libs/url.o .libs/rpmvercmp.o .libs/rpmver.o .libs/rpmstring.o .libs/rpmfileutil.o .libs/rpmglob.o .libs/rpmkeyring.o .libs/rpmstrpool.o .libs/digest_openssl.o .libs/rpmlua.o  -Wl,--whole-archive ../misc/.libs/libmisc.a ../luaext/.libs/libluaext.a -Wl,--no-whole-archive  -lbz2 -lz /usr/lib/libpopt.so /usr/lib/liblzma.so -lzstd -llua -lm /usr/lib/libaudit.so -L/usr/lib /usr/lib/libcap-ng.so -lcrypto -ldl -lpthread %{_hardened_ldflags} -fstack-protector -O2 -g   -pthread -Wl,-soname -Wl,librpmio.so.9 -o .libs/librpmio.so.9.1.3
gcc: error: %{_hardened_ldflags}: No such file or directory
make[2]: *** [Makefile:625: librpmio.la] Error 1
make[2]: Leaving directory '/root/rpmbuild/BUILD/rpm-4.16.1.3/rpmio'
make[1]: *** [Makefile:1366: all-recursive] Error 1
make: *** [Makefile:795: all] Error 2
error: Bad exit status from /usr/var/tmp/rpm-tmp.HY1ivj (%build)


RPM build errors:
    Could not canonicalize hostname: C-DAC
    Bad exit status from /usr/var/tmp/rpm-tmp.HY1ivj (%build)

Can anyone please suggest to me where I am doing wrong?. I have understood that problem with GCC but I am not sure what I have to do.

Thanks
Billa 

Jingwei Wang

unread,
May 17, 2022, 10:51:35 AM5/17/22
to RISC-V SW Dev, billa.i...@gmail.com
The relevant rpm macro may not exist and needs to be checked. The following command may help:
rpm --eval=%{_hardened_ldflags}
grep -rn "hardened_ldflags" /usr/lib/rpm

Khem Raj

unread,
May 17, 2022, 11:24:37 AM5/17/22
to Billa Surendra, RISC-V SW Dev
it looks like you need to adapt rpm to your platform.

> Thanks
> Billa
>
> --
> You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
> To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CAKBF_5ri7D81QLb7wJr1oVKCL33KMR0%3D%2BA7omha7fRD-rr3MqQ%40mail.gmail.com.

Billa Surendra

unread,
May 17, 2022, 11:35:47 AM5/17/22
to Khem Raj, RISC-V SW Dev


On Tue, 17 May, 2022, 8:54 pm Khem Raj, <raj....@gmail.com> wrote:
On Tue, May 17, 2022 at 5:27 AM Billa Surendra
<billa.i...@gmail.com> wrote:
>
> Dear All,
>
> I am trying to rebuild rpm-4.17.0-1 SRPM in my RISC-V Linux distro. I am rebuilding with rpmbuild -ba rpm.spec command. The rebuilding went fine for some time, after that it gave an error.
>
> Error:
>
> libtool: link: gcc -shared  -fPIC -DPIC  .libs/argv.o .libs/base64.o .libs/digest.o .libs/expression.o .libs/macro.o .libs/rpmhook.o .libs/rpmio.o .libs/rpmlog.o .libs/rpmmalloc.o .libs/rpmpgp.o .libs/rpmsq.o .libs/rpmsw.o .libs/url.o .libs/rpmvercmp.o .libs/rpmver.o .libs/rpmstring.o .libs/rpmfileutil.o .libs/rpmglob.o .libs/rpmkeyring.o .libs/rpmstrpool.o .libs/digest_openssl.o .libs/rpmlua.o  -Wl,--whole-archive ../misc/.libs/libmisc.a ../luaext/.libs/libluaext.a -Wl,--no-whole-archive  -lbz2 -lz /usr/lib/libpopt.so /usr/lib/liblzma.so -lzstd -llua -lm /usr/lib/libaudit.so -L/usr/lib /usr/lib/libcap-ng.so -lcrypto -ldl -lpthread %{_hardened_ldflags} -fstack-protector -O2 -g   -pthread -Wl,-soname -Wl,librpmio.so.9 -o .libs/librpmio.so.9.1.3
> gcc: error: %{_hardened_ldflags}: No such file or directory
> make[2]: *** [Makefile:625: librpmio.la] Error 1
> make[2]: Leaving directory '/root/rpmbuild/BUILD/rpm-4.16.1.3/rpmio'
> make[1]: *** [Makefile:1366: all-recursive] Error 1
> make: *** [Makefile:795: all] Error 2
> error: Bad exit status from /usr/var/tmp/rpm-tmp.HY1ivj (%build)
>
>
> RPM build errors:
>     Could not canonicalize hostname: C-DAC
>     Bad exit status from /usr/var/tmp/rpm-tmp.HY1ivj (%build)
>
> Can anyone please suggest to me where I am doing wrong?. I have understood that problem with GCC but I am not sure what I have to do.
>

it looks like you need to adapt rpm to your platform.

rpm package installed already.

Khem Raj

unread,
May 17, 2022, 11:50:35 AM5/17/22
to Billa Surendra, RISC-V SW Dev
On Tue, May 17, 2022 at 8:35 AM Billa Surendra
<billa.i...@gmail.com> wrote:
>
>
>
> On Tue, 17 May, 2022, 8:54 pm Khem Raj, <raj....@gmail.com> wrote:
>>
>> On Tue, May 17, 2022 at 5:27 AM Billa Surendra
>> <billa.i...@gmail.com> wrote:
>> >
>> > Dear All,
>> >
>> > I am trying to rebuild rpm-4.17.0-1 SRPM in my RISC-V Linux distro. I am rebuilding with rpmbuild -ba rpm.spec command. The rebuilding went fine for some time, after that it gave an error.
>> >
>> > Error:
>> >
>> > libtool: link: gcc -shared -fPIC -DPIC .libs/argv.o .libs/base64.o .libs/digest.o .libs/expression.o .libs/macro.o .libs/rpmhook.o .libs/rpmio.o .libs/rpmlog.o .libs/rpmmalloc.o .libs/rpmpgp.o .libs/rpmsq.o .libs/rpmsw.o .libs/url.o .libs/rpmvercmp.o .libs/rpmver.o .libs/rpmstring.o .libs/rpmfileutil.o .libs/rpmglob.o .libs/rpmkeyring.o .libs/rpmstrpool.o .libs/digest_openssl.o .libs/rpmlua.o -Wl,--whole-archive ../misc/.libs/libmisc.a ../luaext/.libs/libluaext.a -Wl,--no-whole-archive -lbz2 -lz /usr/lib/libpopt.so /usr/lib/liblzma.so -lzstd -llua -lm /usr/lib/libaudit.so -L/usr/lib /usr/lib/libcap-ng.so -lcrypto -ldl -lpthread %{_hardened_ldflags} -fstack-protector -O2 -g -pthread -Wl,-soname -Wl,librpmio.so.9 -o .libs/librpmio.so.9.1.3
>> > gcc: error: %{_hardened_ldflags}: No such file or directory
>> > make[2]: *** [Makefile:625: librpmio.la] Error 1
>> > make[2]: Leaving directory '/root/rpmbuild/BUILD/rpm-4.16.1.3/rpmio'
>> > make[1]: *** [Makefile:1366: all-recursive] Error 1
>> > make: *** [Makefile:795: all] Error 2
>> > error: Bad exit status from /usr/var/tmp/rpm-tmp.HY1ivj (%build)
>> >
>> >
>> > RPM build errors:
>> > Could not canonicalize hostname: C-DAC
>> > Bad exit status from /usr/var/tmp/rpm-tmp.HY1ivj (%build)
>> >
>> > Can anyone please suggest to me where I am doing wrong?. I have understood that problem with GCC but I am not sure what I have to do.
>> >
>>
>> it looks like you need to adapt rpm to your platform.
>
>
> rpm package installed already.

yeah maybe thats not enough. See the error

Could not canonicalize hostname: C-DAC

This need to be fed into it somehow. I dont know much about how rpm
configurations work off hand but you can try to find,

Jim Wilson

unread,
May 17, 2022, 6:51:06 PM5/17/22
to Billa Surendra, RISC-V SW Dev
On Tue, May 17, 2022 at 5:27 AM Billa Surendra <billa.i...@gmail.com> wrote:
libtool: link: gcc -shared  -fPIC -DPIC  .libs/argv.o .libs/base64.o .libs/digest.o .libs/expression.o .libs/macro.o .libs/rpmhook.o .libs/rpmio.o .libs/rpmlog.o .libs/rpmmalloc.o .libs/rpmpgp.o .libs/rpmsq.o .libs/rpmsw.o .libs/url.o .libs/rpmvercmp.o .libs/rpmver.o .libs/rpmstring.o .libs/rpmfileutil.o .libs/rpmglob.o .libs/rpmkeyring.o .libs/rpmstrpool.o .libs/digest_openssl.o .libs/rpmlua.o  -Wl,--whole-archive ../misc/.libs/libmisc.a ../luaext/.libs/libluaext.a -Wl,--no-whole-archive  -lbz2 -lz /usr/lib/libpopt.so /usr/lib/liblzma.so -lzstd -llua -lm /usr/lib/libaudit.so -L/usr/lib /usr/lib/libcap-ng.so -lcrypto -ldl -lpthread %{_hardened_ldflags} -fstack-protector -O2 -g   -pthread -Wl,-soname -Wl,librpmio.so.9 -o .libs/librpmio.so.9.1.3
gcc: error: %{_hardened_ldflags}: No such file or directory

This %{...} should have been expanded by rpm into something interesting.   See the redhat-rpm-config file which adds this to build_ldflags, and then later defines it to add some options and the redhat-hardened-ld file.  You should look into why rpm didn't expand this.  It could be a problem with the config file, or rpm, or some random utility like awk/sed/m4 that rpm is using to process config files.  Maybe rpm has some debugging or verbose options you can enable to try to see what is happening inside rpm?

RPM build errors:
    Could not canonicalize hostname: C-DAC
    Bad exit status from /usr/var/tmp/rpm-tmp.HY1ivj (%build)

The second one is obviously a cascading error from above.  For the first one, I would guess that rpm tried to generate a fully qualified host name and failed.  Not unusual on a lab machine or home machine.  I don't know if that is important.  The build failure with hardened_ldflags seems more important.

Jim
 
Reply all
Reply to author
Forward
0 new messages