2
Compiling EPICS and Building IOC Applications on win32-x86 (Windows95/NT)
3
---------------------------------------------------------------------
5
Original port of EPICS base build system to WIN32 (Windows95/NT)
6
was done by Kay-Uwe Kasemir 11/96
8
please mail questions, comments, corrections, additional examples, etc
14
Right now this port of EPICS to win32-x86 should allow you to
16
* compile all of EPICS base using {Tornado, MS Visual C, perl,
17
GNU make} (only {MS Visual C, perl, GNU make} if you prefer
18
to compile only the host portions of EPICS base).
19
* load EPICS on an IOC (486, pentium, 68k, ...),
21
(no drivers/devices for real I/O available, yet.
22
Some Greenspring IP support [Relay, Dig, ADC, DAC] is in progress)
23
* build and use ca.dll on NT or Win95 to access all IOCs,
24
as well as the Com-library, gdd-library, cas-library,
25
and all other EPICS base libraries as DLLs.
26
* build gdd, cas and a demo of the new portable CA server on win32-x86.
28
To build only for win32-x86 and not cross compile for IOC development type
29
"make win32-x86" or in your configure/CONFIG_SITE file set
30
"CROSS_COMPILER_HOST_ARCHS="
35
To compile EPICS on win32-x86, we need
37
WindRiver System's Tornado (used: 1.0) (not required if host only build)
38
Microsoft's Visual C/C++ (used: 6.0) (borland C++ rumored to work also)
42
gnu make - www.gnu.org (we used 3.76)
43
perl - www.perl.org (we used 5.003)
45
The perl interpreter and gnu make are available 'on the net'
46
as sources which compile with MS Visual C++.
47
If you cannot/don't want to find them, contact me, please!
49
2) set environment variables
51
(Setting env. vars. is different: for NT, use Settings/System,
52
for Win95 use autoexec.bat)
54
When setting paths in the EPICS CONFIG files for win32-x86 the following
55
are hints in case you have trouble. You should not need to worry about
56
this unless you type a path into one of the EPICS config files that
57
includes a "\". In most situations gnu make, windows NT, the MS compiler,
58
and the MS linker will accept "/" and this will result in less trouble.
60
** Note that that each "\" in any path variables you set
61
must be replaced with a "\\" (this is because GNU make treats
62
all "\" characters as line continuation)
64
** Note that that each space in any file name or
65
path name variable you set must be replaced with
66
a "\ " (this is because GNU make treats all " " separated
67
input as independent tokens in the input stream.
69
** win32-x86 will generally allow "/" and "\" interchangeably in file paths,
70
but the DOS shell only accepts "\".
72
** Certain command line utilities such as the MS linker are known to in rare
73
situations confuse "/" in a path with command line options, and it may
74
be necessary to replace a "/" in a path that configured with "\\", but
75
the bulk of our experience indicates that this is not the necessary.
77
Your path should include:
78
- The EPICS-binaries that we are about to build in <EPICS>base/bin/win32-x86
79
- The System (for me it's in NT40...)
80
- The MS Visual C compiler binaries
85
C:\WINNT35.0\system32;
90
c:\epics\base\bin\win32 (really where INSTALL_LOCATION specifies)
92
On NT, "Path" is defined by the operating system, on Win95, it's "PATH" instead.
94
MS Visual C and Tornado should be installed properly with
95
these env. variables set:
97
WIND_BASE=c:\Tornado (required for cross development only)
98
WIND_HOST_TYPE=x86-win32 (required for cross development only)
100
This way the EPICS makesystem can locate Tornado
101
without any changes to the files in base/config.
102
So for pc486 the settings in CONFIG_SITE where
103
you specify the location of VxWorks are ignored,
104
this information is taken from WIND_BASE and _HOST_TYPE!!
107
include=c:\msdev\include;c:\msdev\mfc\include
108
lib=c:\msdev\lib;c:\msdev\mfc\lib
110
Select host arch to build:
111
EPICS_HOST_ARCH=win32-x86 (used by the make system)
113
Set the "TMP" environment variable if you need to specify where
114
temporary files are created.
116
Directory Used For Temporary Files Conditions
117
---------------------------------- ----------
118
Directory specified by TMP TMP environment variable is set,
119
and directory specified by TMP exists.
120
dir argument to _tempnam TMP environment variable is not set, or
121
directory specified by TMP does not exist.
122
P_tmpdir in STDIO.H dir argument is NULL, or dir is name of
123
nonexistent directory.
124
Current working directory P_tmpdir does not exist.
126
On my system I see in stdio.h that _P_tmpdir is "/". Here is a common
127
setting for "TMP" (the C:\TEMP directory must exist).
134
Prepare apx. 2 ltr. Tee and type:
139
Watch for errors and send them to me.
142
* gnumake seems to be faster than win32-x86 sometimes
143
which results in warnings/errors like
144
"file has modification date in the future"
145
for newly created things.
146
Very seldom this is fatal, so you have to
147
stop gnumake and restart it.
148
* This is strange because Windows95/NT doesn't care
149
about upper/lower case:
150
WIN32 is WIN32, not win32. Gnumake fails
151
if e.g. base/src/include/os/WIN32 is ...win32.
153
4) Creating EPICS IOC applications under win32-x86
155
o create application development folder
157
o start a DOS window and change your working directory to the folder
158
created above (with the DOS "cd" command)
160
o to create an example application type:
161
"perl c:\epics\bin\win32\makeBaseApp.pl -b c:\\epics -e
163
** Note that that each "\" above in any path arguments to makeBaseApp.pl
164
must be replaced with a "\\" (this is because GNU make treats
165
all "\" characters as line continuation)
167
** Note that that each space in any file name or
168
path name argument to makeBaseApp.pl must be replaced with
169
a "\ " (this is because GNU make treats all " " separated
170
input as independent tokens in the input stream.
172
** Note that c:\epics above must be replaced by the path
173
to your epics source installation (or where INSTALL_LOCATION
176
o General information on EPICS IOC application development can be found in
177
the "EPICS IOC Application Developers Guide". To see all of the options
178
supported by makeBaseApp.pl type "perl c:\epics\bin\win32\makeBaseApp.pl"
180
5) EPICS GNU make makefiles can be executed from within a Visual C++ "makefile"
181
style project. This allows EPICS programs to be developed directly inside of
182
the visual C++ environment. To do this create a "makefile" project and place your
183
gnu make command in the build configuration (accessed from the project/settings menu).
184
You will also need to add GNU make and <EPICS>/bin/win32 into the Visual C++
185
executable search path (from the tools/options menu).
186
In visual C++ it is possible to double click on the compiler
187
error messages generated within an EPICS "makefile" style project and have visual
188
C++ immediately position the cursor on the corresponding line in the source. I
189
have found that this works correctly with Makefile projects if the project is in a
190
directory just below the source code. The following build command works well
191
in a visual C++ make file project: "kill caRepeater.exe&make -C ..". Be careful
192
not to introduce additional spaces around the &. The kill.exe command is in the
195
6) Issues that you should be aware of if you are building code that
196
calls EPICS, but you are not using the EPICS build system.
198
6a) You will need to include header files from the following paths.
200
<epics>\base\include\os\win32
201
6b) You will need to link with the following path in effect.
202
<epics>\base\lib\win32-x86.
203
6c) If the visual C++ /Za option is not used then you will also need to define
204
__STDC__ to be zero on the command line so that EPICS headers will know that
205
a ANSI standard C compiler is in use.
206
6d) If you link with EPICS object libraries then specify /MT or /MTd
207
depending on whether EPICS base and your code are built for debugging.
208
This specifies the multithreaded operating environment required by EPICS.
209
This will also not define _DLL and therefore the EPICS header files will
210
not specify that sharable libraries are being called. EPICS object library
211
names follow the convention "xxxObj.lib".
212
6e) If you link with EPICS shareable libraries (with DLLs) then you must
213
use /MDd or /MD depending on whether EPICS base and your code are
214
built for debugging. This specifies the multithreaded operating environment
215
required by EPICS. This will also define _DLL and therefore the EPICS header
216
files will specify an optimized calling convention for shareable libraries.
217
EPICS shareable libraries (DLL) names follow the convention "xxx.lib"