Gen 8.6 build on RHEL 8/9 "/usr/bin/ld: cannot find -lnsl"
search cancel

Gen 8.6 build on RHEL 8/9 "/usr/bin/ld: cannot find -lnsl"

book

Article ID: 278405

calendar_today

Updated On:

Products

Gen

Issue/Introduction

Trying to build the Gen sample application server manager P900 on Red Hat Enterprise Linux (RHEL) version 8 or 9 and it fails:
/home/gen86/rmt_files/sample_model/P900   Splitting P900.rmt
/home/gen86/rmt_files/sample_model/P900   Split Complete P900.rmt
/home/gen86/rmt_files/sample_model/P900   Building P900.rmt
/home/gen86/rmt_files/sample_model/P900  Build-FAILED P900.rmt

The P900.out file shows:
/usr/bin/ld: cannot find -lnsl
collect2: error: ld returned 1 exit status
make: *** [/home/gen86/rmt_files/sample_model/gen866319.i:70:
/home/gen86/rmt_files/sample_model/P900] Error 1
Error installing P900
ERROR Make failed!
instmsgj P900 IEFSIGNAL:FAIL

Environment

Gen 8.6
Red Hat Enterprise Linux (RHEL)versions 8 and 9

Cause

The libnsl and libnsl2 packages are already installed:

# rpm -qa --last | grep libnsl
libnsl-2.28-236.el8.7.x86_64                  Tue 23 Jan 2024 05:08:18 AM UTC
libnsl2-1.2.0-2.20180605git4a062cf.el8.x86_64 Thu 02 Feb 2023 07:46:33 PM UTC

However, under directory /usr/lib64 there is no symbolic link for libnsl.so i.e.
# cd /usr/lib64
# ls -al libnsl*
-rwxr-xr-x  1 root root  99152 Jan 23 05:08 libnsl-2.28.so
lrwxrwxrwx  1 root root     14 Sep 20 10:54 libnsl.so.1 -> libnsl-2.28.so
lrwxrwxrwx. 1 root root     15 Aug 12  2018 libnsl.so.2 -> libnsl.so.2.0.0
-rwxr-xr-x. 1 root root 116408 Aug 12  2018 libnsl.so.2.0.0

Resolution

Create a symbolic link for libnsl.so to libnsl.so.1 (which is already a symbolic link to libnsl-2.28.so) i.e.
# cd /usr/lib64
# ln -s libnsl.so.1 libnsl.so
# ls -al libnsl*
-rwxr-xr-x  1 root root  99152 Jan 23 05:08 libnsl-2.28.so
lrwxrwxrwx  1 root root     11 Jan 24 22:39 libnsl.so -> libnsl.so.1
lrwxrwxrwx  1 root root     14 Sep 20 10:54 libnsl.so.1 -> libnsl-2.28.so
lrwxrwxrwx. 1 root root     15 Aug 12  2018 libnsl.so.2 -> libnsl.so.2.0.0
-rwxr-xr-x. 1 root root 116408 Aug 12  2018 libnsl.so.2.0.0

The P900 build was then successful.

Additional Information

This appears to be a well reported problem e.g. Stack Exchange: Installing DBD:Oracle on RedHat 8.8
Potentially resolved with a later update: Red Hat Bugzilla – Bug 1814151. However, during Gen Support's testing, they could get that update installed and stayed with the resolution of manually creating the symbolic link