Getting CASA working on a SuSE Linux machine

elnjensen
Posts: 5
Joined: Tue Apr 30, 2013 9:01 am

Getting CASA working on a SuSE Linux machine

Postby elnjensen » Mon Jun 03, 2013 11:55 am

Yesterday I was able to get CASA 4.1.0 installed and working on a SuSE Linux machine, so I thought I would share what I did, in case it is of use to others.

After downloading and unpacking, and setting my PATH, the initial attempt to start CASA failed because it didn't find the GSL libraries. So, I downloaded and compiled them, and added their location to LD_LIBRARY_PATH in the casapy script. (Libraries are installed in a non-standard location, since I don't have root access on this machine.) No problem there, very straightforward.

After doing that, then CASA would begin to start up (i.e. no complaints about libraries not being found), but then would give this error:

sh: symbol lookup error: /usr/ue/0/ejensen1/casa/casapy-41.0.24668-001-64b/lib64/libreadline.so.5: undefined symbol: BC

A little bit of googling revealed that this can occur when libreadline is not linked against ncurses. (e.g. https://bugzilla.redhat.com/show_bug.cgi?id=165979 ). I checked the casa-provided version of ncurses with 'nm', and it doesn't provide this symbol, so I:

- Downloaded the source for ncurses and built that library (providing -fPIC as a compiler flag, i.e. I gave CFLAGS=-fPIC as an argument to configure).
- Downloaded the source for readline and built that, adding -lncurses and -L/path/to/my/libncurses as flags for building the shared library. (Note that the Makefile for the shared library is in the subdirectory 'shlib' off the main build directory - that's the one you need to edit after running configure, not the main Makefile.)
- Made a symbolic link from my new libreadline.so.6 to libreadline.so.5 (since that is specifically what CASA looks for). (I guess I could have just built v5, but v6 is the latest so I built that.)
- Added the location of my new libreadline.so to the *front* of LD_LIBRARY_PATH, so it would be found before the CASA-supplied libreadline.

This worked! I can now run CASA on that machine. The machine in question is a machine called "Blacklight" at the Pittsburgh Supercomputing Center, part of NSF's XSEDE network of supercomputing facilities. The docs for the machine (https://www.xsede.org/web/guest/psc-blacklight) say that it runs "an enhanced version of the SuSE Linux operating system". So I don't know if these instructions apply to SuSE linux in general, or if there are particular quirks of that machine, but perhaps this will be useful to someone.

Tags:

nhurleywalker
Posts: 2
Joined: Tue May 20, 2014 3:25 am

Re: Getting CASA working on a SuSE Linux machine

Postby nhurleywalker » Tue May 20, 2014 4:50 am

Thanks for posting these detailed instructions. I followed them to the letter on a SUSE 11 system on which I was getting the same error. I am working with casapy-42.0.28322-021-1-64b, which expects version 5.1 of the readline library, so I tried with both 5.1 and 6.2. The exact* lines I'm using are:

cd /scratch/local/
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz
tar -xzf ncurses-5.9.tar.gz
export CFLAGS=-fPIC
cd ncurses-5.9
./configure --prefix=/scratch/local/ncurses
make -j 12
make -j 12 install

cd /scratch/local/
wget http://ftp.gnu.org/gnu/readline/readline-5.1.tar.gz
tar -xzf readline-5.1.tar.gz
cd readline-5.1
./configure --prefix=/scratch/local/readline
vi shlib/Makefile
# change line 79 (v 5.1) or 81 (v 6.2) to read
SHOBJ_CFLAGS = -fPIC -lncurses -L/scratch/local/ncurses/lib/libncurses.so
make -j 12
make -j 12 install

* locations have been shortened to /scratch/local/ for brevity.

After that I have tried both the LD_LIBRARY_PATH modification (which I would rather not make a permanent feature, since I don't want to always be linked against this modified version of libreadline) and simply changing the link casapy-42.0.28322-021-1-64b/lib/libreadline.so.5 to point toward /scratch/local/readline/lib/libreadline.so.5(.1). In either case, when I try to run casapy, I get this error:

sh: symbol lookup error: /scratch/local/casapy-42.0.28322-021-1-64b/lib/libreadline.so.5: undefined symbol: PC

My 'BC' has changed to 'PC'! I get the same result regardless of the version of libreadline I use. It's as if libreadline hasn't properly linked against ncurses, but if I check:

ldd /scratch/local/casapy-42.0.28322-021-1-64b/lib/libreadline.so.5
linux-vdso.so.1 => (0x00007ffff7ffe000)
/scratch/local/ncurses/lib/libncurses.so (0x00007ffff7b5a000)
libc.so.6 => /lib64/libc.so.6 (0x00007ffff77ab000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007ffff75a7000)
/lib64/ld-linux-x86-64.so.2 (0x0000555555554000)

It's there! And it definitely includes the right symbol:

nm /scratch/local/ncurses/lib/libncurses.so | grep PC
000000000025b3f4 B PC

Do you have any ideas? Thanks!

elnjensen
Posts: 5
Joined: Tue Apr 30, 2013 9:01 am

Re: Getting CASA working on a SuSE Linux machine

Postby elnjensen » Tue May 20, 2014 11:01 pm

Hi,

It's not clear why what you're doing shouldn't work. As you say, it does seem like it's (still) not getting the right library.

The only thing I can see that looks funny to me in your commands is this:

SHOBJ_CFLAGS = -fPIC -lncurses -L/scratch/local/ncurses/lib/libncurses.so


The "-L" argument should take a directory name, not a library. You could try changing that (admittedly grasping at straws here).

The other thing I'll note is that you have shown that the "PC" symbol is in libncurses, but that doesn't mean that it's in libreadline (which is where the error is coming up). So it would appear that the symbols from libncurses are not getting pulled into libreadline. I believe this is related to the -fPIC flag when compiling libncurses.

Try specifying "CFLAGS=-fPIC" as an argument to 'configure' when you configure the build for ncurses (or at least look in the Makefile before you run 'make' to be sure that your CFLAGS really gets in there correctly from your environment variable).

Hope this helps -

Eric

nhurleywalker
Posts: 2
Joined: Tue May 20, 2014 3:25 am

Re: Getting CASA working on a SuSE Linux machine

Postby nhurleywalker » Tue May 27, 2014 11:58 pm

Thanks -- I had tried just /scratch/local/ncurses/lib/ as well, but got the same error. Sorry, should have posted it.

In the end my sysadmin built a new version of ncurses and readlines with a few extra command-line options. I hope these instructions are useful for other SUSE users:

-----------------

I compiled ncurses:

export CFLAGS=-fPIC
./configure --prefix=/scratch/local/ncurses/5.9 --with-shared
make
make install

then I compiled readline 5.1 with

export CFLAGS=-fPIC
export LDFLAGS="-L/scratch/local/ncurses/5.9/lib"
export CPPFLAGS="-I/scratch/local/ncurses/5.9/include"

./configure --prefix=/scratch/local/readline/5.1 --with-curses
make SHLIB_LIBS=-lncurses all shared
make install

-----------------

I'm not sure how to test whether the symbols have linked correctly because if I try looking for the symbol in libreadline:

nm /scratch/local/readline/5.1/lib/libreadline.so.5 | grep PC
U PC

It's not there, even though it is linked to ncurses :
ldd /scratch/local/readline/5.1/lib/libreadline.so.5
linux-vdso.so.1 => (0x00007ffff7ffe000)
libncurses.so.5 => /lib64/libncurses.so.5 (0x00007ffff7b37000)
libc.so.6 => /lib64/libc.so.6 (0x00007ffff77bf000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007ffff75bb000)
/lib64/ld-linux-x86-64.so.2 (0x0000555555554000)

Which seems odd because that's a different version of ncurses, which doesn't have the symbol:

nm /lib64/libncurses.so.5 | grep PC
nm: /lib64/libncurses.so.5: no symbols

And yet I no longer get errors when I run casapy, and the modified version of libncurses has it:

nm /scratch/local/ncurses/5.9/lib/libncurses.so | grep PC
000000000025b3f4 B PC

I've never had to delve this deeply into shared libraries before so I probably just misunderstand how this is supposed to work.

elnjensen
Posts: 5
Joined: Tue Apr 30, 2013 9:01 am

Re: Getting CASA working on a SuSE Linux machine

Postby elnjensen » Wed May 28, 2014 8:27 am

Hmm, I'm not sure either. Glad you got it working, though - thanks for posting the update!

erika12
Posts: 3
Joined: Mon Aug 01, 2016 12:13 pm

Re: Getting CASA working on a SuSE Linux machine

Postby erika12 » Mon Aug 01, 2016 12:15 pm

hi, sorry for getting this post off dust. Would like to know if CASA updates are being released lately because I've got no way to update my current system.

neumann45
Posts: 1
Joined: Wed Sep 20, 2017 7:15 am
Contact:

Re: Getting CASA working on a SuSE Linux machine

Postby neumann45 » Wed Sep 20, 2017 7:20 am

i try its working
thanks for posting the update...

i see
https://bugzilla.redhat.com/show_bug.cgi?id=165979 ).


Return to “CASA”

Who is online

Users browsing this forum: No registered users and 1 guest