Hi Pete,
Rather than creating the Makefile yourself, it is easier to let EPICS create most of it for you. I just successfully built your testenable application this way. Here
are the steps I followed.
Create a new application directory and cd to it
> mkdir testEnable
> cd testEnable
Run the makeBaseApp.pl perl script, telling it to create a caClient application type:
> /usr/local/epics/base-7.0.3.1/bin/linux-x86_64/makeBaseApp.pl -b /usr/local/epics/base-7.0.3.1 -t caClient testEnable
Go to the configure directory and edit RELEASE
> cd ../configure/
(edit RELEASE and add a line like the following to tell it to look in the EPICS extensions directory. It will look in the include/ directory for include files and the
lib/linux-x86_64 directory for libraries.
EXTENSIONS = /usr/local/epics/extensions_new
Go to the testEnableApp directory and edit the Makefile.
> cd ../testEnableApp/
(modify the provided Makefile so it looks like this)
*****************************
TOP=..
include $(TOP)/configure/CONFIG
#----------------------------------------
# ADD MACRO DEFINITIONS AFTER THIS LINE
#=============================
PROD_HOST += testenable
testenable_SRCS += testenable.c
testenable_LIBS += ezca
testenable_LIBS += $(EPICS_BASE_HOST_LIBS)
include $(TOP)/configure/RULES
#----------------------------------------
# ADD RULES AFTER THIS LINE
*****************************
To avoid compiler warnings I changed your testenable.c program to declare main() to return int, and added return 0;
*****************************
#include <cadef.h>
#include <ezca.h>
int main()
{
int d;
int s[384];
ezcaGet("det1.TSEN", ezcaLong, 384, &s);
ezcaGet("det1.CHAN",ezcaLong,1,&d);
s[d]=1;
ezcaPut("det1.TSEN", ezcaLong, 1, s);
return 0;
} /* end main() */
*****************************
Then I just typed "make" and it built fine.
*****************************
corvette:~/devel/testEnable/testEnableApp>make
perl -CSD /usr/local/epics/base-7.0.3.1/bin/linux-x86_64/makeMakefile.pl O.linux-x86_64 ../..
mkdir -p O.Common
make -C O.linux-x86_64 -f ../Makefile TOP=../.. \
T_A=linux-x86_64 install
make[1]: Entering directory `/home/epics/devel/testEnable/testEnableApp/O.linux-x86_64'
perl -CSD /usr/local/epics/base-7.0.3.1/bin/linux-x86_64/mkmf.pl -m testenable.d -I. -I../O.Common -I. -I. -I.. -I../../include/compiler/gcc -I../../include/os/Linux -I../../include -I/usr/local/epics/extensions_new/include
-I/usr/local/epics/base-7.0.3.1/include/compiler/gcc -I/usr/local/epics/base-7.0.3.1/include/os/Linux -I/usr/local/epics/base-7.0.3.1/include testenable.o ../testenable.c
make[1]: Leaving directory `/home/epics/devel/testEnable/testEnableApp/O.linux-x86_64'
make[1]: Entering directory `/home/epics/devel/testEnable/testEnableApp/O.linux-x86_64'
/usr/bin/gcc -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -Wall -mtune=generic -m64 -I. -I../O.Common -I. -I. -I.. -I../../include/compiler/gcc -I../../include/os/Linux
-I../../include -I/usr/local/epics/extensions_new/include -I/usr/local/epics/base-7.0.3.1/include/compiler/gcc -I/usr/local/epics/base-7.0.3.1/include/os/Linux -I/usr/local/epics/base-7.0.3.1/include -c ../testenable.c
/usr/bin/g++ -o testenable -L/home/epics/devel/testEnable/lib/linux-x86_64 -L/usr/local/epics/base-7.0.3.1/lib/linux-x86_64 -L/usr/local/epics/extensions_new/lib/linux-x86_64 -Wl,-rpath,/home/epics/devel/testEnable/lib/linux-x86_64
-Wl,-rpath,/usr/local/epics/base-7.0.3.1/lib/linux-x86_64 -Wl,-rpath,/usr/local/epics/extensions_new/lib/linux-x86_64 -rdynamic -m64 testenable.o -lezca -lca -lCom
Installing created executable ../../bin/linux-x86_64/testenable
make[1]: Leaving directory `/home/epics/devel/testEnable/testEnableApp/O.linux-x86_64'
*****************************
Mark
From: Siddons, David <siddons at bnl.gov>
Sent: Monday, February 3, 2020 11:51 AM
To: Mark Rivers <rivers at cars.uchicago.edu>
Cc: tech-talk <tech-talk at aps.anl.gov>
Subject: Re: ezca for 3.15
Hi Mark,
Added cadef.h and get:
gcc -c -fPIC -I/home/peter/epics/extensions/include -I/home/peter/epics/base/include -I/home/peter/epics/base/include/os/Linux testenable.c
In file included from /home/peter/epics/base/include/epicsTypes.h:19:0,
from /home/peter/epics/base/include/caerr.h:31,
from /home/peter/epics/base/include/cadef.h:48,
from testenable.c:1:
/home/peter/epics/base/include/compilerDependencies.h:19:10: fatal error: compilerSpecific.h: No such file or directory
#include "compilerSpecific.h"
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
I hacked a Makefile, and the above was generated when I used it. I got the same error when I used the single compile line I had before. I've attached the c file and the makefile. Any suggestions?
Pete.
________________________________________
From: Mark Rivers <mailto:rivers at cars.uchicago.edu>
Sent: Saturday, February 1, 2020 5:13 PM
To: Siddons, David <mailto:siddons at bnl.gov>
Cc: tech-talk <mailto:tech-talk at aps.anl.gov>
Subject: Re: ezca for 3.15
Hi Peter,
You need this to add this line in your program:
#include <cadef.h>
before
#include <ezca.h>
Because ezca.h uses chid, it should really be including cadef itself. But it doesn't.
Mark
________________________________
From: Siddons, David <mailto:siddons at bnl.gov>
Sent: Saturday, February 1, 2020 3:53 PM
To: Mark Rivers
Cc: tech-talk
Subject: Re: ezca for 3.15
Hi Mark,
OK, I rebuilt my extensions directory, and built ezca. All went well. When I try to use ezca I hit problems. Here is my simple program; it reads a vector, changes one element and then writes it back:
#include <ezca.h>
main()
{
int d;
int s[384];
ezcaGet("det1.TSEN", ezcaLong, 384, &s);
ezcaGet("det1.CHAN",ezcaLong,1,&d);
s[d]=1;
ezcaPut("det1.TSEN", ezcaLong, 1, s);
}
and my compile line:
gcc -o testenable -L/home/peter/epics/extensions-master/lib -I/home/peter/epics/extensions-master/include -I//home/peter/epics/base-3.15.6/include/ -lezca testenable.c
which gets me:
In file included from testenable.c:1:0:
/home/peter/epics/extensions-master/include/ezca.h:77:61: error: unknown type name ‘chid’; did you mean ‘void’?
epicsShareFunc int epicsShareAPI ezcaPvToChid(char *pvname, chid **cid);
^~~~
void
/home/peter/epics/extensions-master/include/ezca.h:103:2: error: unknown type name ‘TS_STAMP’
TS_STAMP *timestamp, short *status, short *severity);
^~~~~~~~
/home/peter/epics/extensions-master/include/ezca.h:107:45: error: unknown type name ‘TS_STAMP’
char ezcatype, int nelem, void *data_buff, TS_STAMP *timestamp,
^~~~~~~~
testenable.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
main()
^~~~
So what am I doing wrong?
Pete.
________________________________
From: Mark Rivers <mailto:rivers at cars.uchicago.edu>
Sent: Saturday, February 1, 2020 3:56 PM
To: Siddons, David <mailto:siddons at bnl.gov>
Cc: tech-talk <mailto:tech-talk at aps.anl.gov>
Subject: Re: ezca for 3.15
Hi Pete,
I suspect you may be using an old version of ezca? The latest version is here:
https://github.com/epics-extensions/extensions
<https://github.com:epics-extensions/extensions>
I just built successfully with that version on base 7.0.3.1, so I am pretty sure 3.15 will build fine as well.
Here is the output when building:
corvette:extensions_new/src/ezca>make
perl -CSD /corvette/usr/local/epics/base-7.0.3.1/bin/linux-x86_64/makeMakefile.pl O.linux-x86_64 ../../..
mkdir -p O.Common
make -C O.linux-x86_64 -f ../Makefile TOP=../../.. \
T_A=linux-x86_64 install
make[1]: Entering directory `/usr/local/epics/extensions_new/src/ezca/O.linux-x86_64'
perl -CSD /corvette/usr/local/epics/base-7.0.3.1/bin/linux-x86_64/mkmf.pl -m ezca.d -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/corvette/usr/local/epics/base-7.0.3.1/include/compiler/gcc
-I/corvette/usr/local/epics/base-7.0.3.1/include/os/Linux -I/corvette/usr/local/epics/base-7.0.3.1/include -I../../../include ezca.o ../ezca.c
make[1]: Leaving directory `/usr/local/epics/extensions_new/src/ezca/O.linux-x86_64'
make[1]: Entering directory `/usr/local/epics/extensions_new/src/ezca/O.linux-x86_64'
/usr/bin/gcc -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -Wall -mtune=generic -m64 -fPIC -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include
-I/corvette/usr/local/epics/base-7.0.3.1/include/compiler/gcc -I/corvette/usr/local/epics/base-7.0.3.1/include/os/Linux -I/corvette/usr/local/epics/base-7.0.3.1/include -I../../../include -c ../ezca.c
../ezca.c: In function 'pop_channel':
../ezca.c:7731:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Wformat=]
sizeof(struct channel)*NODESPERMAL, Channel_avail_hdr);
^
../ezca.c:7731:18: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
../ezca.c: In function 'pop_monitor':
../ezca.c:7812:21: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Wformat=]
sizeof(struct monitor)*NODESPERMAL, Monitor_avail_hdr);
^
../ezca.c:7812:21: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
../ezca.c: In function 'pop_work':
../ezca.c:7893:21: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Wformat=]
sizeof(struct work)*NODESPERMAL, Work_avail_hdr);
^
../ezca.c:7893:21: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
/usr/bin/ar -rc libezca.a ezca.o
/usr/bin/ranlib libezca.a
/usr/bin/g++ -o libezca.so -shared -fPIC -Wl,-hlibezca.so -L/usr/local/epics/extensions_new/lib/linux-x86_64 -L/usr/local/epics/base-7.0.3.1/lib/linux-x86_64 -Wl,-rpath,/usr/local/epics/extensions_new/lib/linux-x86_64 -Wl,-rpath,/usr/local/epics/base-7.0.3.1/lib/linux-x86_64
-rdynamic -m64 ezca.o -lca -lCom -lpthread -lreadline -lm -lrt -ldl -lgcc
Installing shared library ../../../lib/linux-x86_64/libezca.so
Installing library ../../../lib/linux-x86_64/libezca.a
Cheers,
Mark
________________________________
From: Tech-talk <mailto:tech-talk-bounces at aps.anl.gov> on behalf of Siddons, David via Tech-talk <mailto:tech-talk at aps.anl.gov>
Sent: Saturday, February 1, 2020 2:33 PM
To: EPICS Tech Talk
Subject: ezca for 3.15
I want to use ezca with 3.15, but it seems to be a mess of missing header files, presumably things dropped with 3.15 (e.g. tsDefs.h, cadef.h). Has anyone made it work?
Pete.