DarwinPorts Installation MacOS X

Daniel J Farrell daniel.farrell at imperial.ac.uk
Mon Jan 9 14:42:17 CET 2006

  Blake and Dave,

Thanks for your help that solved it. The problem was setting up Xcode  
so that it knows where to look and what linker flag to use. Dave  
nailed it with:

Header Search Path: "/opt/local/include/"
Library Search Path: "/opt/local/lib/"
Other Linker Flags: "-lgmp"

You can find all the above in Project --> Edit Project Setting.

I am fairly new to programming etc but it might be a good idea to  
include this Mac specific section of the documentation? On page 16 of  
the documentation it does describe that you need to link against - 
lgmp, but as a newbie I had no idea how to do that in Xcode.

Just out of interest Blake, when you add say, to your path variable  
by editing your .profile or .bashrc etc that only effects command  
line and X11 app. If you want to make something available to GUI app  
in mac os you will need to follow the advice here, http:// 
developer.apple.com/qa/qa2001/qa1067.html . Thats all the business  
about editting the environment.plist etc.

Thanks again for your help!


On 9 Jan 2006, at 02:37, Blake Huff wrote:

> Daniel:
> There are several things that you have to change (I assumed you  
> caught the others, but missed the ZeroLink.)    You need ZeroLink  
> off,  "Other linker flags"  set to "-lgmp",   "Header Search Path"  
> set to "/usr/local/include/", and  "Library Search Path" to "/usr/ 
> local/lib/".    This should resolve your problems.  (At least,  
> that's how I get by with XCode."
> Blake
> Hi Daniel,
> 	To be honest, never in my 3 years developing on OS X have I opened
> up Xcode (or any IDE, for that matter *GASP*) -- I use GNU-build tools
> exclusively, so I'm not qualified to answer anything about Xcode  
> itself,
> or any of the Apple-specific features such as the plists.
> 	You can however, add a line to your ~/.{cshrc,zshrc,bashrc,...}
> to set the environment variable on startup of each new shell, via  
> setenv
> or export.  I'm sure the way to set in Xcode is simple if you just  
> post a
> question to xcode-users at lists.apple.com, someone will have the answer.
> (It is likely already in the archives
> 	Hope this helps somewhat.

> On Jan 8, 2006, at 5:41 PM, Daniel J Farrell wrote:
>> Hello everybody,
>> Thanks for your help! I've replying to all the posts in this one e- 
>> mail to keep traffic down for the people who aren't interested.
>> David:
>> No I added the path to gmp.h in the Xcode Menu Project --> Edit  
>> Project then added it to the 'Header Search Path' string. Is the  
>> LD_LIBRARY_PATH referenced in the ~/.profile or ~/.MacOSX/ 
>> environment.plist ? Or is it an Xcode option?
>> Blake:
>> I made the changes you suggested. I think the error might be  
>> connected with David's suggestion of giving the LD_LIBRARY_PATH an  
>> value because I got a 'Undefined symbol' error related to the  
>> following:
>> ___gmp_printf
>> ___gmpz_add_ui
>> ___gmpz_init
>> ___gmpz_init_set_str
>> ___gmpz_mul_ui
>> All of which I'm using in the test programme.
>> Daniel
>> On 8 Jan 2006, at 21:42, David Fang wrote:
>>>> Does anybody have any advice on how to get gmp up and running on  
>>>> MacOS
>>>> 10.4. I have installed gmp with darwinports and everything  
>>>> seemed to
>>>> go smoothly. I then wrote a quick test program (given in the  
>>>> excellent
>>>> documentation) and for some reason I get an error at run time  
>>>> saying
>>>> something like 'ZeroLink: unknown symbol'. I included the path to
>>>> gmp.h (/opt/local/include/gmp.h) in the header path project  
>>>> options.
>>>> Do I have to link to that or one of the dylib?
>>>> Are there any Mac users that can help me here?
>>> Hi,
>>> 	Did you try adding '/opt/local/lib' to your LD_LIBRARY_PATH
>>> environment variable?  That should help it find the dylib at run- 
>>> time.
>>> David Fang
> Blake Huff
> stangmechanic at gmail.com

More information about the gmp-discuss mailing list