Compile Elegant in macOS High Sierra(10.13.3)

Moderators: cyao, soliday

Post Reply
Biaobin
Posts: 29
Joined: 17 Feb 2017, 09:03

Compile Elegant in macOS High Sierra(10.13.3)

Post by Biaobin » 11 Aug 2018, 12:01

Hi Soliday,

I am trying to compile elegant in my mac since I have modified the source code.

I followed the instructions in Linux Guide and successfully compiled the code in Ubuntu 16.04. Then I tried running the Build-AOP-RPMs.tcl and also tried following the step 1 --step 7 in https://www.aps.anl.gov/Accelerator-Ope ... uide_Linux in my mac, it didn't work.

When I typed make in oagsoftware/oag/apps/src/elegant, after several seconds it showed

Code: Select all

make[1]: *** No rule to make target `../../../lib/linux-x86_64/libmdbcommon.a', needed by `elegantto'.  Stop.
make: *** [install.linux-x86_64] Error 2
In ubuntu libmdbcommon.a is in epics/extensions/lib/linux-x86, I check in Mac, there are not such file, it seems when I type make in epics/extensions/configure, actually it didn't work.

Code: Select all

➜  configure make
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C O.linux-x86_64 -f ../Makefile TOP=../.. \
	    T_A=linux-x86_64 install
make[1]: Nothing to be done for `install'.
Is there some changes need to be done for the instructions with linux ? Or some required development packages are not installed in my mac?

Thanks a lot in advance.
Best,
Biaobin

soliday
Posts: 390
Joined: 28 May 2008, 09:15

Re: Compile Elegant in macOS High Sierra(10.13.3)

Post by soliday » 13 Aug 2018, 10:02

For MacOS you need to set:
export EPICS_HOST_ARCH=darwin-x86
export HOST_ARCH=darwin-x86

And then run make in:
epics/extensions/configure
epics/extensions/src/SDDS
oag/apps/configure
oag/apps/src/physics
oag/apps/src/xraylib
oag/apps/src/elegant

Biaobin
Posts: 29
Joined: 17 Feb 2017, 09:03

Re: Compile Elegant in macOS High Sierra(10.13.3)

Post by Biaobin » 13 Aug 2018, 13:10

Hi Soliday,

I followed the steps as:
1. download the source code and then using "tar xvf ***.tar.gz"
- elegant.34.3.1.tar.gz
- oag.apps.configure.tar.gz
- epics.base.configure.tar.gz
- epics.extensions.configure.tar.gz
- SDDS.4.0.tar.gz
2. set environmental variable
- export RPN_DEFNS=/Users/biaobin/.defns.rpn
- export HOST_ARCH=darwin-x86
- export EPICS_HOST_ARCH=darwin-x86
- export PATH=/Users/biaobin/makeElegant/oagsoftware/epics/base/bin/darwin-x86:/Users/biaobin/makeElegant/oagsoftware/epics/extensions/bin/darwin-x86:/Users/biaobin/makeElegant/oagsoftware/oag/apps/bin/darwin-x86:$PATH
3. type make step by step in
- /Users/biaobin/makeElegant/oagsoftware/epics/base
- /Users/biaobin/makeElegant/oagsoftware/epics/extensions/configure
- /Users/biaobin/makeElegant/oagsoftware/epics/extensions/src/SDDS
It occurs error in making SDDS,

Code: Select all

cc               -DUNIX  -Ddarwin     -O3 -g   -Wall   -DEXPORT_RPNLIB -I../../../include   -arch x86_64    -fno-common -fPIC -I. -I../O.Common -I. -I. -I.. -I../../../../../include/compiler/clang -I../../../../../include/os/Darwin -I../../../../../include      -I../../../../../include           -c ../array.c
In file included from ../array.c:47:
../rpn_internal.h:133:46: error: use of undeclared identifier 'USE_GSL'
epicsShareFuncRPNLIB struct FUNCTION funcRPN[NFUNCS];
                                             ^
../rpn_internal.h:130:21: note: expanded from macro 'NFUNCS'
#define NFUNCS 103+(USE_GSL?2:0)
                    ^
1 error generated.
make[2]: *** [array.o] Error 1
make[1]: *** [install.darwin-x86] Error 2
make: *** [rpns/code.install] Error 2

soliday
Posts: 390
Joined: 28 May 2008, 09:15

Re: Compile Elegant in macOS High Sierra(10.13.3)

Post by soliday » 13 Aug 2018, 13:57

Due to licensing issues we don't include the GSL in the source code distribution. It attempts to find a system library version of GSL. In this case it didn't find one. The bug should be fixed by editing rpn_internal.h

#ifdef USE_GSL
#ifdef USE_GSL_FRESNEL
#define NFUNCS 107
#else
#define NFUNCS 105
#endif
#else
#define NFUNCS 103
#endif

Also edit rpn_data.c and change "#if USE_GSL" to "#ifdef USE_GSL"

You might also want to try using MacPorts to get a version of GSL.

Biaobin
Posts: 29
Joined: 17 Feb 2017, 09:03

Re: Compile Elegant in macOS High Sierra(10.13.3)

Post by Biaobin » 13 Aug 2018, 16:41

Hi Soliday,

Thank you so much. After installed port and gsl, I can compile SDDS now.

In case someone others want to know the details, I listed the following steps in my case.
For compiling elegant,
- cd oag/apps/configure and edit RELEASE to add epics/base path

Code: Select all

EPICS_BASE=$(TOP)/../../epics/base
- then when I type make in oag/apps/configure, there are errors with RULES_PYTHON

Code: Select all

../../configure/RULES_PYTHON:44: *** target file `clean' has both : and :: entries.  Stop.
make: *** [install.darwin-x86] Error 2
change clean:: to clean: will work.

Biaobin

Post Reply