EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: EPICS compilation for gcc and clang
From: Philipp Kampmann via Tech-talk <tech-talk at aps.anl.gov>
To: "Johnson, Andrew N." <anj at anl.gov>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Thu, 22 Jul 2021 08:24:29 +0200

Dear Andrew and Lewis,

It worked for now with installing a clang-Epics and a gcc-Epics in parallel. However, from your answers and from a discussion with colleagues here, I feel it might be best practice to rethink our build procedure for less compiler-mixing to avoid such ABI problems. I was not aware of that.

Thanks a lot for your quick answers!

Regards,

Philipp

On 20.07.21 18:55, Johnson, Andrew N. wrote:
Hi Philipp,

Welcome to the EPICS community!

On Jul 20, 2021, at 10:34 AM, Philipp Kampmann via Tech-talk <tech-talk at aps.anl.gov> wrote:

I am relatively new to EPICS and in our project we would like to share
some software variables via EPICS. Therefore I implemented a first
version of channel access interface using the cadef.h header, which
works well in one program we are using, which uses only gcc to compile.

However, another program uses partially clang (as part of the
CERN-ROOT-libraries if someone is familiar) to compile, which gives me
the error:

In file included from
/home/philipp/software/EPICS/epics-base/include/cadef.h:40:
In file included from
/home/philipp/software/EPICS/epics-base/include/epicsThread.h:131:
In file included from
/home/philipp/software/EPICS/epics-base/include/epicsMutex.h:13:
In file included from
/home/philipp/software/EPICS/epics-base/include/epicsAssert.h:20:
In file included from
/home/philipp/software/EPICS/epics-base/include/compilerDependencies.h:19:
/home/philipp/software/EPICS/epics-base/include/compiler/gcc/compilerSpecific.h:24:5:
error: compiler/gcc/compilerSpecific.h is not for use with the clang
compiler

A corresponding "compiler/clang" path does not exist in my build. I
would like to compile epics headers with both, g++ and clang. Does
someone know if it works and how I can build EPICS with both compilers
supported?

I am using EPICS version 3.15 here.

Assuming your EPICS_HOST_ARCH is linux-x86_64 you can switch the compiler that EPICS uses from gcc to clang by editing the file base-3.15/configure/os/CONFIG_SITE.Common.linux-x86_64 and following the instructions in the comments there. However as Lewis just pointed out there might be problems with mixing the two different compilers, because the CA library is coded in C++ even though its API is pure C. Apparently on x64 both compilers adhere to an Itanium standard ABI for name mangling, but that doesn’t guarantee that they’ll be compatible.

I can suggest two solutions to avoid that problem, one simpler than the other. The easy one is to have a second installation of EPICS Base that was built using clang (follow the directions above to switch the compiler for the second one). Alternatively it is possible to build the libraries for both into the same installation of Base, but you would have to create and use a different EPICS_HOST_ARCH which should be named linux-x86_64-clang for the second one which requires adding 2 or 3 new files to your configure/os directory – if you want to go this route I can help you to do that.

HTH,

- Andrew

-- 
Complexity comes for free, simplicity you have to work for.



------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Volker Rieke
Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Dr. Astrid Lambrecht, Prof. Dr. Frauke Melchior
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------


References:
EPICS compilation for gcc and clang Philipp Kampmann via Tech-talk
Re: EPICS compilation for gcc and clang Johnson, Andrew N. via Tech-talk

Navigate by Date:
Prev: Re: Best practices for booting IOC at Linux startup? Hu, Yong via Tech-talk
Next: Re: Re: Re: detector state error and writing status error for marCCD 秦文明 via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
Navigate by Thread:
Prev: Re: EPICS compilation for gcc and clang Johnson, Andrew N. via Tech-talk
Next: Best practices for booting IOC at Linux startup? Feister, Scott via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
ANJ, 22 Jul 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·