While taking a university course on concepts of programming languages, we had to do a report on a language that we had never used before and evaluate it based on the things we had learned that year. We were supposed to answer questions like "Does the language have first-class functions?" and other such questions. I did my report on Pike. It was a fun language to learn about. It had been a few years since I took that class, and I decided to check on Pike and see what had changed in the years since I last used it. Unfortunately, there was no binary of the most current version for OS X, and I ran into some problems compiling one of the pre-requisite libraries, Nettle. Read on for how I solved this.
Compiling most Unix programs under OS X has not been a problem for me, but I have occasionaly found it to be difficult. The problem with Nettle was it didn't know how to build a "shared library" for OS X. It was trying to pass the " -shared" option to gcc, which is not supported under OS X. The proper flag to use is "-dynamiclib" and it takes care of all the little libtool details for you. So, I decided to fix Nettle and post this little article telling others how to do the same.
The patch is as follows:
--- nettle-1.14/configure.ac Mon Dec 5 12:47:13 2005 +++ nettle-1.14-new/configure.ac Fri Jun 9 15:22:08 2006 @@ -157,6 +157,13 @@ SHLIBLINK='$(CC) $(LDFLAGS) -shared -Wl,--out-implib=$(SHLIBFILE) -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive' SHLIBLIBS='-Wl,--no-whole-archive $(LIBS)' ;; + darwin*) + SHLIBFORLINK=libnettle.dylib + SHLIBSONAME='$(SHLIBFORLINK).$(SHLIBMAJOR)' + SHLIBFILE='$(SHLIBSONAME).$(SHLIBMINOR)' + SHLIBLINK='$(CC) -dynamiclib $(LDFLAGS)' + SHLIBLIBS=' -lgmp' + ;; *) SHLIBFORLINK=libnettle.so SHLIBSONAME='$(SHLIBFORLINK).$(SHLIBMAJOR)'
This is to be applied against Nettle 1.14. You will want to download nettle and then do:
You will then want to copy and paste the patch into a file in the nettle directory. If you name the file 'nettlepatch.patch" the command to execute is:
tar xvfz nettle-1.14.tar.gz
cd nettle-1.14
patch -p1 Once you have done that, do:./.bootstrap ./configure --enable-shared make sudo make install make checkFor some reason, running the tests before installing the library doesn't seem to work. Go figure.After that, compiling Pike was a snap. Now if I can only get some of the GUI libraries building...