Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined reference to `access' devkitPPC r29-1 #4

Closed
nebiun opened this issue Mar 23, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@nebiun
Copy link

commented Mar 23, 2017

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 to access' 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 to access' 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

@nebiun

This comment has been minimized.

Copy link
Author

commented Mar 25, 2017

Same problem with devkitPPC r28

@nebiun nebiun closed this Mar 25, 2017

@nebiun

This comment has been minimized.

Copy link
Author

commented Mar 25, 2017

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

@nebiun nebiun reopened this Mar 25, 2017

@nebiun

This comment has been minimized.

Copy link
Author

commented Mar 25, 2017

I think it is a issue...

@nebiun

This comment has been minimized.

Copy link
Author

commented Mar 26, 2017

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;

}

@WinterMute WinterMute changed the title undefined reference to `access' devkitpro r29-1 undefined reference to `access' devkitPPC r29-1 Apr 3, 2017

@WinterMute

This comment has been minimized.

Copy link

commented Apr 3, 2017

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

@WinterMute WinterMute closed this Apr 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.