Skip to content

Instantly share code, notes, and snippets.

@Madsy
Last active January 2, 2016 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Madsy/f8c3dc3e43d4b91df650 to your computer and use it in GitHub Desktop.
Save Madsy/f8c3dc3e43d4b91df650 to your computer and use it in GitHub Desktop.
When cross-compiling with MinGW I get:
make[3]: Entering directory `/home/madsy/projects/guile-2.1.1-win/libguile'
CC libguile_2.2_la-loader.lo
loader.c: In function 'map_file_contents':
loader.c:481:21: error: 'SEEK_START' undeclared (first use in this function)
if (lseek (fd, 0, SEEK_START) < 0)
^
loader.c:481:21: note: each undeclared identifier is reported only once for each function it appears in
loader.c:492:18: error: 'end' undeclared (first use in this function)
data = malloc (end);
The condittional build path taken depends on whether or not the system has the <sys/mman.h> header:
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
static char*
map_file_contents (int fd, size_t len, int *is_read_only)
#define FUNC_NAME "load-thunk-from-file"
{
char *data;
#ifdef HAVE_SYS_MMAN_H
data = mmap (NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
if (data == MAP_FAILED)
SCM_SYSERROR;
*is_read_only = 1;
#else
if (lseek (fd, 0, SEEK_START) < 0) <---- this path is taken as mingw does not have mman.h
{
int errno_save = errno;
(void) close (fd);
errno = errno_save;
SCM_SYSERROR;
}
/* Given that we are using the read fallback, optimistically assume
that the .go files were made with 8-byte alignment.
alignment. */
data = malloc (end);
if (!data)
{
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment