Closed nebiun closed 7 years ago
Same problem with devkitPPC r28
And in devkitPPC r27.
access prototype and defines needed for call the function are present in
devkitPPC/powerpc-eabi/include/sys/unistd.h
but the function is not in the library
I think it is a issue...
I think this can be an acceptable working version of access()
int access (const char *file, int type) { struct stat stbuf; gid_t gid; uid_t uid;
if (file == NULL || (type & ~(R_OK|W_OK|X_OK|F_OK)) != 0) {
errno = EINVAL;
return -1;
}
if(stat(file, &stbuf) == -1)
return -1;
// No getgid() and getuid()? Well, we are God!
// gid = getgid(); // uid = getuid(); uid = stbuf.st_uid; gid = stbuf.st_gid;
if(uid == stbuf.st_uid) {
if( ((type & R_OK) && !(stbuf.st_mode & S_IRUSR) ) ||
((type & W_OK) && !(stbuf.st_mode & S_IWUSR) ) ||
((type & X_OK) && !(stbuf.st_mode & S_IXUSR) ) ) {
errno = EACCES;
return -1;
}
}
else if(gid == stbuf.st_gid) {
if( ((type & R_OK) && !(stbuf.st_mode & S_IRGRP) ) ||
((type & W_OK) && !(stbuf.st_mode & S_IWGRP) ) ||
((type & X_OK) && !(stbuf.st_mode & S_IXGRP) ) ) {
errno = EACCES;
return -1;
}
}
else {
if( ((type & R_OK) && !(stbuf.st_mode & S_IROTH) ) ||
((type & W_OK) && !(stbuf.st_mode & S_IWOTH) ) ||
((type & X_OK) && !(stbuf.st_mode & S_IXOTH) ) ) {
errno = EACCES;
return -1;
}
}
return 0;
}
Please note - devkitPro is the organisation dedicated to producing cross compilers and associated libraries. What you were referring to here is an issue relating to compiling libpng with devkitPPC which isn't really relevant to newlib.
I'll explain further on the forum thread at https://devkitpro.org/viewtopic.php?f=3&t=8650
Error compiling libpng-1.6.28 (portlibs)
Makefile generated with this script:
---cut here
!/bin/bash
PATH=${DEVKITPPC}/bin:${PATH} HOST=powerpc-eabi PREFIX=${DEVKITPRO}/portlibs/ppc
libpng
cd libpng* CPPFLAGS=-I${PREFIX}/include LDFLAGS=-L${PREFIX}/lib ./configure \ --prefix=${PREFIX} --host=${HOST} --disable-shared --enable-static make && make install cd ${home}
---cut here
This is the output:
$ make make all-am make[1]: Entering directory
/c/Users/Nebiun/Downloads/WIIdev/portlibs_2017/libp ng-1.6.28' /bin/sh ./libtool --tag=CC --mode=link powerpc-eabi-gcc -g -O2 -L/c/devkitP ro/portlibs/ppc/lib -o pngcp contrib/tools/pngcp.o libpng16.la -lz -lm libtool: link: powerpc-eabi-gcc -g -O2 -o pngcp contrib/tools/pngcp.o -L/c/devk itPro/portlibs/ppc/lib ./.libs/libpng16.a -lz -lm c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-eabi/6.3.0/../../../../powerpc-eab i/bin/ld.exe: warning: cannot find entry symbol _start; defaulting to 018000b8 contrib/tools/pngcp.o: In function
isdir': c:\Users\Nebiun\Downloads\WIIdev\portlibs_2017\libpng-1.6.28/contrib/tools/pngcp .c:1610: undefined reference toaccess' contrib/tools/pngcp.o: In function
cp_one_file': c:\Users\Nebiun\Downloads\WIIdev\portlibs_2017\libpng-1.6.28/contrib/tools/pngcp .c:2176: undefined reference toaccess' c:\Users\Nebiun\Downloads\WIIdev\portlibs_2017\libpng-1.6.28/contrib/tools/pngcp .c:2207: undefined reference to
access' collect2.exe: error: ld returned 1 exit status make[1]: [pngcp] Error 1 make[1]: Leaving directory `/c/Users/Nebiun/Downloads/WIIdev/portlibs_2017/libpn g-1.6.28' make: [all] Error 2