CLN + GiNaC on Apple OSX

Richard B. Kreckel kreckel at thep.physik.uni-mainz.de
Sat Nov 1 15:10:09 CET 2003


Hi!

On Fri, 31 Oct 2003, Jonathan Brandmeyer wrote:
> In addition to building on Windows/MinGW, I am also trying to get this
> going on Mac OSX.  I have had problems with Apple's early releases of
> GCC, so I am using a local build of GCC-3.3.1.  I believe that the
> binary utilities are mostly GNU with Apple's linker. (as reports 1.38 as
> its version).
>
> I am building CLN against GMP 4.1.2.  ( I said 4.2.1 earlier, but I
> really installed 4.1.2).  CLN was configured with CC=gcc-3.3 CXX=g++-3.3
> CXXFLAGS="-O2 -finline-functions" CFFLAGS="-Dunix -D__unix" (-D__unix
> was needed for a random number constructor) ./configure --with-gmp
>
> The build fails with cascading syntax errors in modinteger/cl_MI.cc and
> several other files.

Again, I am without access to this platform.  But there were some patches
by Mac users.  Here is how the current tree diffs against CLN-1.1.5, at
least the sections relevant to you:

--- cln-1.1.5/src/modinteger/cl_MI.cc	2000-08-29 00:08:21.000000000 +0200
+++ cln/src/modinteger/cl_MI.cc	2003-06-29 13:58:15.000000000 +0200
@@ -21,6 +21,10 @@
 #include "cln/abort.h"
 #include "cl_alloca.h"

+// MacOS X does "#define _R 0x00040000L"
+// Grr...
+#undef _R
+
 namespace cln {

 cl_heap_modint_ring::cl_heap_modint_ring (cl_I m, cl_modint_setops* setopv, cl_modint_addops* addopv, cl_modint_mulops* mulopv)
--- cln-1.1.5/src/numtheory/cl_nt_sqrtmodp.cc	2001-12-14 19:49:19.000000000 +0100
+++ cln/src/numtheory/cl_nt_sqrtmodp.cc	2003-08-06 21:45:26.000000000 +0200
@@ -16,6 +16,9 @@
 #include <cmath>
 #define floor cln_floor

+// MacOS X does "#define _R 0x00040000L".  Grr...
+#undef _R
+
 namespace cln {

 // Algorithm 1 (for very small p only):
--- cln-1.1.5/src/base/random/cl_random_from.cc	2001-03-26 20:03:27.000000000 +0200
+++ cln/src/base/random/cl_random_from.cc	2003-04-03 17:04:03.000000000 +0200
@@ -12,7 +12,7 @@
 #include "cl_base_config.h"
 #include "cl_low.h"

-#if defined(unix) || defined(__unix) || defined(_AIX) || defined(sinix) || (defined(_WIN32) && defined(__GNUC__)) || defined(__BEOS__)
+#if defined(unix) || defined(__unix) || defined(_AIX) || defined(sinix) || (defined(__MACH__) && defined(__APPLE__)) || (defined(_WIN32) && defined(__GNUC__)) || defined(__BEOS__)

 #include <sys/types.h>
 #include <unistd.h> // declares getpid()
@@ -80,7 +80,7 @@
 {
 	var uint32 seed_hi;
 	var uint32 seed_lo;
-#if defined(unix) || defined(__unix) || defined(_AIX) || defined(sinix) || (defined(_WIN32) && defined(__GNUC__)) || defined(__BEOS__)
+#if defined(unix) || defined(__unix) || defined(_AIX) || defined(sinix) || (defined(__MACH__) && defined(__APPLE__)) || (defined(_WIN32) && defined(__GNUC__)) || defined(__BEOS__)
 	seed_lo = ::get_seed();
 	seed_hi = (rand() // zufällige 31 Bit (bei UNIX_BSD) bzw. 16 Bit (bei UNIX_SYSV)
                           << 8) ^ (uintL)(getpid()); // ca. 8 Bit von der Process ID


I hope I haven't forgotten anything.  Could you please tell us how it
goes?

Also, please note that you have -finline-functions turned on which might
cause trouble later.  If you have some spare time, could you please find
out if that option does produce link failures on Mac OSX, too?

Regards
    -richy.
-- 
Richard B. Kreckel
<Richard.Kreckel at GiNaC.DE>
<http://www.ginac.de/~kreckel/>




More information about the GiNaC-list mailing list