This is an old revision of the document!
Building SIS
Replace restrict
to restrict_var
– it is a keyword now.
Use __MINGW32__
macro to distinguish Linux/Windows builds.
For Windows builds add -lwinmm
to the linker command.
Cross-compiling for Windows
Install MinGW-W64:
sudo apt install mingw-w64
Add the following files to /usr/share/mingw-w64/include/sys/
header files
- resource.h
#ifndef _RESOURCE_H
#define _RESOURCE_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
#include <time.h>
#define RUSAGE_SELF 0 /* calling process */
#define RUSAGE_CHILDREN -1 /* terminated child processes */
struct rusage {
struct timeval ru_utime; /* user time used */
struct timeval ru_stime; /* system time used */
long ru_maxrss; /* integral max resident set size */
long ru_ixrss; /* integral shared text memory size */
long ru_idrss; /* integral unshared data size */
long ru_isrss; /* integral unshared stack size */
long ru_minflt; /* page reclaims */
long ru_majflt; /* page faults */
long ru_nswap; /* swaps */
long ru_inblock; /* block input operations */
long ru_oublock; /* block output operations */
long ru_msgsnd; /* messages sent */
long ru_msgrcv; /* messages received */
long ru_nsignals; /* signals received */
long ru_nvcsw; /* voluntary context switches */
long ru_nivcsw; /* involuntary context switches */
};
#define RLIMIT_CPU 0 /* cpu time in milliseconds */
#define RLIMIT_FSIZE 1 /* maximum file size */
#define RLIMIT_DATA 2 /* data size */
#define RLIMIT_STACK 3 /* stack size */
#define RLIMIT_CORE 4 /* core file size */
#define RLIMIT_RSS 5 /* resident set size */
#define RLIMIT_MEMLOCK 6 /* locked-in-memory address space */
#define RLIMIT_NPROC 7 /* number of processes */
#define RLIMIT_NOFILE 8 /* number of open files */
#define RLIM_NLIMITS 9 /* number of resource limits */
#define RLIM_INFINITY ((long) ((1UL << 31) - 1UL))
#define RLIM_SAVED_CUR (RLIM_INFINITY)
#define RLIM_SAVED_MAX (RLIM_INFINITY)
typedef long rlim_t;
struct rlimit {
rlim_t rlim_cur; /* current (soft) limit */
rlim_t rlim_max; /* maximum value for rlim_cur */
};
int getrusage(int _who, struct rusage *_rusage);
int getrlimit(int _rltype, struct rlimit *_rlimit);
int setrlimit(int _rltype, const struct rlimit *_rlimit);
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#ifdef __cplusplus
}
#endif
#endif /* !_RESOURCE_H */
- wait.h
#ifndef _WAIT_H
#define _WAIT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __STRICT_ANSI__
#include <sys/types.h>
#define WEXITSTATUS(stat_val) ( (stat_val) & 0x000ff)
#define WIFEXITED(stat_val) (!((stat_val) & 0x3ff00))
#define WIFSIGNALED(stat_val) ( ((stat_val) & 0x3ff00))
#define WIFSTOPPED(stat_val) 0
#define WNOHANG 1
#define WSTOPSIG(stat_val) 0
#define WTERMSIG(stat_val) ( ((stat_val) >> 8 ) & 0x3ff)
#define WUNTRACED 0
pid_t wait(int *stat_loc);
pid_t waitpid(pid_t pid, int *stat_loc, int options);
#endif /* !__STRICT_ANSI__ */
#ifdef __cplusplus
}
#endif
#endif /* !_WAIT_H */
Create symbolic links to the above files from
/usr/i686-w64-mingw32/include/sys
:
ln -s ../../../share/mingw-w64/include/sys/resource.h
ln -s ../../../share/mingw-w64/include/sys/wait.h
Create symbolic links to the above files from
/usr/x86_64-w64-mingw32/include/sys
:
ln -s ../../../share/mingw-w64/include/sys/resource.h
ln -s ../../../share/mingw-w64/include/sys/wait.h
32-bit for Windows
Rebuild SIS:
./configure --host=i686-w64-mingw32
make
64-bit for Windows
Rebuild SIS:
./configure --host=x86_64-w64-mingw32
make
Compiling for Linux
32-bit for Linux
Rebuild SIS:
CFLAGS=-m32 ./configure
make
64-bit for Linux
Rebuild SIS:
CFLAGS=-m64 ./configure
make