Installing elegant on Ubuntu Windows Subsystem for Linux

Moderators: cyao, soliday

Post Reply
foshea
Posts: 34
Joined: 23 Jun 2009, 21:00

Installing elegant on Ubuntu Windows Subsystem for Linux

Post by foshea » 24 Dec 2019, 17:27

I just installed elegant for linux on Ubuntu Windows Subsystem for Linux (WSL). Since WSL was only released 6 months ago, I thought I'd describe how I did it. Hopefully this will help someone else, or me when I eventually have to do it again. I'm still stuck on getting plots to show, skip to the end to see that.

I installed WSL and installed Ubuntu 18.04 using the instructions here:
https://itsfoss.com/install-bash-on-windows/

The version of Ubuntu that is available in the Microsoft Store doesn't have a number of packages, so I had to do a little bit of extra work to get elegant to run.

I followed the instructions for installing Accelerator-Operations-Physics software here:
https://www.aps.anl.gov/Accelerator-Ope ... uide_Linux

0) I downloaded the RPM files that I wanted:
SDDSToolKit-4.2-1.ubuntu.18.04.x86_64.rpm
SDDSPython-4.0-1.ubuntu.18.04.x86_64.rpm
SDDSPython3-4.0-1.ubuntu.18.04.x86_64.rpm
elegant-2019.4.0-1.ubuntu.18.04.mpich.x86_64.rpm

1) I installed alien with the following commands:
  • sudo add-apt-repository universe
  • sudo apt-get install alien
  • sudo apt install alien
(I don't know why I needed both install commands.)

2) In order to convert the RPM files, I had to move them to a new directory under ~ and run
  • sudo chmod 755 <the new directory>
This is because of some required permissions that are set by Windows in directories created by Windows. Directories created in Ubuntu don't have this problem, I guess.

3) run the following command for each package
  • sudo alien -i <RPM package name>
4) Downloaded defns.rpn and copied it to ~/.defns.rpn as instructed.

5) Edited ~/.bash_profile to have the following lines:

Code: Select all

# elegant and SDDS claim they need the following
export RPN_DEFNS=~/.defns.rpn
export HOST_ARCH=linux-x86_64
export EPICS_HOST_ARCH=linux-x86_64

# required to restore color to the terminal
source ~/.bashrc
At this point I get the following error when I try to run elegant:
elegant: error while loading shared libraries: libgsl.so.23: cannot open shared object file: No such file or directory
Which I fix by installing the following package:
  • sudo apt-get install libgsl-dev
elegant: error while loading shared libraries: liblapack.so.3: cannot open shared object file: No such file or directory
Which I fix by installing the following package:
  • sudo apt-get install libatlas3-base
elegant runs with the following output:
Running elegant at Tue Dec 24 13:55:46 2019

This is elegant 2019.4.0, Dec 10 2019, by M. Borland, J. Calvey, M. Carla', N. Carmignani, M. Ehrlichman, L. Emery, W. Guo, R. Lindberg, V. Sajaev, R. Soliday, Y.-P. Sun, C.-X. Wang, Y. Wang, Y. Wu, and A. Xiao.
usage: elegant {<inputfile>|-pipe=in} [-macro=<tag>=<value>,[...]] [-rpnDefns=<filename>] [-configuration=<filename>]
=====================================================================================
Thanks for using elegant. Please cite the following reference in your publications:
M. Borland, "elegant: A Flexible SDDS-Compliant Code for Accelerator Simulation,"
Advanced Photon Source LS-287, September 2000.
If you use a modified version, please indicate this in all publications.
=====================================================================================
Link date: Dec 10 2019 12:45:23, SVN revision: unknown
That seems like it is working. At this point I try to run the example in examples/matching/betaMatching and get the following error:
./one: 3: exec: tclsh: not found
Which I fix by installing the following package:
  • sudo apt-get install tclsh
Another run of the example returns:
sddsplot: error while loading shared libraries: libgd.so.3: cannot open shared object file: No such file or directory
Which I fix by installing the following package:
  • sudo apt-get install libgd3
Now I see the following error:
mpl_motif: error while loading shared libraries: libXm.so.4: cannot open shared object file: No such file or directory
If I install libxm4 using the same apt-get syntax I get a segmentation fault every time I call sddsplot. Any ideas?

I can run gdb with the following commands:
  • gdb sddsplot
  • (gdb) r -graphic=line,vary -column=s,beta? one.twi
And I get the following output:
Starting program: /usr/bin/sddsplot -graphic=line,vary -column=s,beta? one.twi
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Inferior 1 (process 1438) exited normally]
(gdb) Segmentation fault (core dumped)
When I use a debug program valgrind I run it with:
  • valgrind ./one
And I get the following returned:
==1410== Memcheck, a memory error detector
==1410== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1410== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==1410== Command: ./one
==1410==
==1410== error calling PR_SET_PTRACER, vgdb might block
DESKTOP-77H8RRA:~/elegant/examples/matching/betaMatching$ Segmentation fault (core dumped)

foshea
Posts: 34
Joined: 23 Jun 2009, 21:00

Re: Installing elegant on Ubuntu Windows Subsystem for Linux

Post by foshea » 30 Dec 2019, 18:46

Some more debugging of sddsplot:
  • gdb sddsplot
  • (gdb) r -graphic=line,vary -column=s,beta? one.twi
Starting program: /usr/bin/sddsplot -graphic=line,vary -column=s,beta? one.twi
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Inferior 1 (process 32) exited normally]
(gdb) Segmentation fault (core dumped)
  • (gdb) where
No stack.
  • (gdb) list
1002 ../sddsplot.c: No such file or directory.
Now on to calling mpl_motif directly:
  • gdb mpl_motif
  • (gdb) r
Starting program: /usr/bin/mpl_motif
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffffe89d1ce in _XtAppCreateShell () from /usr/lib/x86_64-linux-gnu/libXt.so.6
  • (gdb) where
#0 0x00007ffffe89d1ce in _XtAppCreateShell () from /usr/lib/x86_64-linux-gnu/libXt.so.6
#1 0x00007ffffe89d368 in XtAppCreateShell () from /usr/lib/x86_64-linux-gnu/libXt.so.6
#2 0x000000000801d4df in main (argc=<optimized out>, argv=0x7ffffffee2a8) at ../mpl_motif.c:476
  • (gdb) list
416 ../mpl_motif.c: No such file or directory.
It looks like something that was supposed to be installed has not been installed, but I'm not sure what I missed.

foshea
Posts: 34
Joined: 23 Jun 2009, 21:00

Re: Installing elegant on Ubuntu Windows Subsystem for Linux

Post by foshea » 31 Dec 2019, 14:56

The problem with XtAppCreateShell while running mpl_motif was the key. I didn't have any kind of X windows. I did the following and sddsplot now works:
  • Install VcXSrv
  • Run it once to select start up options and save a configuration file
  • Move that configuration file (not xlaunch.exe) to the windows start up folder (so it starts every time windows does)
  • added "export DISPLAY=localhost:0.0" to the end of ~/.bashrc
All of the small handful of examples I have tried have worked.

Post Reply