Bill Allombert on Mon, 12 Sep 2005 20:12:58 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: os X problems


On Mon, Sep 12, 2005 at 07:31:45PM +0200, Karim Belabas wrote:
> * Bill Allombert [2005-08-26 14:19]:
> > On Thu, Aug 25, 2005 at 08:29:22PM -0700, Justin C. Walker wrote:
> > > 
> > > On Aug 25, 2005, at 19:56 , Joshua Friedman wrote:
> > > 
> > > >In the examples directory, library build seems to fail:
> > > >
> > > >Friedman <pari-2.2.10.alpha> cd examples/
> > > >Friedman <examples> make all
> > > [snip]
> > > >o libextgcd.dylib -shared -O3 -DGCC_INLINE -Wall -fno-strict-aliasing
> > > >-fomit-frame-pointer -O3 -DGCC_INLINE -Wall -fno-strict-aliasing
> > > >-fomit-frame-pointer  -no-cpp-precomp
> > > >-Wl,-dylib,-flat_namespace,-undefined,suppress extgcd.o
> > > >make: o: Command not found
> > > 
> > > I think this is because DLLD is undefined in examples/Makefile (I get  
> > > the same failure).  I'm not sure what DLLD is supposed to be.
> > 
> > DLLD is undefined on Mac OS X because we do not yet know how to build
> > dynamic libraries on OS X yet. 
> > 
> > "make all" try to build all targets, i.e extgcd-sta, extgcd-dyn and 
> > libextgcd.dylib. 
> > 
> > extgcd-sta should work fine.
> > 
> > extgcd-dyn cannot be built (we would need libpari as a dynamic library).
> > 
> > libextgcd.dylib should be buildable, but the makefile is not quite right
> > (it try to build a shared library instead of a sared object and this is
> > not the same on Darwin).
> > 
> > Try the attached patch (do not forget to rerun Configure).
> > That might also fix the same problem on cygwin.
> 
> I applied the patch to CVS.

While we are at it, please review te attached patch that clean up
the building of bundles considerably.

(note this patch is not tested for technical reason,sorry...).

Cheers,
Bill

Index: Configure
===================================================================
RCS file: /home/cvs/pari/Configure,v
retrieving revision 1.140
diff -u -r1.140 Configure
--- Configure	12 Sep 2005 17:31:39 -0000	1.140
+++ Configure	12 Sep 2005 18:03:44 -0000
@@ -133,34 +133,35 @@
     *) shell_q="'"; echo "shell_q=\"'\"" >> $dflt_conf_file;;
 esac
 
-mydlldflags=`echo "$DLLDFLAGS" | \
-   sed -e 's/,*-[^ \t-]*[ \t,=]*\\$(LIBPARI_SONAME)//' \
-       -e 's!\$(CFLAGS)'"!$CFLAGS!" \
-       -e 's/--out-implib=\$(LIBPARI_SO)\$(_A),\?//'`
-
 __LIBS=$LIBS
 if test "$static" = n; then LIBS="$LIBS $LDDYN"; fi
 case $osname in
-cygwin) modulesextraflags="-L$libdir -lpari.dll";;
-*)      modulesextraflags=`eval echo $EXTRADLLDFLAGS`;;
+cygwin) EXTRAMODLDFLAGS="-L$libdir -lpari.dll";;
+*)      EXTRAMODLDFLAGS=`eval echo $EXTRADLLDFLAGS`;;
 esac;
 LIBS=$__LIBS
 
-myincludedir=`echo "$includedir" | sed -e 's/\/pari\/*$//'`
 case $osname in
-darwin) DLLD_modules=$CC; 
-        modulesflags="-bundle -flat_namespace -undefined suppress -fno-common -O3 -DGCC_INLINE -Wall -fomit-frame-pointer -no-cpp-precomp";;
-*)      DLLD_modules="$DLLD"; modulesflags="$mydlldflags";;
+darwin) MODLD=$CC;
+        MODLDFLAGS="-bundle -flat_namespace -undefined suppress \
+\$(CFLAGS) \$(DLCFLAGS)";;
+*)      MODLD="$DLLD";
+        MODLDFLAGS=`echo "$DLLDFLAGS" | \
+   sed -e 's/,*-[^ \t-]*[ \t,=]*\\$(LIBPARI_SONAME)//' \
+       -e 's/--out-implib=\$(LIBPARI_SO)\$(_A),\?//'`;;
 esac;
-modules_build="$CC -c -o %s.o $CFLAGS $DLCFLAGS -I$myincludedir %s.c &&
-$DLLD_modules -o %s.so $modulesflags %s.o $modulesextraflags"
+
+modules_build=`echo "$CC -c -o %s.o $CFLAGS $DLCFLAGS -I$includedir %s.c \
+&& $MODLD -o %s.so $MODLDFLAGS %s.o $EXTRAMODLDFLAGS" | \
+               sed -e 's!\$(CFLAGS)'"!$CFLAGS!g" \
+                   -e 's!\$(DLCFLAGS)'"!$DLCFLAGS!g"`
 
 for variable in\
   pari_release pari_release_verbose version libpari_base static TOP objdir\
   arch asmarch osname pretty\
   kernlvl0 kernlvl1\
   gnuas AS ASFLAGS KERNELCPPFLAGS LIBS\
-  modules_build DLLD_modules modulesflags modulesextraflags\
+  modules_build MODLD MODLDFLAGS EXTRAMODLDFLAGS\
   dir_sep runpath runpathprefix LDDYN\
   ranlib gzip zcat emacs perl ln_s make_sh\
   sizeof_long doubleformat\
Index: config/GEN_Make.SH
===================================================================
RCS file: /home/cvs/pari/config/GEN_Make.SH,v
retrieving revision 1.17
diff -u -r1.17 GEN_Make.SH
--- config/GEN_Make.SH	12 Sep 2005 17:44:29 -0000	1.17
+++ config/GEN_Make.SH	12 Sep 2005 18:03:44 -0000
@@ -17,9 +17,6 @@
   RUNPTH=`config/ldflags "$LDneedsWl" "$runpathprefix $runpath"`
 fi
 
-# remove soname imformation
-MYDLLDFLAGS=`echo $DLLDFLAGS | sed -e 's/,*-[hsoname]*[,= \t]*\\$(LIBPARI.*)//'`
-
 cat > $file << EOT
 # Generic Makefile for PARI programs -- $pretty
 #
@@ -59,9 +56,9 @@
 CPPFLAGS   = -I. -I$includedir
 LD         = $LD
 LDFLAGS    = $LDFLAGS
-DLLD       = $DLLD_modules
-DLLDFLAGS  = $modulesflags
-EXTRADLLDFLAGS = $modulesextraflags
+MODLD       = $MODLD
+MODLDFLAGS  = $MODLDFLAGS
+EXTRAMODLDFLAGS = $EXTRAMODLDFLAGS
 EXTRALIBS  =
 
 RUNPTH     = $RUNPTH
@@ -86,7 +83,7 @@
 dynlib: \$(DYN)
 
 \$(DYN): \$(OBJS)
-	\$(DLLD) -o \$@ \$(DLLDFLAGS) \$(OBJS) \$(EXTRADLLDFLAGS)
+	\$(MODLD) -o \$@ \$(MODLDFLAGS) \$(OBJS) \$(EXTRAMODLDFLAGS)
 
 \$(TARGET)-sta: \$(OBJS)
 	\$(LD) -o \$@ \$(LDFLAGS) \$< \$(EXTRALIBS) \$(STATIC) \$(LIBS)
Index: config/get_dlld
===================================================================
RCS file: /home/cvs/pari/config/get_dlld,v
retrieving revision 1.31
diff -u -r1.31 get_dlld
--- config/get_dlld	1 Oct 2004 07:52:44 -0000	1.31
+++ config/get_dlld	12 Sep 2005 18:03:44 -0000
@@ -91,7 +91,7 @@
       sparc*) extra='-mimpure-text';;
       *) extra=;;
     esac
-    DLLDFLAGS="-shared $extra \$(CFLAGS) $DLLDFLAGS"
+    DLLDFLAGS="-shared $extra \$(CFLAGS) \$(DLCFLAGS) $DLLDFLAGS"
   fi
   case "$osname" in
     osf1|freebsd|linux|sunos|solaris) EXTRADLLDFLAGS='-lc ${LIBS}';;