Joachim Falk wrote:
the find-sed script assumes that the temp dir is /tmp witch isnt always true under djgpp. instead you should use the TMPDIR var witch is set in djgpp.env
I'll change it (also in two other scripts, but those are not normally needed for building GPC).
If TMPDIR isn't set, they'll default to /tmp -- or should they rather use /var/tmp?
The Problem is that the latest version of cygwin downloaded just 3 days ago doesnt have MAP_FAILED in /usr/include/sys/mman.h this prevents rts.c to compile I dont know if this is a bug in the cygwin header files or in gpc
I don't know either, but it seems easy enough to change in GPC. Just to be sure: It does have mmap, but not MAP_FAILED? What does mmap return on failure? If it's either NULL or ((void *) -1), it should be alright after my change. If it's something else, let me know.
The problem is the `echo $CC | sed 's/gcc/gpc/'` in p/rts/Makefile.in if $CC contains gcc in more than one position patched attached I havent tested this on the djgpp system but it schould work i have test dos style path with the sed script and it works
Good point, I'll apply your patch. (BTW, inside `[]' you don't need to quote the backslash. A single `' is enough, but of course, `\' also works, it's just redundant.)
Thanks for the reports and fixes.
Frank
On Mon, 24 Jul 2000, Frank Heckenbach wrote:
Joachim Falk wrote:
[SNIP]
The Problem is that the latest version of cygwin downloaded just 3 days ago doesnt have MAP_FAILED in /usr/include/sys/mman.h this prevents rts.c to compile I dont know if this is a bug in the cygwin header files or in gpc
I don't know either, but it seems easy enough to change in GPC. Just to be sure: It does have mmap, but not MAP_FAILED? What does mmap return on failure? If it's either NULL or ((void *) -1), it should be alright after my change. If it's something else, let me know.
[SNIP to end]
I have made a test program and it seams it does return (void *) -1 on failure
#include <stdio.h> #include <string.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <sys/mman.h> #include <sys/stat.h>
char *basename( char *file ) { char *ptr = strrchr( file, '/' ); if ( !ptr ) ptr = strrchr( file, '\' ); if ( !ptr ) ptr = file - 1; return ptr + 1; }
int main( int argc, char *argv[] ) { char *map_file; int map_fd; void *map_region; size_t pagesize; char *progname = "UNKNOWN";
if ( argc > 0 ) progname = basename( argv[0] ); if ( argc != 2 ) { fprintf( stderr, "%s <file to map>\n", progname ); exit( -1 ); } map_file = argv[1]; map_fd = open( map_file, O_RDWR ); if ( map_fd < 0 ) { fprintf( stderr, "%s: can't open file %s for reading: %s\n", progname, map_file, strerror( errno ) ); // exit( -1 ); map_fd = 9999; } pagesize = getpagesize(); map_region = mmap( NULL, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, map_fd, 0 ); printf( "map_region = %lX\n", (long) map_region ); printf( "errno = %d => %s\n", errno, strerror( errno ) ); return 0; }
=> get map_test.exe: can't open file foo for reading: No such file or directory map_region = FFFFFFFF errno = 9 => Bad file number => yep its (void *) -1 Joachim Falk