I'm trying to run a file name remote build which is to build a package on a target server. My target server is HP-UX-itanium 64 bit. When I run the remote build, somehow it cannot find libncurses.so or maybe it looks for the libncurses.so at some other location. This only happens on HP-UX itanium, while other server like Solaris, HP-UX-mp 32 bit, and other Unix platform can run the file smoothly.

This is the error code:

libtool: link: gcc -g -O2 -o test_setpwnam test_setpwnam.o setpwnam.o  -L/usr/local/lib/hpux32 -lncurses -lsec -ldl -lpam -lpthread -Wl,+b -Wl,/usr/local/lib
/usr/bin/make  check-TESTS
/usr/lib/hpux32/dld.so: Unable to find library 'libncurses.so'.

I don't know why it keep looking into _/usr/lib/hpux32_ when I think I have the code look into /usr/local/lib/hpux32"_ (the libncurses.so is located in that directory).

This is part of the remote build code which I think is related.


my $remote_uname = `ssh $USER\@$host uname -a`;
my $local_uname = `uname -a`;
my $homepath = "/home";
my $build = "";
my $configure_param = " --with-ncurses --disable-openssl --disable-thread-support --disable-shared --disable-protoc";
my $gzip = "gzip";
my $configure_env = "PATH=\$PATH:/usr/local/bin:/usr/local/lib/hpux32 CPPFLAGS=-I/usr/local/include libevent_cv_getaddrinfo=no";
my $make_env = "PATH=\$PATH:/usr/local/bin";
my $whoami = "whoami";

} elsif ($remote_uname =~ /^HP-UX/) {
    $build = "cd mypackage-$version/package/hpux && sh ./build.sh";
    $gzip = "/usr/contrib/bin/gzip";
    $configure_param .= " --with-ncurses";
    $configure_env .= " LDFLAGS=\"-L/usr/local/lib/hpux32\""; //aint this the part where I'm suppose to specify the search?
    die "Unknown remote uname [$remote_uname]";

rmake "rm -rf mypackage-${version}*";
make "scp mypackage-$version.tar.gz $USER\@$host:$homepath/$USER";
rmake "$gzip -dc mypackage-$version.tar.gz | tar xvf -";
rmake "cd mypackage-$version && $configure_env ./configure $configure_param && $make_env make && $make_env make check";
rmake $build;

This is my first time doing debug on perl code, so please excuse me if what I conclude is wrong.

  • On my HP-UX 11.31 more or less the same command runs without any errors: gcc -g -O2 -o test_setpwnam main.o -L/usr/local/lib/hpux32 -lncurses -lsec -ldl -lpam -lpthread -Wl,+b -Wl,/usr/local/lib/hpux32. The only error which I see in your command line is that you must probably write -Wl,/usr/local/lib/hpux32. Could you also add: file /usr/local/lib/hpux32/libncurses.so?
    – user17530
    Commented Dec 2, 2013 at 9:36
  • By adding file do you mean like this? '$file = /usr/local/lib/hpux32/libncurses.so' Commented Dec 2, 2013 at 9:58
  • No I do not. I mean that on my HP-UX 11.31 file /usr/local/lib/hpux32/libncurses.so in bash gives: /usr/local/lib/hpux32/libncurses.so: ELF-32 shared object file - IA64 and ls -l /usr/local/lib/hpux32/libncurses.so gives the size of the file 803192. Is it the same on your server?
    – user17530
    Commented Dec 2, 2013 at 10:12
  • When I type file /usr/local/lib/hpux32/libncurses.so in bash, it display the same as yours. But when I ls -l the file. the file are 1148408. Commented Dec 2, 2013 at 10:29
  • @skwllsp Also when I add in the -Wl,/usr/local/lib/hpux32, it returns this error 'checking build system type... ia64-hp-hpux11.23 checking for gcc... gcc checking whether the C compiler works... no configure: error: in `/home/fikrie/mysoftware': configure: error: C compiler cannot create executables' Commented Dec 2, 2013 at 10:35

1 Answer 1


I have tried compiling it manually before posting it here, it does work. I'm actually out of idea on how to debug it since my knowledge on perl is really low.

The error seems to happen when you do this step $make_env make check in your perl script. You have built test_setpwnam and when you run it you get:

/usr/lib/hpux32/dld.so: Unable to find library 'libncurses.so'.

The problem is that test_setpwnam depends on libncurses.so but the shared library dynamic path search of test_setpwnam does not include /usr/local/lib/hpux32. It does not include /usr/local/lib/hpux32 because when you (or your script) was building test_setpwnam you added to the command line -Wl,+b -Wl,/usr/local/lib and it cleared all default paths.

There are a few ways to fix the problem:

1) Add setting dynamic search to LDFLAGS. This is an example:

$configure_env .= "LDFLAGS=\"-L/usr/local/lib/hpux32 -Wl,+concatrpath -Wl,+b -Wl,/usr/local/lib -Wl,+b -Wl,/usr/local/lib/hpux32\""; 

2) You can set the LD_LIBRARY_PATH environment variable. This variable expands the shared library dynamic path search. Change in your script:

my $make_env = "PATH=\$PATH:/usr/local/bin LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib/hpux32";

3) If you can find where -Wl,+b -Wl,/usr/local/lib is added then get rid of it. On HP-UX the linker will set a correct shared library dynamic path search that includes all necessary paths

  • Thx for the answer. I followed the 2nd step and it helps to solve my problem. Commented Dec 5, 2013 at 3:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .