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  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: epics build with cmake
From: "Davidsaver, Michael" <[email protected]>
To: "Andrew Johnson" <[email protected]>, <[email protected]>
Date: Tue, 9 Feb 2010 18:14:18 -0500
Just for the record.


> -----Original Message-----
> From: [email protected] [mailto:tech-talk-
> [email protected]] On Behalf Of Andrew Johnson
> Sent: Monday, February 08, 2010 11:54 AM
> To: [email protected]
> Subject: Re: epics on launchpad!
> 
> [...]
> 
> This is not in our current plans; Michael Davidsaver may be the only
> developer
> working on EPICS Base who knows much about CMake.

FYI.  CMake is a program like automake which can generate Makefiles and
has knowledge some of the particulars of the platform it runs on.  In
addition on Windows it knows how to generate NMake makefiles and visual
studio projects, as well as GNU Makefiles for Mingw.

http://www.cmake.org/cmake/help/cmake_tutorial.html

The build process looks like:

$ mkdir build-<target> && cd build-<target>
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/something ..
$ make -j
$ make install

It can do autoconf like tests of the build host.  Its probing system
knows how to access the windows registry.  It comes with a large number
of pre-canned tests.  For example, A search for Perl will find
ActivePerl on Windows.

>  If someone wants to
> propose
> merging a replacement to the existing GNUmake-based build system they
> will
> have to show that it meets all our current requirements, for example:
> 
> * Supports all our host platforms (Linux, Solaris, Windows, Mac OS)

Done.  I have personally used in on Solaris, Linux, and Windows (same
project).  This was for a Matlab/Octave plugin.

> * Handles cross-builds for other architectures

This is the only weak point.  It works, but is not as easy/clean as it
could be.  I have examples for cross min32-x86-mingw32 (linux to
windows) and RTEMS-mvme3100 (easily adapted to all other RTEMS targets).
The problem I have found is that the include() statement doesn't work in
Toolchain files at least in 2.6.x.  I haven't looked at later versions
though.  This leads to many long redundant files.

> * Can build multiple architectures in the same source tree

Done.  Cmake supports complete out of source tree builds.

> * Can build just a part of the tree, meaning a directory or
> architecture

Done. Directory is not really a barrier.  Target dependencies across
directories are no different than targets in the same directory.
Arbitrary targets can be built.

> * Parallel builds to maximize performance

Done.  With Make the challenge is making something which can build in
parallel.  In CMake the challenge is making something which won't.

> 
> I'm sure there are a few other requirements that I've missed.  Any
> replacement
> would need to come with scripts to convert existing EPICS Makefiles
> into their
> replacement files, as there are now thousands of independently created
> EPICS
> modules and IOCs being built at sites around the world, and they all
> have
> multiple Makefiles in them.

Given how freeform Makefiles are, and how often extra rules are added, I
would guess that a reasonable conversion script might do at most 50% of
the work.  I would instead take the approach of keeping the old system
in parallel as was done with the 3.13.x config in the 3.14.x series.



> -----Original Message-----
> From: [email protected] [mailto:tech-talk-
> [email protected]] On Behalf Of Andrew Johnson
> Sent: Tuesday, February 09, 2010 2:54 PM
> To: [email protected]
> Subject: Re: epics build with cmake
> 
> On Monday 08 February 2010 17:02:27 Benjamin Franksen wrote:
> > On Montag, 8. Februar 2010, J. Lewis Muir wrote:
> > > In particular, I would like it if:
> > >
> > > 1. there was a way to build EPICS without installing it; and if
> there
> > >    already is, make it the default.  Right now, running "gnumake"
> > >    builds and installs.  To me it should just build.  I should run
> > >    "gnumake install" if I want to install it.
> >
> > +1

The state of the art for build systems has advanced considerably beyond
Make.  Every build system I have used beyond simple makefiles (CMake,
GNU autotools, qmake, scons) separates build and install phases.

> 
> I agree, but unfortunately it's not easy to do this.  The problem is
> that Base
> builds many programs which later runs when building other parts of
> itself,
> such as dbToRecordtypeH.  Installing those programs immediately makes
> them
> easier to run, as it allows us to use the same make rules for both
> internal
> and external builds.

I don't think this is as big a savings as you might think.  You could
reuse the rules changing only the location of the generator program
executable (stored in a variable).  An ifdef or $(wildcard ...) would do
the job.  The dependencies are just there for Base, but not for external
builds.

The difficult part is identifying all the dependencies which are
otherwise implicit.

> As well as the executable paths, we use shared
> libraries
> for most architectures by default; if those library files were not in
> their
> installed location when needed by an executable, we would have to set
> LD_LIBRARY_PATH when building Base but *not* when building external
> applications after Base has been installed.

Again, not necessarily a huge deal.  In the past I have done things
like...

all:
	LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$SRCDIR/lib/target $(MAKE) -f
wrapped-all

wrapped-all:
	... actual rules ...

> 
> I have been working to try and rewrite some programs as Perl scripts
> which
> don't need installing, but I can't fine any replacements for flex
(lex)
> and
> antelope (yacc) written in Perl that will generate C code.  The output
> from
> those programs is compiled and run on the target so the C output is
> essential,
> and rewriting them myself seems a rather daunting and wasteful task.

Or we could port the perl interpreter to RTEMS :)

> 
> We could split Base into several pieces which you would then have to
> build and
> install in order, but I don't really think this would be a better
> solution in
> practice.
> 
> You can currently do this:
>   make
>   make INSTALL_LOCATION=/path/to/install
> 
> The second make results in some recompilation, but it doesn't re-do
> everything
> AFAICT.

Just relinks all libraries and executables.

> Of course you must ensure that you haven't set the
> INSTALL_LOCATION
> variable in your CONFIG_SITE file, and this doesn't help if your aim
is
> to run
> the install step on a different machine with no compilers, but the
> result is
> that all the necessary files get installed.
> 
> - Andrew
> --
> The best FOSS code is written to be read by other humans -- Harald
> Welte

In case it isn't obvious, software with weird or poorly maintained build
systems are a pet peeve with me.



References:
epics on launchpad! Davidsaver, Michael
Re: epics build with cmake J. Lewis Muir
Re: epics build with cmake Benjamin Franksen
Re: epics build with cmake Andrew Johnson

Navigate by Date:
Prev: Re: Accessing EPICS PV from Allen-Bradley PLC Steven M. Hartman
Next: Intel C Compiler icc on linux? Carl Lionberger
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: epics build with cmake Andrew Johnson
Next: Re: epics on launchpad! Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·