Grant's BLog

Get Published



Links



Calendar



advanced search

Personalize



Polls



Site Stats


 Welcome to Grant's BLog Monday, September 06 2010 @ 10:48 PM UTC 
Downloads
Topics  
Home
Programming (1/0)
Mac OS X (3/0)
Politics & Government (3/0)
Sports (0/0)
General News (3/0)

User Functions  
Username:

Password:

Don't have an account yet? Sign up as a New User

Events  
There are no upcoming events


 Compiling Pike and/or Nettle on OS X   
 Friday, June 09 2006 @ 09:27 PM UTC
 Contributed by: grant
 Views: 563

Mac OS XWhile 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:
tar xvfz nettle-1.14.tar.gz
cd nettle-1.14
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:

patch -p1 
Once you have done that, do:
./.bootstrap
./configure --enable-shared
make
sudo make install
make check
For 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...

 



Compiling Pike and/or Nettle on OS X | 0 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.
No user comments.
What's Related  
  • More by grant
  • More from Mac OS X
  • Story Options  
  • Mail Story to a Friend
  • Printable Story Format

  •  Copyright © 2010 Grant's BLog
     All trademarks and copyrights on this page are owned by their respective owners.
    Powered By GeekLog 
    Created this page in 0.07 seconds