[MPlayer-dev-eng] [PATCH] OS/X build problems

Steven M. Schultz sms at 2BSD.COM
Tue Oct 12 18:40:17 CEST 2004


Hi -

	Unconditionally adding "-fno-PIC" breaks building/linking on OS/X

	On PPC systems all code is PIC by default (no penalty since it's
	not a register starved arch like IA32) and while gcc/ld accept
	-fno-PIC it's not a good idea to use that unless there are special
	circumstances.

	What currently is happening is:

cc -I../libvo -I../../libvo -I/usr/X11R6/include -fno-PIC -O4 -mcpu=970 -mtune=970 -faltivec -pipe -ffast-math -fomit-frame-pointer -DSYS_DARWIN -DCONFIG_DARWIN -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -Ilibmpdemux -Iloader -Ilibvo -I/usr/X11R6/include -I/usr/X11R6/include/freetype2   -I/usr/local/include/SDL -D_THREAD_SAFE -I/usr/X11R6/include    -I/usr/local/include     -g codec-cfg.c mp_msg.c -o codec-cfg -DCODECS2HTML  -lintl
ld: /var/tmp//cc1vGokw.o has external relocation entries in non-writable section (__TEXT,__text) for symbols:
__CurrentRuneLocale
____runetype
_fgets
_memset
_strlen
_strncmp
_strtoul
_fgetc
_fputc
_fwrite
_strcmp
_fclose
_fseek
_printf
_ftell
_exit
_fopen
_puts
_putchar
_fprintf
_memcmp
_free
_strerror
___error
_strdup
_strcasecmp
_strcpy
_realloc
_atoi
_malloc
gmake: *** [codec-cfg] Error 1

	If that's ignored then linking MPlayer at the end gives:

cc -I../libvo -I../../libvo -I/usr/X11R6/include -fno-PIC 

ld: Undefined symbols:
.constructors_used
gmake: *** [mplayer] Error 1

	Attached for your consideration is a patch to ./configure which
	only adds '-fno-PIC' if "! darwin". 

	Cheers,
	Steven Schultz
-------------- next part --------------
--- configure.dist	Tue Oct 12 09:31:44 2004
+++ configure	Tue Oct 12 09:32:29 2004
@@ -6168,15 +6168,17 @@
   fi
 fi
 
-echocheck "compiler support for -fno-PIC"
-cat > $TMPC <<EOF
+if ! darwin; then
+  echocheck "compiler support for -fno-PIC"
+  cat > $TMPC <<EOF
 int main(void) { return 0; }
 EOF
-if cc_check -fno-PIC ; then
-  CFLAGS="-fno-PIC $CFLAGS"
-  echores "yes"
-else
-  echores "no"
+  if cc_check -fno-PIC ; then
+    CFLAGS="-fno-PIC $CFLAGS"
+    echores "yes"
+  else
+    echores "no"
+  fi
 fi
 
 echocheck "ftello()"


More information about the MPlayer-dev-eng mailing list