Update: So when I looked at the epics-base code on GitHub, the list_character_set function (https://github.com/epics-base/epics-base/blob/7.0/modules/libcom/src/flex/ccl.c)
is different than the one in the tar.gz (https://epics-controls.org/download/base/base-7.0.4.1.tar.gz).
I decided to compile the epics-base code instead, and it appears to be working so far.
From: Wang, Andrew
Sent: Monday, April 28, 2025 11:04 AM
To: Freddie Akeroyd - STFC UKRI <freddie.akeroyd at stfc.ac.uk>; EPICS tech-talk <tech-talk at aps.anl.gov>
Subject: RE: FYI, the msys2 compilation approach is not working
Hi Freddie,
An update. The compiler is complaining about this block of code in modules/libcom/src/flex. I copied the logs at the bottom too.
void list_character_set(FILE *file, int cset[])
{
int i;
char *readable_form();
putc( '[', file );
for ( i = 0; i < csize; ++i )
{
if ( cset[i] )
{
int start_char = i;
putc( ' ', file );
fputs( readable_form( i ), file );
while ( ++i < csize && cset[i] )
;
if ( i - 1 > start_char )
/* this was a run */
fprintf( file, "-%s", readable_form( i - 1 ) );
putc( ' ', file );
}
}
putc( ']', file );
}
../flex/ccl.c: In function 'list_character_set':
../flex/ccl.c:147:20: error: too many arguments to function 'readable_form'; expected 0, have 1
147 | fputs( readable_form( i ), file );
| ^~~~~~~~~~~~~ ~
../flex/ccl.c:135:11: note: declared here
135 | char *readable_form();
| ^~~~~~~~~~~~~
../flex/ccl.c:154:39: error: too many arguments to function 'readable_form'; expected 0, have 1
154 | fprintf( file, "-%s", readable_form( i - 1 ) );
| ^~~~~~~~~~~~~ ~~~~~
../flex/ccl.c:135:11: note: declared here
135 | char *readable_form();
| ^~~~~~~~~~~~~
Installing PERL_MODULES file ../../../../lib/perl/EPICS/macLib.pm
make[4]: *** No rule to make target 'ccl.obj', needed by 'e_flex.exe'. Stop.
make[4]: Leaving directory '/c/Users/wang126/base-R7.0.4.1/modules/libcom/src/O.windows-x64-mingw'
make[3]: *** [../../../configure/RULES_ARCHS:58: install.windows-x64-mingw] Error 2
make[3]: Leaving directory '/c/Users/wang126/base-R7.0.4.1/modules/libcom/src'
make[2]: *** [../../configure/RULES_DIRS:85: src.install] Error 2
make[2]: Leaving directory '/c/Users/wang126/base-R7.0.4.1/modules/libcom'
make[1]: *** [../configure/RULES_DIRS:85: libcom.install] Error 2
make[1]: Leaving directory '/c/Users/wang126/base-R7.0.4.1/modules'
make: *** [configure/RULES_DIRS:85: modules.install] Error 2
Hi,
I’ve just installed the default gcc for the “MSYS2 MSYS” terminal and i get the same result as you for a gcc -v, so it looks like
you build is somehow picking up the “MSYS2 MSYS” environment rather than “MSYS2 MinGW 64bit”
Regards,
Freddie
Hi,
Your gcc seems to be targetting x86_64-pc-msys whereas mine targets x86_64-w64-mingw32 I think that may be the problem.
For gcc -v I see
$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-14.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --buil
d=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-head
er-dir=/mingw64/include --libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release --wit
h-arch=nocona --with-tune=generic --enable-mingw-wildcard --enable-languages=c,lto,c++,fortran,ada,o
bjc,obj-c++,rust,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --ena
ble-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time
--disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-libssp --disable-multilib --disable-
rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --wi
th-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --wi
th-pkgversion='Rev3, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/i
ssues --with-gnu-as --with-gnu-ld --disable-libstdcxx-debug --enable-plugin --with-boot-ldflags=-sta
tic-libstdc++ --with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.0 (Rev3, Built by MSYS2 project)
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-msys/13.3.0/lto-wrapper.exe
Target: x86_64-pc-msys
Configured with: /c/S/B/src/gcc-13.3.0/configure --build=x86_64-pc-msys --prefix=/usr --libexecdir=/usr/lib --enable-bootstrap --enable-static --enable-shared --enable-shared-libgcc
--enable-version-specific-runtime-libs --with-arch=nocona --with-tune=generic --disable-multilib --enable-__cxa_atexit --with-dwarf2 --enable-languages=c,c++,lto --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm
--enable-libquadmath --enable-libquadmath-support --disable-libssp --disable-win32-registry --disable-symvers --with-gnu-ld --with-gnu-as --disable-isl-version-check --enable-checking=release --without-libiconv-prefix --without-libintl-prefix --with-system-zlib
--enable-linker-build-id --enable-libstdcxx-filesystem-ts
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.3.0 (GCC)
Hi,
The windows-x64 target is only for a visual studio windows build, windows-x64-mingw is correct for MinGW. Can you just check that you ran this build from a “MSYS2 MinGW 64bit” window
rather than a “MSYS2 MSYS” terminal. What does
gcc -v
Show?
Regards,
Freddie
Hi all,
I’m following the instructions on this
webpage for installing EPICS using msys2.
Everything worked fine up until the “Download and build EPICS Base” section. After running “export EPICS_HOST_ARCH=windows-x64-mingw”, I get the following errors. Do you suggest that
I potentially change the architecture to windows-x64, rather than windows-x64-mingw?
../osi/os/WIN32/epicsTempFile.c: In function ‘epicsTempFile’:
../osi/os/WIN32/epicsTempFile.c:31:20: warning: implicit declaration of function ‘_tempnam’; did you mean ‘tempnam’? [-Wimplicit-function-declaration]
31 | char * pName = _tempnam("c:\\tmp", "epics");
| ^~~~~~~~
| tempnam
../osi/os/WIN32/epicsTempFile.c:31:20: warning: initialization of ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
../osi/os/WIN32/epicsTempFile.c:45:24: error: ‘_O_CREAT’ undeclared (first use in this function); did you mean ‘O_CREAT’?
45 | int openFlag = _O_CREAT | _O_EXCL | _O_RDWR |
| ^~~~~~~~
| O_CREAT
../osi/os/WIN32/epicsTempFile.c:45:24: note: each undeclared identifier is reported only once for each function it appears in
../osi/os/WIN32/epicsTempFile.c:45:35: error: ‘_O_EXCL’ undeclared (first use in this function); did you mean ‘O_EXCL’?
45 | int openFlag = _O_CREAT | _O_EXCL | _O_RDWR |
| ^~~~~~~
| O_EXCL
../osi/os/WIN32/epicsTempFile.c:45:45: error: ‘_O_RDWR’ undeclared (first use in this function); did you mean ‘O_RDWR’?
45 | int openFlag = _O_CREAT | _O_EXCL | _O_RDWR |
| ^~~~~~~
| O_RDWR
../osi/os/WIN32/epicsTempFile.c:46:13: error: ‘_O_SHORT_LIVED’ undeclared (first use in this function)
46 | _O_SHORT_LIVED | _O_BINARY | _O_TEMPORARY;
| ^~~~~~~~~~~~~~
../osi/os/WIN32/epicsTempFile.c:46:30: error: ‘_O_BINARY’ undeclared (first use in this function); did you mean ‘O_BINARY’?
46 | _O_SHORT_LIVED | _O_BINARY | _O_TEMPORARY;
| ^~~~~~~~~
| O_BINARY
../osi/os/WIN32/epicsTempFile.c:46:42: error: ‘_O_TEMPORARY’ undeclared (first use in this function)
46 | _O_SHORT_LIVED | _O_BINARY | _O_TEMPORARY;
| ^~~~~~~~~~~~
../osi/os/WIN32/epicsTempFile.c:47:40: error: ‘_S_IWRITE’ undeclared (first use in this function); did you mean ‘S_IWRITE’?
47 | int fd = open(pName, openFlag, _S_IWRITE);
| ^~~~~~~~~
| S_IWRITE
../osi/os/WIN32/epicsTempFile.c:50:24: warning: implicit declaration of function ‘_fdopen’; did you mean ‘fdopen’? [-Wimplicit-function-declaration]
50 | pNewFile = _fdopen(fd, "w+b");
| ^~~~~~~
| fdopen
../osi/os/WIN32/epicsTempFile.c:50:22: warning: assignment to ‘FILE *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
50 | pNewFile = _fdopen(fd, "w+b");
| ^
gcc -D_MINGW -D__USE_MINGW_ANSI_STDIO -O3 -Wall -m64 -DEPICS_BUILD_DLL -DEPICS_CALL_DLL -I. -I../O.Common -I. -I../osi/compiler/gcc -I../osi/compiler/default
-I. -I../osi/os/WIN32 -I../osi/os/default -I.. -I../as -I../bucketLib -I../calc -I../cvtFast -I../cppStd -I../cxxTemplates -I../dbmf -I../ellLib -I../env -I../error -I../fdmgr -I../flex -I../freeList -I../gpHash -I../iocsh -I../log -I../macLib -I../misc -I../osi
-I../pool -I../ring -I../taskwd -I../timer -I../yacc -I../yacc -I../yajl -I../../../../include/compiler/gcc -I../../../../include/os/WIN32 -I../../../../include -o ccl.obj -c ../flex/ccl.c
In file included from ../flex/flexdef.h:38,
from ../flex/ccl.c:29:
../osi/os/WIN32/osiUnistd.h:16:10: fatal error: direct.h: No such file or directory
16 | #include <direct.h>
| ^~~~~~~~~~
compilation terminated.
make[4]: *** No rule to make target 'ccl.obj', needed by 'e_flex.exe'. Stop.
make[4]: Leaving directory '/c/Users/wang126/base-R7.0.4.1/modules/libcom/src/O.windows-x64-mingw'
make[3]: *** [../../../configure/RULES_ARCHS:58: install.windows-x64-mingw] Error 2
make[3]: Leaving directory '/c/Users/wang126/base-R7.0.4.1/modules/libcom/src'
make[2]: *** [../../configure/RULES_DIRS:85: src.install] Error 2
make[2]: Leaving directory '/c/Users/wang126/base-R7.0.4.1/modules/libcom'
make[1]: *** [../configure/RULES_DIRS:85: libcom.install] Error 2
make[1]: Leaving directory '/c/Users/wang126/base-R7.0.4.1/modules'
make: *** [configure/RULES_DIRS:85: modules.install] Error 2
Purple
ribbon awareness