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  2021  <20222023  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  2021  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: Issues building statically linked IOC
From: Érico Nogueira Rolim via Tech-talk <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Mon, 17 Oct 2022 18:08:25 +0000
Hi!

I'm developing an IOC to be deployed on a device running an older Linux
distro, so I'm building the application statically in order to simplify
my deployment process, at least until we can update the distro on the
device. For this purpose, I'm starting out with epics base 3.15.9, which
is giving me some issues.


- I added "STATIC_BUILD=YES" to my CONFIG_SITE file

- I ran "make" and the resulting binary was dynamic (per ldd output)

- I removed the contents of "STATIC_LDFLAGS_YES= -Wl,-Bstatic" and
"STATIC_LDLIBS_YES= -Wl,-Bdynamic" in
configure/os/CONFIG.linux-x86.linux-x86 and the build was completed
successfully but the resulting binary was still dynamic. Removing only
the LDLIBS one lead to a linking error: "/usr/bin/ld: cannot find -lgcc_s"

- I changed "GNU_LDLIBS_YES = -lgcc" to "GNU_LDLIBS_YES = -lgcc -static"
in configure/CONFIG.gnuCommon

- I removed the contents of "STATIC_LDFLAGS_YES= -Wl,-Bstatic" and
"STATIC_LDLIBS_YES= -Wl,-Bdynamic" in
configure/os/CONFIG.Common.linuxCommon as well (the content from
CONFIG.linux-x86 seems to be partly duplicated)

- I added "COMMANDLINE_LIBRARY = READLINE_NCURSES" to CONFIG_SITE and
changed "*LDLIBS_READLINE_NCURSES = -lreadline -lncurses" **to
"*LDLIBS_READLINE_NCURSES = -lreadline -lncurses -ltinfo"* *in
configure/os/CONFIG.Common.linuxCommon (in epics-base) to fix the
linking errors due to missing functions from libtinfo (I feel like this
should be handled by the build system, but I'm not sure how it would happen)

- the resulting binary was finally static


Did I miss something about building a static IOC? Having to mess around
in the epics-base files doesn't seem ideal... To cover all my bases, I
also tried doing this on epics-base 7.0.7, which required the same steps
to spit out a static executable.


Thank you,

Érico


Aviso Legal: Esta mensagem e seus anexos podem conter informações confidenciais e/ou de uso restrito. Observe atentamente seu conteúdo e considere eventual consulta ao remetente antes de copiá-la, divulgá-la ou distribuí-la. Se você recebeu esta mensagem por engano, por favor avise o remetente e apague-a imediatamente.

Disclaimer: This email and its attachments may contain confidential and/or privileged information. Observe its content carefully and consider possible querying to the sender before copying, disclosing or distributing it. If you have received this email by mistake, please notify the sender and delete it immediately.

Replies:
Re: Issues building statically linked IOC Michael Davidsaver via Tech-talk
RE: Issues building statically linked IOC Mark Rivers via Tech-talk

Navigate by Date:
Prev: Re: build EPICS IOC on CRIO Remi Faure via Tech-talk
Next: RE: Attocube AMC100 Ivashkevych, Oksana 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  2021  <20222023  2024 
Navigate by Thread:
Prev: Current open Controls positions at ITER Ralph Lange via Tech-talk
Next: Re: Issues building statically linked IOC Michael Davidsaver 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  2021  <20222023  2024 
ANJ, 17 Oct 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·