Compilation with epics base 7

Moderators: cyao, soliday

blanco-garcia
Posts: 52
Joined: 29 Oct 2021, 10:41

Compilation with epics base 7

Post by blanco-garcia » 18 Nov 2022, 10:49

Dear all,

I tried to compile the latest elegant sources with epics base 7.x from https://epics.anl.gov/download/base/index.php , but I get the error here below.
Is there any flags or compiler requirements I could add ?

The same parameters work well with epics base R3.16.2.

Best regards,
o
make[1]: Entering directory `/------/elegant.2022.2.0/elegant_compilation/epics/extensions/src/oagca/O.linux-x86_64'
/usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -I../../../../base/include -I../../../../base/include/os/Linux -DACCESS_SECURITY -D_NO_PROTO -I../../../src/SDDS/lzma -fpermissive -mtune=generic -m64 -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I../../../../base/include/compiler/gcc -I../../../../base/include/os/Linux -I../../../../base/include -I../../../include -c ../cavput.cc
/usr/bin/gcc -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -I../../../../base/include -I../../../../base/include/os/Linux -DACCESS_SECURITY -D_NO_PROTO -I../../../src/SDDS/lzma -mtune=generic -m64 -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I../../../../base/include/compiler/gcc -I../../../../base/include/os/Linux -I../../../../base/include -I../../../include -c ../pvMultList.c
/usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -I../../../../base/include -I../../../../base/include/os/Linux -DACCESS_SECURITY -D_NO_PROTO -I../../../src/SDDS/lzma -fpermissive -mtune=generic -m64 -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I../../../../base/include/compiler/gcc -I../../../../base/include/os/Linux -I../../../../base/include -I../../../include -c ../pvaSDDS.cc
In file included from /usr/include/c++/4.8.2/unordered_map:35:0,
from ../pvaSDDS.cc:2:
/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

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

Re: Compilation with epics base 7

Post by soliday » 18 Nov 2022, 11:12

Try editing epics/base/configure/CONFIG and add the following:
OPT_CXXFLAGS_YES += -std=gnu++11 -D_GLIBCXX_USE_CXX11_ABI=0

We have a mixed RHEL7 + RHEL8 environment here. To get it to work on both systems, I have to compile on RHEL7 with this option set.

blanco-garcia
Posts: 52
Joined: 29 Oct 2021, 10:41

Re: Compilation with epics base 7

Post by blanco-garcia » 21 Nov 2022, 06:16

Thank you,

I'm using base 7.0.7 and the compilation moved forward. However, there is a different error this time :

Code: Select all

/usr/bin/gcc  -D_GNU_SOURCE -D_DEFAULT_SOURCE           -D_X86_64_  -DUNIX  -Dlinux      -O3 -g   -Wall -Werror-implicit-function-declaration    -I/---/elegant.2022.2.0/elegant_compilation/epics/extensions/include -I/---/elegant.2022.2.0/elegant_compilation/epics/extensions/src/SDDS/lzma -DIEEE_MATH  -mtune=generic      -m64  -I. -I../O.Common -I. -I. -I.. -I../../../../include/compiler/gcc -I../../../../include/os/Linux -I../../../../include -I/---/elegant.2022.2.0/elegant_compilation/epics/base/include/compiler/gcc -I/---/elegant.2022.2.0/elegant_compilation/epics/base/include/os/Linux -I/---/elegant.2022.2.0/elegant_compilation/epics/base/include   -I/---/elegant.2022.2.0/elegant_compilation/epics/extensions/include        -c ../carriageReturn2newline.c
../carriageReturn2newline.c: In function 'main':
../carriageReturn2newline.c:20:3: error: implicit declaration of function 'SDDS_RegisterProgramName' [-Werror=implicit-function-declaration]
   SDDS_RegisterProgramName(argv[0]);
../carriageReturn2newline.c:32:11: error: implicit declaration of function 'SDDS_Bomb' [-Werror=implicit-function-declaration]
           SDDS_Bomb("invalid -pipe syntax");

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

Re: Compilation with epics base 7

Post by soliday » 21 Nov 2022, 11:17

What is -I/---/elegant.2022.2.0/elegant_compilation/epics/extensions/include
When I build I see -I../../../../../../epics/extensions/include

Look at your oag/apps/configure/CONFIG file and make sure the EPICS_BASE and EPICS_EXTENSIONS are set properly

blanco-garcia
Posts: 52
Joined: 29 Oct 2021, 10:41

Re: Compilation with epics base 7

Post by blanco-garcia » 02 Dec 2022, 12:20

Dear Soliday,

it took me a while to know why I don't get:

Code: Select all

 -I../../../../../../epics/extensions/include
It seems that the compilation output info changed between epics base 7.0.5 and 7.0.6, (and the original error message that I posted was with epics base 7.0.7). You might be compiling with epics base <= 7.0.5, right ?

Even so, I still have an error when compiling with epics 7.0.5. It might be also the order in which I compile, but, I only will be able to check it until next week. Do you have any suggestion ?

Best regards,
o


Code: Select all

make[1]: Entering directory `~/elegant.2022.2.0/elegant_compilation/epics/extensions/src/oagca/O.linux-x86_64'
/usr/bin/g++  -D_GNU_SOURCE -D_DEFAULT_SOURCE           -D_X86_64_  -DUNIX  -Dlinux      -O3 -g -std=gnu++11 -D_GLIBCXX_USE_CXX11_ABI=0   -Wall     -I../../../../base/include -I../../../../base/include/os/Linux -DACCESS_SECURITY -D_NO_PROTO -I../../../src/SDDS/lzma -fpermissive  -mtune=generic      -m64  -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I../../../../base/include/compiler/gcc -I../../../../base/include/os/Linux -I../../../../base/include   -I../../../include           -c ../cavput.cc
/usr/bin/gcc  -D_GNU_SOURCE -D_DEFAULT_SOURCE           -D_X86_64_  -DUNIX  -Dlinux      -O3 -g   -Wall -Werror-implicit-function-declaration     -I../../../../base/include -I../../../../base/include/os/Linux -DACCESS_SECURITY -D_NO_PROTO -I../../../src/SDDS/lzma  -mtune=generic      -m64  -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I../../../../base/include/compiler/gcc -I../../../../base/include/os/Linux -I../../../../base/include   -I../../../include           -c ../pvMultList.c
/usr/bin/g++  -D_GNU_SOURCE -D_DEFAULT_SOURCE           -D_X86_64_  -DUNIX  -Dlinux      -O3 -g -std=gnu++11 -D_GLIBCXX_USE_CXX11_ABI=0   -Wall     -I../../../../base/include -I../../../../base/include/os/Linux -DACCESS_SECURITY -D_NO_PROTO -I../../../src/SDDS/lzma -fpermissive  -mtune=generic      -m64  -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I../../../../base/include/compiler/gcc -I../../../../base/include/os/Linux -I../../../../base/include   -I../../../include           -c ../pvaSDDS.cc
../pvaSDDS.cc: In function 'void ConnectPVA(PVA_OVERALL*, double)':
../pvaSDDS.cc:334:168: error: no matching function for call to 'epics::pvaClient::PvaClientMultiChannel::create(epics::pvaClient::PvaClientPtr&, epics::pvData::shared_vector<const std::basic_string<char>, void>&, const char [4], long int&, epics::pvData::shared_vector<const std::basic_string<char>, void>&)'
     pva->pvaClientMultiChannelPtr[0] = epics::pvaClient::PvaClientMultiChannel::create(pva->pvaClientPtr, pva->pvaChannelNamesTop, "pva", numInternalPVs, constProvider);
                                                                                                                                                                        ^
../pvaSDDS.cc:334:168: note: candidate is:
In file included from ../pvaSDDS.h:2:0,
                 from ../pvaSDDS.cc:1:
../../../../base/include/pv/pvaClientMultiChannel.h:72:37: note: static epics::pvaClient::PvaClientMultiChannelPtr epics::pvaClient::PvaClientMultiChannel::create(const PvaClientPtr&, const epics::pvData::shared_vector<const std::basic_string<char>, void>&, const string&, size_t)
     static PvaClientMultiChannelPtr create(
                                     ^
../../../../base/include/pv/pvaClientMultiChannel.h:72:37: note:   candidate expects 4 arguments, 5 provided
../pvaSDDS.cc:364:179: error: no matching function for call to 'epics::pvaClient::PvaClientMultiChannel::create(epics::pvaClient::PvaClientPtr&, epics::pvData::shared_vector<const std::basic_string<char>, void>&, const char [4], long int&, epics::pvData::shared_vector<const std::basic_string<char>, void>&)'
     pva->pvaClientMultiChannelPtr[pva->numMultiChannels - 1] = epics::pvaClient::PvaClientMultiChannel::create(pva->pvaClientPtr, constNames, "pva", numInternalPVs, constProvider);
                                                                                                                                                                                   ^
../pvaSDDS.cc:364:179: note: candidate is:
In file included from ../pvaSDDS.h:2:0,
                 from ../pvaSDDS.cc:1:
../../../../base/include/pv/pvaClientMultiChannel.h:72:37: note: static epics::pvaClient::PvaClientMultiChannelPtr epics::pvaClient::PvaClientMultiChannel::create(const PvaClientPtr&, const epics::pvData::shared_vector<const std::basic_string<char>, void>&, const string&, size_t)
     static PvaClientMultiChannelPtr create(
                                     ^
../../../../base/include/pv/pvaClientMultiChannel.h:72:37: note:   candidate expects 4 arguments, 5 provided
make[1]: *** [pvaSDDS.o] Error 1
make[1]: Leaving directory `/nfs/tegile/work/sources/physmach/blanco-garcia/progs/elegant.2022.2.0/elegant_compilation/epics/extensions/src/oagca/O.linux-x86_64'
make: *** [install.linux-x86_64] Error 2

P.S. In the first message I edited by hand the line -I/---/elegant.2022.2.0/elegant_compilation/epics/extensions/include to eliminate the absolute path and replace it with ---.

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

Re: Compilation with epics base 7

Post by soliday » 02 Dec 2022, 15:16

I am compiling with epics 7.0.7. The error you are seeing in oagca is related to a epics function that was updated to accept 5 arguments. It was updated in March 2021 but I am not sure which epics release included the updated code.

I still don't know what is going on with carriageReturn2newline.c. It is almost like there is a second SDDS.h file that is being read instead of the one in epics/extensions/include/SDDS.h. Can you check all the directories on the compile line that are listed with the -I option. Look for SDDS.h files and make sure it matches the version in epics/extensions/src/SDDS/include/SDDS.h and includes the functions SDDS_RegisterProgramName and SDDS_Bomb.

blanco-garcia
Posts: 52
Joined: 29 Oct 2021, 10:41

Re: Compilation with epics base 7

Post by blanco-garcia » 21 Dec 2022, 14:17

Dear Soliday,

I finally found an SDDS.h file installed system wide in 2020 which is different to the recent one in epics/extensions/include

Code: Select all

$pwd
/usr/include/SDDS
$ls
SDDS.h  SDDStypes.h  constants.h  lzma/  lzma.h  mdb.h
Although it declares SDDS_Bomb and SDDS_RegisterProgramName, it is possible that they are not longer compatible.
Unfortunately, it requires admin intervention. I'll try to confirm it soon,
o

blanco-garcia
Posts: 52
Joined: 29 Oct 2021, 10:41

Re: Compilation with epics base 7

Post by blanco-garcia » 22 Dec 2022, 13:46

Dear Soliday,

after removing the SDDS lib in /usr/include/extension and reordering the compilation sequence I managed to get elegant and Pelegant working.
However, there is still a problem when building oag/apps/src/utils, the error here below appears when I do make.

Code: Select all

/usr/bin/gcc  -D_GNU_SOURCE -D_DEFAULT_SOURCE           -D_X86_64_  -DUNIX  -Dlinux      -O3 -g   -Wall -Werror-implicit-function-declaration    -I../../../../../../epics/extensions/include -I../../../../../../epics/extensions/src/SDDS/lzma -DIEEE_MATH  -mtune=generic      -m64  -I. -I../O.Common -I. -I. -I.. -I../../../../include/compiler/gcc -I../../../../include/os/Linux -I../../../../include   -I../../../../../apps/include -I../../../../../../epics/base/include/compiler/gcc -I../../../../../../epics/base/include/os/Linux -I../../../../../../epics/base/include   -I../../../../../../epics/extensions/include        -c ../carriageReturn2newline.c
../carriageReturn2newline.c: In function 'main':
../carriageReturn2newline.c:20:3: error: implicit declaration of function 'SDDS_RegisterProgramName' [-Werror=implicit-function-declaration]
   SDDS_RegisterProgramName(argv[0]);
   ^
../carriageReturn2newline.c:32:11: error: implicit declaration of function 'SDDS_Bomb' [-Werror=implicit-function-declaration]
           SDDS_Bomb("invalid -pipe syntax");
           ^
cc1: some warnings being treated as errors
make[2]: *** [carriageReturn2newline.o] Error 1
make[2]: Leaving directory `/nfs/tegile/work/sources/physmach/blanco-garcia/progs/elegant.2022.2.0/elegant_compilation/oag/apps/src/utils/tools/O.linux-x86_64'
make[1]: *** [install.linux-x86_64] Error 2
make[1]: Leaving directory `/nfs/tegile/work/sources/physmach/blanco-garcia/progs/elegant.2022.2.0/elegant_compilation/oag/apps/src/utils/tools'
make: *** [tools.install] Error 2

It seems I'm missing the right order when compiling the SDDS libs with and without MPI.

With epics R3.16.2 I used to buld first without parallelization, and when elegant was compiled I came back to compile SDDS/SDDSlibs, SDDS/pgapack and SDDS with make clean all MPI=1.
Then I went to oag and compiled Pelegant with makePelegant.

However, with epics 7.0.7 it seems that it is better to compile SDDS with the MPI=1 flag from the beginning and then move to oag to compile elegant and Pelegant.

Is there any preferred order to build the packages with and without MPI ?


Best regards,
o

blanco-garcia
Posts: 52
Joined: 29 Oct 2021, 10:41

Re: Compilation with epics base 7

Post by blanco-garcia » 23 Dec 2022, 04:17

Dear Soliday,

I managed to compile without errors excluding oag/apps/src/utils, I might need some time to a look around and see that everything needed is available.
The size of the epics folder largely increased from 500 MB with epics base R3.16.2 to 2.4 GB with epics base 7.0.7.

Please, let me know if you think there is a way to avoid the error in oag/apps/src/utils.

I'll post the details here below :
Elegant 2022.2.0 with epics base 7.0.7
List of files :
SDDS.5.3.tar
SDDSepics.5.2.tar
SDDSjava.tar
SDDSmatlab.tar
Tktable2.11.tar
base-7.0.7.tar
elegant.2022.2.0.tar
epics.extensions.configure.tar
oag.1.27.1.tar
oag.apps.configure.tar
defns/defns.rpn

Bash enviroment variables :

Code: Select all

module load openmpi/4.1.1
module load python/3.8.2
export HOST_ARCH=linux-x86_64
export EPICS_HOST_ARCH=linux-x86_64
export PYTHON3=1
export USR_JAVACFLAGS=" -source 1.8 -target 1.8 "
export myElegantSource=myfolder #edit this line
export RPN_DEFNS=$myElegantSource/defns/defns.rpn
###binaries already compiled
export PATH=$myElegantSource/epics/base/bin/$HOST_ARCH:$PATH
export PATH=$myElegantSource/epics/extensions/bin/$HOST_ARCH:$PATH
export PATH=$myElegantSource/oag/apps/bin/$HOST_ARCH:$PATH
Operative System : CentOS 7

Compilation sequence

Code: Select all

echo "Cleaning"
rm -rf epics oag

echo "Decompressing"
find . -maxdepth 1 -name '*.tar' -exec tar -xvf '{}' \;

set -e
echo "Compiling"
echo $PWD
cd epics
mv ../base-7.0.7 .
ln -s base-7.0.7 base
#mv ../base-3.16.2 .
#ln -s base-3.16.2 base
cd base/configure

## edit CONFIG file
# add two lines
cp CONFIG bkupCONFIGbkup
OS_SYSTEM_VERSION=$(cat /etc/os-release | grep VERSION_ID | awk -F'["]' '{print $2}')
echo "OS Version is $OS_SYSTEM_VERSION"
if [ $OS_SYSTEM_VERSION = "7" ]
then
  CENTOS7_FLAGS="OPT_CXXFLAGS_YES += -std=gnu++11 -D_GLIBCXX_USE_CXX11_ABI=0"
  echo "  ... adding flags $CENTOS7_FLAGS "
  awk -v CENTOS7_FLAGS="$CENTOS7_FLAGS" '{print $0} END {print "#orblancog: inserting my vars"; print "CROSS_COMPILER_TARGET_ARCHS="; print "SHARED_LIBRARIES=NO"; print CENTOS7_FLAGS; print "#orblancog: end of editing"}' bkupCONFIGbkup > CONFIG
fi
## end of CONFIG file edit

echo $PWD
cd ..
make
echo $PWD
cd ../extensions/configure
make
echo $PWD
cd ../src/SDDS/png
make
echo $PWD

#adding
cd ../SDDSlib
make MPI=1
echo $PWD
cd ../pgapack
make MPI=1
cd ..
make clean
make
make all MPI=1
echo $PWD

echo $PWD
cd java
make
echo $PWD
cd ../python
make
echo $PWD
cd ../../oagca
make
echo $PWD
cd ../SDDSepics
make
echo $PWD
cd ../../../../oag/apps/configure/

#edit release
cp RELEASE bkupRELEASE
# add two variables
awk '{if($1 ~ /EPICS_[EXTENSION/BASE]/) {print "# removed #"$0}else{print $0}} END {print "EPICS_BASE=$(TOP)/../../epics/base"; print "EPICS_EXTENSIONS=$(TOP)/../../epics/extensions";}' bkupRELEASE > RELEASE
#end edit release

make
echo $PWD
cd ../src/xraylib
make
echo $PWD
cd ../physics
make
echo $PWD
cd ../elegant/elegantTools
make
echo $PWD
cd ../sddsbrightness
make
echo $PWD
cd ..
make
# elegant done
echo $PWD

# retaking from elegant done
cd ..
echo $PWD
cd ../src/tcltklib
make
echo $PWD
cd ../tcltkapp/oagapp
make
echo $PWD
cd ../../tcltkinterp/extensions
make

# under revision 2022/dic/22
echo $PWD
cd ../../utils
#make
#cd ..
# we move up one level for compatibility
# two in total with the next command

echo $PWD
cd ../physics
make
echo $PWD
cd ../mplib/misc
make
echo $PWD
cd ../booster
make
echo $PWD
cd ../leutl
make
echo $PWD
cd ../par
make
echo $PWD
cd ../sr
make
echo $PWD
cd ../teststand
make
echo $PWD
cd ../../cshapp/oagapp
make
echo $PWD
cd ../../pem
make
echo $PWD
cd ../elegant
makePelegant
# Pelegant done

echo $PWD
cd ../../bin/linux-x86_64
cp /usr/bin/tclsh8.* .
ln -s tclsh8.* oagtclsh
cp /usr/bin/wish8.* .
ln -s wish8.* oagwish
echo $PWD
cd ../../../..
chmod -R 775 *

blanco-garcia
Posts: 52
Joined: 29 Oct 2021, 10:41

Re: Compilation with epics base 7

Post by blanco-garcia » 23 Dec 2022, 09:37

Dear Soliday,

I included SDDS.h in oag/apps/src/utils/tools/carriageReturn2newline.c to move forward the compilation;

Code: Select all

#include "mdb.h"
#include "scan.h"

#include "SDDS.h" //Patch orblancog 2022dec23
#define SET_PIPE 0
#define N_OPTIONS 1
...
And now I get an error in oag/apps/src/utils/monitoring/O.linux-x86_64 about a missing makeTclIndex command :

Code: Select all

...
Installing Tcl library ../../../../lib/linux-x86_64/sddsSpaceUsed.tcl
make[2]: ../../../../bin/linux-x86_64/makeTclIndex: Command not found
make[2]: *** [buildInstall] Error 127
make[2]: Leaving directory `/nfs/tegile/work/sources/physmach/blanco-garcia/progs/elegant.2022.2.0/elegant_compilation/oag/apps/src/utils/monitoring/O.linux-x86_64'
make[1]: *** [install.linux-x86_64] Error 2
make[1]: Leaving directory `/nfs/tegile/work/sources/physmach/blanco-garcia/progs/elegant.2022.2.0/elegant_compilation/oag/apps/src/utils/monitoring'
make: *** [monitoring.install] Error 2
Do you have any suggestion ?

Best regards,
o

Post Reply