Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-15-2008, 05:56 PM   #1
LQ Newbie
Registered: Jun 2007
Posts: 1

Rep: Reputation: 0
Can't Compile GMP with gcc mac 10.4.11

Ok I realize this is a Linux forum, but can I at least be pointed to a more relevant forum.

My problem is when I try to compile a program with GMP gcc doesn't compile but gives the error:

/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
collect2: ld returned 1 exit status

I'm compiling from terminal using the command

gcc clarkkkkson.c -o clarkkkkson

and I have tried the options

-lgmp -L/usr/local/include
-lgmp -L/usr/local/lib
-lgmp -L/usr/local/lib/
-lgmp -L/usr/local/lib/libgmp.dylib
-lgmp -L/usr/local/lib/libgmp.a
-lgmp -L/usr/local/lib/

to no avail. The source code is

double fact(unsigned int number, unsigned int class_) {
	mpz_t return_;
	unsigned int i;
	if(class_-1) for(i=1;i<=number;i++) mpz_mul_ui(return_,return_,fact(i, class_-1));
	else for(i=1;i<=number;i++) mpz_mul_ui(return_,return_,i);
	return mpz_get_d(return_);
I have compiled GMP myself and did run make check after make and make install. And I did try recompiling.
Old 04-16-2008, 03:06 AM   #2
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,548

Rep: Reputation: 136Reputation: 136
i dont think the .dylib resides in /usr/local/lib
rather in /System/Library or /Library
but i dont have a Mac within reach right now...
so im just guessing


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding path of GMP and MPFR for gcc upgrade drosselmeyer Linux - Newbie 2 08-03-2011 07:15 AM
Glade + Gmp ! _ AsiF Linux - Software 1 03-17-2008 08:11 AM
Initial gcc installation-How to compile gcc itself pgb205 Linux - Software 4 02-26-2008 10:24 PM
can't install gcc on Mac OSX 10.3 titanium_geek Other *NIX 3 05-11-2005 05:39 PM
trying to use gmp BadTaste Programming 1 08-04-2004 09:10 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:14 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration