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  <20122013  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  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: [makefile] adding a library to an EPICS application
From: Mark Rivers <[email protected]>
To: "'Pavel Maslov'" <[email protected]>, EPICS Tech Talk <[email protected]>
Date: Wed, 19 Dec 2012 20:34:42 +0000

Hi Pavel,

 

Here are the answers for 2 scenarios, which I was just working on today.  In my case I want to have the TIFF library available in my EPICS areaDetector package.

 

For Linux I could just require users to install the libtiff package as they would any other package.  In that case I can just to “include <tiff.h>” in my EPICS application and the system will find the file, and I can add the following to my application Makefile.  This answers your question about installing to /usr/local, Linux will find it there.

 

PROD_SYS_LIBS_Linux    += tiff jpeg z

 

But in the case of Windows I could not find a pre-built TIFF library for 64-bit Windows on the Web.  So I decided that for Windows the TIFF library should be built from source code as part of my application.  This way others who want to use my application are guaranteed to have the required library without having to mess around building it themselves.

 

Here is what I did

 

-          Created a tiffSrc directory in my application

-          Copied the latest TIFF source code from /tiff-4.0.3/libtiff into tiffSrc

-          Re-write the Makefile to use EPICS build system

-          tif_stream.cxx renamed to tif_stream.cpp for EPICS compatibility

-          tif_confix.vc.h copied to tif_config.h

-          tiffconf.vc.h copied to tiffconf.h

 

The following is tiffSrc/Makefile (with some source files deleted for brevity):

#########################################

TOP=../../..

include $(TOP)/configure/CONFIG

#----------------------------------------

#  ADD MACRO DEFINITIONS AFTER THIS LINE

#=============================

 

INC_WIN32 += tiff.h tiffio.h tiffvers.h tiffconf.h

 

LIBRARY_IOC_WIN32 = tiff

 

LIB_SRCS += tif_aux.c

LIB_SRCS += tif_close.c

LIB_SRCS += tif_codec.c

LIB_SRCS += tif_color.c

LIB_SRCS += tif_compress.c

LIB_SRCS += tif_strip.c

LIB_SRCS += tif_thunder.c

LIB_SRCS += tif_tile.c

LIB_SRCS += tif_version.c

LIB_SRCS += tif_warning.c

LIB_SRCS += tif_write.c

LIB_SRCS += tif_zip.c

LIB_SRCS += tif_win32.c

       

include $(TOP)/configure/RULES

#----------------------------------------

#  ADD RULES AFTER THIS LINE

#########################################

 

So this avoids the problem you were talking about.  The library is now part of the EPICS build system, nothing gets lost when you do “make clean uninstall”.  It installs the required header files into myApp/include/os/WIN32 where they will not get in the way of files of the same name on other EPICS archs.

 

What I can’t answer, but hopefully Janet Anderson can, is how you tell EPICS to look for a library in a location other than the standard Linux search path for include files and libraries.

 

Mark

 

 

 

 

From: [email protected] [mailto:[email protected]] On Behalf Of Pavel Maslov
Sent: Wednesday, December 19, 2012 11:23 AM
To: EPICS Tech Talk
Subject: [makefile] adding a library to an EPICS application

 

Hello,

 

What is the correct way to include a library to an EPICS app?

What I've been doing so far:

1. I precompile the library (so I've got an .a or *.so file),

2. Copy the header file into $(TOP)/include/

3. Then add my library to $(TOP)/helloapp/src/Makefile

hello_LIB += my_library

4. cd $(TOP)

5. make

6. Copy libmy_library.so to $(TOP)/lib/$(EPICS_HOST_ARCH)/

7. Hi!

 

Now, I don't like the process of manually creating these folders, which upon next make uninstall clean will be deleted.

What I wanted is to specify the path to libmy_library.so in the RELEASE file, and simply include it in the src/Makefile. As far as I understand, it's neither an EPICS module, nor a support app. Otherwise, it would be pretty much straightforward.

 

What if my library is installed via make install (header file and *.so are copied to /usr/local/) or is a standard linux lib? Is there a difference if I use shared vs. static lib?

What about the architecture (x86 vs x86_64)? 

 

 

--
Best regards,


Pavel Maslov, MS
Controls Engineer at Pulsed power Lab
Efremov Institute for Electro-Physical Apparatus
St. Petersburg, Russia

Mobile: +7 (951) 672 22 19
Landline: +7 (812) 461 01 01


Replies:
Re: [makefile] adding a library to an EPICS application Andrew Johnson
References:
[makefile] adding a library to an EPICS application Pavel Maslov

Navigate by Date:
Prev: Re: [makefile] adding a library to an EPICS application Martin Konrad
Next: cross-compile error S. Banerian
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: [makefile] adding a library to an EPICS application Martin Konrad
Next: Re: [makefile] adding a library to an EPICS application Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·