Cap5 is not built on Windows targets

Bug #684938 reported by Andrew Johnson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EPICS Base
Won't Fix
Wishlist
Andrew Johnson

Bug Description

Sergey Stepanov asked:

How much work would be to make Cap5 compiling under win32?
I've tried installing base-3.14.11 and base-3.14.12 and in both cases under win32 make does not produce Cap5.c and Cap5.dll.
I use PEZCA, would like to switch to Cap5, but need the win32 compatibility because most of my scripts are debugged on Windows.

Tags: cap5
Revision history for this message
Andrew Johnson (anj) wrote :

I responded:

Base deliberately doesn't compile Cap5 on Windows because building a Perl module requires that you be using the same C compiler that your installation of Perl was built with, and that often isn't the case. However if you wish to try it you can edit the base/src/cap5/Makefile and comment out the "ifeq" on line 25 and its corresponding "endif" on line 36. Make will now try to build the Cap5.dll library on windows and will install the module and example scripts.

Revision history for this message
Andrew Johnson (anj) wrote :

Sergey replied:

It seems to be more than just uncommenting. First the Makefile line:

EXTUTILS = $(shell $(PERL) ../perlConfig.pl privlib)/ExtUtils

produces incorrect "EXTUTILS = C:Perllib/ExtUtils" which leads to an error. Setting EXTUTILS explicitly to "EXTUTILS = c:/perl/lib/ExtUtils" raises further errors:

C:\epics\base\src\cap5>make
make -C O.win32-x86 -f ../Makefile TOP=../../.. T_A=win32-x86 install
make[1]: Entering directory `/cygdrive/c/epics/base/src/cap5/O.win32-x86'
perl -MExtUtils::Command -e rm_f Cap5.c Cap5.c_new
perl c:/perl/lib/ExtUtils/xsubpp -typemap c:/perl/lib/ExtUtils/typemap ../Cap5.xs > Cap5.c_new &&
perl -MExtUtils::Command -e mv Cap5.c_new Cap5.c
cl -c /nologo /D__STDC__=0 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /Ox /GL /W3 /w44355
-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX /MD -I. -I..\\O.Common -I. -I.. -I..\\..\\..\\include\\os\\WIN32 -I..\\..\\..\\include -IC:\Perl\lib\\CORE Cap5.c
cl : Command line warning D9025 : overriding '/Ox' with '/O1'
Cap5.c
C:\epics\base\include\alarmString.h(30) : warning C4273: 'epicsAlarmSeverityStrings' : inconsistent dll linkage
         C:\epics\base\include\alarm.h(46) : see previous definition of 'epicsAlarmSeverityStrings'
C:\epics\base\include\alarmString.h(40) : warning C4273: 'epicsAlarmConditionStrings' : inconsistent dll linkage
         C:\epics\base\include\alarm.h(101) : see previous definition of 'epicsAlarmConditionStrings'
../Cap5.xs(291) : warning C4244: 'function' : conversion from 'time_t' to 'IV', possible loss of data
../Cap5.xs(574) : warning C4244: '=' : conversion from 'IV' to 'dbr_char_t', possible loss of data
../Cap5.xs(667) : warning C4244: '=' : conversion from 'IV' to 'dbr_char_t', possible loss of data
../Cap5.xs(714) : warning C4244: '=' : conversion from 'IV' to 'dbr_put_acks_t', possible loss of data
../Cap5.xs(830) : warning C4018: '>' : signed/unsigned mismatch
../Cap5.xs(906) : warning C4018: '>' : signed/unsigned mismatch
../Cap5.xs(1110) : warning C4013: 'va_copy' undefined; assuming extern returning int
link /nologo /subsystem:windows /dll /LTCG /incremental:no /opt:ref
/release /version:3.14 /implib:Cap5.lib /out:Ca
p5.dll Cap5.obj ..\\..\\..\\lib\\win32-x86\\ca.lib
..\\..\\..\\lib\\win32-x86\\Com.lib
    Creating library Cap5.lib and object Cap5.exp
Cap5.obj : error LNK2001: unresolved external symbol _Perl_sv_setpvn
Cap5.obj : error LNK2001: unresolved external symbol _Perl_sv_2mortal
Cap5.obj : error LNK2001: unresolved external symbol _Perl_newSVsv
Cap5.obj : error LNK2001: unresolved external symbol _Perl_Isv_no_ptr
...
Cap5.obj : error LNK2001: unresolved external symbol _Perl_sv_backoff
Cap5.obj : error LNK2001: unresolved external symbol _Perl_sv_newmortal
Cap5.obj : error LNK2001: unresolved external symbol _Perl_Imarkstack_max_ptr
Cap5.dll : fatal error LNK1120: 62 unresolved externals
make[1]: *** [Cap5.dll] Error 96
make[1]: Leaving directory `/cygdrive/c/epics/base/src/cap5/O.win32-x86'
make: *** [install.win32-x86] Error 2

Revision history for this message
Andrew Johnson (anj) wrote :

The EXTUTILS problem is caused by perlConfig.pl not properly escaping the value of privlib. It should probably replace back-slashes with forward slashes to avoid difficulties with quoting.

> C:\epics\base\include\alarmString.h(30) : warning C4273:
> 'epicsAlarmSeverityStrings' : inconsistent dll linkage
> C:\epics\base\include\alarm.h(46) : see previous definition of
> 'epicsAlarmSeverityStrings'
> C:\epics\base\include\alarmString.h(40) : warning C4273:
> 'epicsAlarmConditionStrings' : inconsistent dll linkage
> C:\epics\base\include\alarm.h(101) : see previous definition of
> 'epicsAlarmConditionStrings'
These are warnings about EPICS definitions that probably don't have the right decorations in the header file.

> ../Cap5.xs(1110) : warning C4013: 'va_copy' undefined; assuming extern
> returning int
On Win32 I believe we can define va_copy as
        #define va_copy(d, s) ((d) = (s))
to solve this, since MSVC doesn't provide the macro for us. This isn't portable though.

Unfortunately I don't know enough about building Perl modules on Windows to suggest what the solution is to the unresolved symbols. They should all be provided by the Perl executable which will be loading the Cap5.dll that we're trying to create. They should be resolved when the DLL is loaded, but I don't know how to tell the linker that. There is a file called perl510.lib in my C:\Perl\lib\CORE directory, but I don't think the answer is going to be just to link with that file.

Revision history for this message
Andrew Johnson (anj) wrote :

This patch should solve the EXTUTILS and va_copy() problems, but it won't touch the other two issues.

Changed in epics-base:
assignee: nobody → Andrew Johnson (anj)
importance: Undecided → Wishlist
Revision history for this message
Andrew Johnson (anj) wrote :

I just applied this patch to the 3.15 branch, but it doesn't solve the underlying problem — Cap5 just isn't supported on Windows.

Changed in epics-base:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.