Permalink
Browse files

this version should compile for iPhone. It compiles with thread suppo…

…rt but there are crashes. run make-iphone
  • Loading branch information...
1 parent 83bdb57 commit 1c4936f5390419cb970bed78530ca2ba9d48e8ce Raymond Daly committed Mar 27, 2009
Showing with 225 additions and 19 deletions.
  1. +33 −0 configure-iphoneos
  2. +24 −0 configure-sameopts
  3. +4 −1 cross_config_iPhoneOS
  4. +72 −0 make-iphone
  5. +8 −8 src/Makefile.in
  6. +18 −0 src/aclocal.m4
  7. +1 −1 src/c/Makefile.in
  8. +10 −0 src/c/threads.d
  9. +26 −5 src/configure
  10. +19 −1 src/gc/darwin_stop_world.c
  11. +2 −1 src/gc/include/private/gcconfig.h
  12. +8 −2 src/gc/os_dep.c
View
@@ -0,0 +1,33 @@
+#!/bin/sh
+DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
+sh ./configure \
+ --prefix=/Users/red/Projects/ecl/ecl-git/install_iPhoneOS/ \
+ --host=arm-apple-darwin \
+ --target=arm-apple \
+ --without-profile \
+ --without-cmp \
+ --with-asdf \
+ --without-defsystem \
+ --enable-debug \
+ --without-serve-event \
+ --with-tcp \
+ --without-rt \
+ --disable-threads \
+ --without-gmp \
+ dynamic_ffi=no
+ CC="$DEVROOT/usr/bin/gcc-4.0 -arch armv6" \
+ AR=$DEVROOT/usr/bin/ar \
+ RANLIB=$DEVROOT/usr/bin/ranlib \
+ NM=$DEVROOT/usr/bin/nm \
+ CFLAGS="-arch armv6 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=2.0 -gdwarf-2 -mthumb -miphoneos-version-min=2.0 -I/Library/iPhone/include -isysroot $DEVROOT/SDKs/iPhoneOS2.0.sdk" \
+ LDFLAGS="-arch armv6 -pipe -std=c99 -gdwarf-2 -mthumb -I/Library/iPhone/include -isysroot $DEVROOT/SDKs/iPhoneOS2.0.sdk" \
+ CPP=$DEVROOT/usr/bin/cpp \
+ ac_cv_path_NM=$DEVROOT/usr/bin/nm \
+ ac_cv_func_setpgrp_void=yes \
+ LIBPOSTFIX=_iPhoneOS
+
+
+# CPPFLAGS="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk"
+# --disable-shared \
+
+#
View
@@ -0,0 +1,24 @@
+#!/bin/sh
+DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer
+./configure \
+ --prefix=/Users/red/Projects/ecl/ecl-git/install_iPhoneSimulator/ \
+ --without-profile \
+ --without-cmp \
+ --without-asdf \
+ --without-defsystem \
+ --enable-debug \
+ --disable-shared \
+ --without-serve-event \
+ --with-tcp \
+ --without-rt \
+ --enable-threads \
+ --without-gmp \
+ dynamic_ffi=no \
+ CC="$DEVROOT/usr/bin/gcc" \
+ AR=$DEVROOT/usr/bin/ar \
+ RANLIB=$DEVROOT/usr/bin/ranlib \
+ NM=$DEVROOT/usr/bin/nm \
+ CPP=$DEVROOT/usr/bin/cpp \
+ ac_cv_path_NM=$DEVROOT/usr/bin/nm
+
+# --with-system-gmp \
View
@@ -32,11 +32,14 @@ ECL_NEWLINE=LF
### 3 = (f)->_cnt
ECL_FILE_CNT=0
+### 1.6) How many bits constitute a long long?
+ECL_LONG_LONG_BITS=64
+
### 2) To cross-compile ECL so that it runs on the system
### arm-apple-darwin
### you need to first compile ECL on the system in which you are building
### the cross-compiled files, that is
### i686-apple-darwin9.6.0
### By default we assume that ECL can be accessed from some directory in
### the path.
-ECL_TO_RUN=/Users/red/Projects/ecl/ecl-git/install_iPhoneSimulator/bin/ecl
+#ECL_TO_RUN=/Users/red/Projects/ecl/ecl-git/install_iPhoneSimulator/bin/ecl
View
@@ -0,0 +1,72 @@
+#!/bin/sh
+make distclean
+echo "=================================================="
+echo "Making the build-platform ECL to be used for cross compilation:"
+echo "=================================================="
+THIS_DIR=`pwd`
+DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer
+./configure \
+ --prefix=$THIS_DIR/install_iPhoneSimulator/ \
+ --without-profile \
+ --without-cmp \
+ --without-asdf \
+ --without-defsystem \
+ --enable-debug \
+ --disable-shared \
+ --without-serve-event \
+ --with-tcp \
+ --without-rt \
+ --enable-threads \
+ --without-gmp \
+ dynamic_ffi=no \
+ CC="$DEVROOT/usr/bin/gcc" \
+ AR=$DEVROOT/usr/bin/ar \
+ RANLIB=$DEVROOT/usr/bin/ranlib \
+ NM=$DEVROOT/usr/bin/nm \
+ CPP=$DEVROOT/usr/bin/cpp \
+ ac_cv_path_NM=$DEVROOT/usr/bin/nm
+
+make
+make install
+chmod -R 775 ./install_iPhoneSimulator/lib/
+
+echo "=================================================="
+echo "Making the host-platform ECL to be used on the iPhone:"
+echo "=================================================="
+mkdir build
+cp cross_config_iPhoneOS build/cross_config
+echo "ECL_TO_RUN=`pwd`/install_iPhoneSimulator/bin/ecl"
+
+DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
+sh ./configure \
+ --prefix=/Users/red/Projects/ecl/ecl-git/install_iPhoneOS/ \
+ --host=arm-apple-darwin \
+ --target=arm-apple \
+ --without-profile \
+ --without-cmp \
+ --with-asdf \
+ --without-defsystem \
+ --enable-debug \
+ --without-serve-event \
+ --with-tcp \
+ --without-rt \
+ --disable-threads \
+ --without-gmp \
+ dynamic_ffi=no
+ CC="$DEVROOT/usr/bin/gcc-4.0 -arch armv6" \
+ AR=$DEVROOT/usr/bin/ar \
+ RANLIB=$DEVROOT/usr/bin/ranlib \
+ NM=$DEVROOT/usr/bin/nm \
+ CFLAGS="-arch armv6 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=2.0 -gdwarf-2 -mthumb -miphoneos-version-min=2.0 -I/Library/iPhone/include -isysroot $DEVROOT/SDKs/iPhoneOS2.0.sdk" \
+ LDFLAGS="-arch armv6 -pipe -std=c99 -gdwarf-2 -mthumb -I/Library/iPhone/include -isysroot $DEVROOT/SDKs/iPhoneOS2.0.sdk" \
+ CPP=$DEVROOT/usr/bin/cpp \
+ ac_cv_path_NM=$DEVROOT/usr/bin/nm \
+ ac_cv_func_setpgrp_void=yes \
+ LIBPOSTFIX=_iPhoneOS
+
+make
+make install
+
+echo "=================================================="
+echo "Finished compiling! Inspect the output for errors"
+echo "=================================================="
View
@@ -71,11 +71,11 @@ bin/ecl$(EXE): ecl_min$(EXE) compile.lsp sysfun.lsp ecl/external.h BUILD-STAMP
ECLDIR=`pwd`/ ./ecl_min compile; \
fi
-ecl_min$(EXE): $(LIBRARIES) .gdbinit @LIBPREFIX@eclmin.@LIBEXT@
+ecl_min$(EXE): $(LIBRARIES) .gdbinit @LIBPREFIX@eclmin@LIBPOSTFIX@.@LIBEXT@
if [ -f CROSS-COMPILER ]; then \
touch $@; \
else \
- $(CC) $(LDFLAGS) -o $@ cinit.o c/all_symbols.o -L./ @LIBPREFIX@eclmin.@LIBEXT@ $(CORE_LIBS) $(LIBS) $(FASL_LIBS);\
+ $(CC) $(LDFLAGS) -o $@ cinit.o c/all_symbols.o -L./ @LIBPREFIX@eclmin@LIBPOSTFIX@.@LIBEXT@ $(CORE_LIBS) $(LIBS) $(FASL_LIBS);\
fi
.gdbinit: $(srcdir)/util/gdbinit
@@ -95,22 +95,22 @@ bin/ecl-config: bin/ecl-config.pre
-e 's,@includedir\\@,$(includedir),' bin/ecl-config.pre > bin/ecl-config
-@LIBPREFIX@eclmin.@LIBEXT@: @LIBPREFIX@eclgmp.@LIBEXT@ @LIBPREFIX@eclgc.@LIBEXT@ lsp/config.lsp cmp/cmpdefs.lsp ecl/external.h
+@LIBPREFIX@eclmin@LIBPOSTFIX@.@LIBEXT@: @LIBPREFIX@eclgmp@LIBPOSTFIX@.@LIBEXT@ @LIBPREFIX@eclgc@LIBPOSTFIX@.@LIBEXT@ lsp/config.lsp cmp/cmpdefs.lsp ecl/external.h
cd c; $(MAKE)
-@LIBPREFIX@eclgc.@LIBEXT@:
+@LIBPREFIX@eclgc@LIBPOSTFIX@.@LIBEXT@:
test -d ecl/gc || mkdir ecl/gc
test -d ecl/gc/private || mkdir ecl/gc/private
if (echo $(SUBDIRS) | grep gc); then \
cd gc && $(MAKE) install && cd .. && \
cp -rf $(srcdir)/gc/include/gc_{mark,inline,tiny_fl}.h ecl/gc/ && \
cp -rf $(srcdir)/gc/include/private/*.h ecl/gc/private/ && \
- mv @LIBPREFIX@gc.@LIBEXT@ @LIBPREFIX@eclgc.@LIBEXT@; \
+ mv @LIBPREFIX@gc.@LIBEXT@ @LIBPREFIX@eclgc@LIBPOSTFIX@.@LIBEXT@; \
fi
-@LIBPREFIX@eclgmp.@LIBEXT@:
+@LIBPREFIX@eclgmp@LIBPOSTFIX@.@LIBEXT@:
if (echo $(SUBDIRS) | grep gmp); then \
cd gmp && $(MAKE) install && \
cd .. && mv include/gmp.h ecl/ && rmdir include && \
- mv ./@LIBPREFIX@gmp.@LIBEXT@ ./@LIBPREFIX@eclgmp.@LIBEXT@; \
+ mv ./@LIBPREFIX@gmp.@LIBEXT@ ./@LIBPREFIX@eclgmp@LIBPOSTFIX@.@LIBEXT@; \
fi
sysfun.lsp:
$(LN_S) $(srcdir)/cmp/sysfun.lsp ./
@@ -156,7 +156,7 @@ install-base:
$(INSTALL_PROGRAM) $$i $(DESTDIR)$(libdir); \
fi \
done
- if [ "x@SONAME@" != "x" ]; then \
+ if [ "x@SONAME@" != "x" ] && [ "@enabled_shared@" = "yes" ] ; then \
( cd $(DESTDIR)$(libdir) && rm -f @SONAME3@ @SONAME2@ @SONAME1@ && \
mv @SONAME@ @SONAME3@ && \
$(LN_S) @SONAME3@ @SONAME2@ && \
View
@@ -13,6 +13,8 @@ else
ac_cv_c_long_long=no)
fi
if test $ac_cv_c_long_long = yes; then
+
+if test -z "$ECL_LONG_LONG_BITS" ; then
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
int main() {
const char *int_type;
@@ -27,6 +29,8 @@ int main() {
exit(0);
}]])],[eval "`cat conftestval`"],[],[])
fi
+fi
+
if test -z "$ECL_LONG_LONG_BITS"; then
AC_MSG_RESULT(not available)
else
@@ -101,13 +105,21 @@ ECL_NEWLINE=LF
### 3 = (f)->_cnt
ECL_FILE_CNT=0
+### 1.6) How many bits constitute a long long?
+ECL_LONG_LONG_BITS=64
+
### 2) To cross-compile ECL so that it runs on the system
### ${host}
### you need to first compile ECL on the system in which you are building
### the cross-compiled files, that is
### ${build}
### By default we assume that ECL can be accessed from some directory in
### the path.
+###
+### Ensure that you cross-compile ECL with a version of ECL compiled with
+### the same options, otherwise you will run into inconsistencies between
+### symbol tables of the two versions
+
ECL_TO_RUN=`which ecl`
EOF
cat ${with_cross_config}
@@ -178,6 +190,7 @@ AC_SUBST(MACHINE_VERSION)dnl Version of the machine
AC_SUBST(LDRPATH)dnl Sometimes the path for finding DLLs must be hardcoded.
AC_SUBST(LIBPREFIX)dnl Name components of a statically linked library
+AC_SUBST(LIBPOSTFIX)dnl e.g. libecl_POSTFIX.a
AC_SUBST(LIBEXT)
AC_SUBST(SHAREDEXT)dnl Name components of a dynamically linked library
AC_SUBST(SHAREDPREFIX)
@@ -189,6 +202,7 @@ LDRPATH='~*'
SHAREDEXT='so'
SHAREDPREFIX='lib'
LIBPREFIX='lib'
+LIBPOSTFIX=''
LIBEXT='a'
PICFLAG='-fPIC'
THREAD_CFLAGS=''
@@ -670,6 +684,8 @@ dnl functions?
dnl
AC_DEFUN([ECL_FFI],[
AC_MSG_CHECKING([whether we can dynamically build calls to C functions])
+if test -z "${dynamic_ffi}" ; then
+
case "${host_cpu}" in
i686 | i586 | pentium* | athlon* )
EXTRA_OBJS="${EXTRA_OBJS} ffi_x86.o"
@@ -692,6 +708,8 @@ case "${host_cpu}" in
dynamic_ffi=no
;;
esac
+fi
+
AC_MSG_RESULT([${dynamic_ffi}])
if test "$dynamic_ffi" = "yes" ; then
AC_DEFINE(ECL_DYNAMIC_FFI, 1, [we can build calls to foreign functions])
View
@@ -74,7 +74,7 @@ ffi_x86_64.c: arch/ffi_x86_64.d $(DPP) $(HFILES)
$(RANLIB) $@
clean:
- $(RM) $(DPP) *.c *.h $(OBJS) all_symbols.o all_symbols2.o ../libecl.a cinit.o core a.out
+ $(RM) $(DPP) *.c *.h $(OBJS) all_symbols.o all_symbols2.o ../@LIBPREFIX@ecl@LIBPOSTFIX@.a cinit.o core a.out
# Build rules
View
@@ -67,6 +67,7 @@ ecl_process_env(void)
struct cl_env_struct *rv = pthread_getspecific(cl_env_key);
if (rv)
return rv;
+ printf("Getting pthread key %i returned %i\n", (int)cl_env_key, (int)rv);
FElibc_error("pthread_getspecific() failed.", 0);
return NULL;
#endif
@@ -82,8 +83,17 @@ ecl_set_process_env(cl_env_ptr env)
# ifdef ECL_WINDOWS_THREADS
TlsSetValue(cl_env_key, env);
# else
+ printf("Setting pthread key %i to %i\n", (int)cl_env_key, (int)env);
if (pthread_setspecific(cl_env_key, env))
FElibc_error("pthread_setcspecific() failed.", 0);
+
+ struct cl_env_struct *rv = pthread_getspecific(cl_env_key);
+ if (rv != env || 1)
+ {
+ printf("Getting pthread key %i returned %i immediately afterwards. should match.\n", (int)cl_env_key, (int)rv);
+ }
+
+
# endif
#endif
}
Oops, something went wrong.

0 comments on commit 1c4936f

Please sign in to comment.