#1506: compiling Cactus on Windows --------------------------------+------------------------------------------- Reporter: jtao | Owner: Type: defect | Status: new Priority: minor | Milestone: Component: Cactus | Version: development version Keywords: compiling, windows | --------------------------------+------------------------------------------- Hi,
In the process to create the cactusBSSN benchmark for SPEC, I worked with Mat from PGI(now NVIDIA) to help resolve some compilation issues on Windows. I don't have patches for each one of them, but attemptive solutions could be found in the email below.
These are not critical issues but it would be good to be resolved to help future windows users if there is any.
Regards, Jian
Mathew COLGROVE wrote:
Hi Jian,
I've been working on porting cactusBSSN to Windows. After working
through some header file configuration, I encountered several undefined references. I've been able to work around some of them, but a few others I need some help with.
- "STDOUT_FILENO" and "STDERR_FILENO" in Cactus/main/Warnlevel.c
These symbols are found in "unistd.h" which is not available on Windows.
I just commented these lines out since I don't think this section is executed. Though, the proper fix would be to define then in
the cctk_Config.h file if not "HAVE_UNISTD_H" is not.
The function isatty is defined in unistd.h. A conditional macro will be necessary for that function as well in this case.
#if HAVE_UNISTD_H
if (!isatty (STDOUT_FILENO)) val = "";
#endif
- "hypot" and "copysign" in Cactus/main/Complex.c
Windows does support "hypot" and "copysign", however they spell them
"_hypot" and "_copysign". To work around, I created two versions of each macro that use these symbols.
I will probably do the same.
- "regexec", "regfree", and "regcomp" in Cactus/main/Parameters.c and
Cactus/utils/misc.c
Windows does not support these functions. We may be able to integrate a
port from glibc into the benchmark but I would rather not. Since previous versions of Cactus did not used these symbols, can we use an older version other these files?
As a matter of fact, Cactus includes files from the src of the GNU C library. You can find them under Your_Cactus/src/gnu.
It is likely that you pre-configured Cactus on a linux box or other systems which provide the library. Cactus will then use the system default instead.
To compiler regex.c getopt.c distributed with Cactus, you need to go to
Your_Cactus/configs/spec/config-data/
and set both BUILD_GETOPT BUILD_REGEX to yes.
# GNU stuff BUILD_GETOPT = yes BUILD_REGEX = yes
This will solve #4 below as well.
- "getopt_long_only", "optarg", and "optind" in
Cactus/main/ProcessCommandLine.c
Again, there is no Windows equivalent for these symbols. We may be able
to integrate something from http://gnuwin32.sourceforge.net/packages/libgw32c.htm, but I would rather not. Since previous versions of Cactus did not used these symbols, can we use an older version other this file?
- "gethostname" and "gethostbyname" in Cactus/utils/Network.c
Windows does have these functions but we'd need to link with a DLL which
I'd rather not have to do (the user should have the option on how to link). Though, I think we'd be safe to remove these functions.
Yes, the prototypes of gethostname and gethostbyname can be found in winsock2.h, and Cactus knows how to deal with them on Windows.
--------------------------------------- Network.c : ... #elif defined HAVE_WINSOCK2_H #include <winsock2.h> #endif /* HAVE_WINSOCK2_H */ ... ---------------------------------------
If linking DLL will be an issue, I would suggest you keep Util_GetHostName but make it a dummy function since Util_GetHostName serves as the interface to gethostname for Cactus.
Regards, Jian