hyperion icon indicating copy to clipboard operation
hyperion copied to clipboard

Not an issue, just a question about nsl library importance

Open vmisev opened this issue 7 months ago • 8 comments

Is it nsl library (libnsl*) important for SDL Hercules (and MVS that it runs) functioning properly?

I'm on the self-assigned quest to build SDL Hercules bin/lib that will work across various Linux distros (to help Rob with his TK5), but Hercules (4.7) in TK5 is not Linux universal, it looks like that it has been built on Debian and it fails where there is no libbz2.so.1.0 (other distros use libbz2.so.1).

I tried my luck with Gentoo x86_64 (I hope to build there for aarch64/arm/x86 as well), but it comes with already present libnsl.so.3 which is not universally available, and it links Hercules to it (AFAIK some other distros, if they have at all preinstalled nsl, use libnsl.so.[1|2])

I decided to remove nsl from Gentoo (I'm aware that this might screw other Gentoo software, but I only care about hercules-helper doing its job).

After removing nsl, I made Hercules build on Gentoo that seems like working on Fedora 42, Debian Trixie and Alt Sisyphus, TK5 MVS does IPL and it shutdown properly on all of the mentioned distros using the same Gentoo based build, but IDK did I screwed something else by not linking nsl?

Thanks!

vmisev avatar May 05 '25 19:05 vmisev

What is trying to pull in libnsl?
Personally, I've never heard of that library before.

wrljet avatar May 07 '25 13:05 wrljet

configure checks for -lnsl and if found then it got linked with (at least) hercules. It can be seen in hercules-buildall-[date].log: " checking for gethostbyname in -lnsl... [no|yes] "

vmisev avatar May 07 '25 14:05 vmisev

OK, so it's looking for gethostbyname.

wrljet avatar May 07 '25 14:05 wrljet

Strange that I didn't have libnsl on Alt before, so I installed both "libnsl2 - Public client interface library for NIS(YP) and NIS+" (libnsl.so.2) and "libnsl2-devel - Development files for libnsl" to check will there be any difference with helper builds and yet configure is not picking it up: "checking for gethostbyname in -lnsl... no"
despite /usr/lib64/pkgconfig/libnsl.pc being present.

So, is it safe to assume that libnsl is not so important for hercules working properly?

vmisev avatar May 07 '25 15:05 vmisev

I see configure compiles a test pgm with -lnsl to see if gethostbyname() exists and sets #define HAVE_LIBNSL 1 in config.h if so.

I don't see anywhere in the code where HAVE_LIBNSL is tested.

gethostbyname() is called in various places, and I don't see any checking for its availability. It's just assumed to be present.

I really don't know what libnsl is or does. Google says "The libnsl package contains the public client interface for NIS(YP). It replaces the NIS library that used to be in glibc." Which doesn't help me understand any better. :)

wrljet avatar May 07 '25 15:05 wrljet

gethostbyname() is called in various places, and I don't see any checking for its availability. It's just assumed to be present.

Looks like that gethostbyname() is defined in libc:

$ nm -D /usr/lib/libc.so.6 | grep gethostbyname
00146830 T gethostbyname@@GLIBC_2.0
00146a60 T gethostbyname2@@GLIBC_2.0
00146c90 T gethostbyname2_r@@GLIBC_2.1.2
00177920 T gethostbyname2_r@GLIBC_2.0
00147140 T gethostbyname_r@@GLIBC_2.1.2
00177960 T gethostbyname_r@GLIBC_2.0
0012dfa0 T _nss_dns_gethostbyname2_r@@GLIBC_PRIVATE
0012df20 T _nss_dns_gethostbyname3_r@@GLIBC_PRIVATE
0012e100 T _nss_dns_gethostbyname4_r@@GLIBC_PRIVATE
0012e050 T _nss_dns_gethostbyname_r@@GLIBC_PRIVATE
00151060 T _nss_files_gethostbyname2_r@@GLIBC_PRIVATE
00150e90 T _nss_files_gethostbyname3_r@@GLIBC_PRIVATE
00151090 T _nss_files_gethostbyname4_r@@GLIBC_PRIVATE
00151030 T _nss_files_gethostbyname_r@@GLIBC_PRIVATE

vmisev avatar May 07 '25 17:05 vmisev

Vladimir,

Evidently my Gentoo VM has this libnsl installed. How can I remove the package?

Thanks, Bill

wrljet avatar May 08 '25 22:05 wrljet

Warning 1: I'm a total noob when comes to Gentoo, installed it for the first time just a week ago.
Warning 2: removing needed pkg/lib can make other things that need that pkg broken; use:
emerge -pv --depclean <package> to check it first.

Finally, the answer:
Using otherwise very not recommended "-C" was the only way that I could remove it
sudo emerge -C net-libs/libnsl

BTW, I posted a on your hercules-helper git about packages actually needed for helper to successfully build on Gentoo.

vmisev avatar May 09 '25 00:05 vmisev

@wrljet Is this issue resolved? Should it be closed now?

Fish-Git avatar Aug 24 '25 06:08 Fish-Git

Closing due to non-response.

Fish-Git avatar Aug 29 '25 07:08 Fish-Git

@wrljet Is this issue resolved? Should it be closed now?

I believe so.

wrljet avatar Aug 29 '25 13:08 wrljet