Sponsored Content
Full Discussion: Library linking with GMP
Top Forums Programming Library linking with GMP Post 302433101 by bluejayek on Monday 28th of June 2010 01:01:25 PM
Old 06-28-2010
Library linking with GMP

I am trying to set up the gnu multiple precision arithmetic library for some c++ programming I have to do.
I am using a system with mac osx 10.6.3 and do NOT have root user access.
I'm trying to use gmp 5.0.1.
Since I don't have root user access, I had to install to a different directory
Thus I used

Code:
./configure --prefix=~/gmp --enable-cxx
make
make install

I also ran make check and it did not report any errors.

I then went to run a test program
Compiled with no errors using
Code:
g++ gmptest.cxx -I/Users/****/gmp/lib/ -I/Users/****/gmp/include/ -L/Users/****/gmp/lib/ -lgmpxx -lgmp -o gmptest

and tried to run with
Code:
./gmptest

The error I get is

Code:
dyld: Library not loaded: /usr/local/lib/libgmpxx.4.dylib
  Referenced from: /Users/****/./gmptest
  Reason: image not found
Trace/BPT trap

The gmptest.cxx test program is the following
Code:
#include <gmp.h>
#include <gmpxx.h>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
void foo (mpz_t result, const mpz_t param, unsigned long n) 
{
unsigned long i;
mpz_mul_ui (result, param, n);
for (i = 1; i < n; i++)
	mpz_add_ui (result, result, i*7);
}

int 
main () 
{
mpz_t r, n;
 mpz_init (r);
 mpz_init_set_str (n, "123456", 0);
 foo (r, n, 20L);
 gmp_printf ("%Zd\n", r);
 return 0;
}

It's just some program I found that should print out a number.. Not important what it does at this point, I just want it to run.

I understand the error is saying that it cant find the libgmpxx.4.dylib file in /usr/local/lib which makes sense because it isn't there. But I thought the -L and -I settings I put in the compiler options tell it to look there for the libraries, and that library DOES exist there.

What am I doing wrong? Did I miss something?

Edit:
I also checked otool -L gmptest and it shows libgmpxx.4.dylib and libgmp.10.dylib linked from /usr/local/lib . They do NOT exist in this directory, they exist in /Users/****/gmp/lib where I thought I had told it to look.

Last edited by pludi; 06-29-2010 at 03:41 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. Programming

Linking problem while linking to shared library

Hi I'm getting ld: fatal: option -h and building a dynamic executable are incompatible ld: fatal: Flags processing errors When I run ld -shared -L/usr/dt/lib -lDtSvc -o builtin.so Workspace.o after running gcc -fPIC -I/usr/X11R6/include -I/usr/dt/include -c Workspace.c I'm... (6 Replies)
Discussion started by: laho
6 Replies

2. HP-UX

GMP multi precision math library

Hello all, I'm having trouble building the GNU Multi Precision (GMP 4.1.3) on the HP Intel Itanium 2 HP-UX 11i I'm hoping someone out there has had some experience building GMP on this platform. After running the ./configure and doing a make I get an error saying: `.rodata` is not a section ... (3 Replies)
Discussion started by: vyl
3 Replies

3. UNIX for Dummies Questions & Answers

Link error while linking a shared library in unix

Getting the following error , ld: /opt/syncsort39/lib/libsyncsort.sl: Mismatched ABI. 64-bit PA shared library found in 32-bit link. Is there any difference in the ld options in opt file while linking a 64 bit shared library ? Or is the problem because we are trying to link both 32 bit and 64... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

4. AIX

Help while linking the library in AIX

Hi, I have one library(libfoo.a) that is folder /home/xyz and my c program is in /home/xyz/cprog. Whenever I issue cc command cc -o test test.c -lfoo , i get the error /usr/bin/ld: cannot find -lfoo. echo $PATH has already listing of /home/xyz variable, even LIBPATH also has same entry... (0 Replies)
Discussion started by: rishisoft1
0 Replies

5. Shell Programming and Scripting

How to change a Makefile from building static library to shared library?

Hi: I have a library that it only offers Makefile for building static library. It built libxxx.a file. How do I in any way build a shared library? (either changin the Makefile or direct script or command to build shared library) Thanks. (1 Reply)
Discussion started by: cpthk
1 Replies

6. OS X (Apple)

Linking to a shared library

I'm trying to get Valgrind to work with an openmpi application in OS X. However I want to hardcode the path to a shared library called libmpiwrap-amd64-darwin.so into my application so that it is available at runtime. In Linux this is relatively simple, I would just add the option... (0 Replies)
Discussion started by: Valgrinder
0 Replies

7. Linux

./configure problem for libsf library due to apparently missing libdb library.

Hello, ./configure script fails to configure libsf. Please check the following last few lines of configure script error. checking for db1/db.h... no checking for db.h... yes checking for dbopen in -ldb1... no configure: error: No libdb? No libsf. But find command shows the following; ... (4 Replies)
Discussion started by: vectrum
4 Replies

8. AIX

Add shared members from library to same library in a different directory

I'm trying to install libiconv to AIX 7.1 from an rpm off of the perzl site. The rpm appears to install but I get this error message. add shr4.o shared members from /usr/lib/libiconv.a to /opt/freeware/lib/libiconv.a add shr.o shared members from /usr/lib/libiconv.a to ... (5 Replies)
Discussion started by: kneemoe
5 Replies

9. UNIX for Advanced & Expert Users

Installing recent version of gmp

I want to install a recent version of gmp on Fedora. Tried to use yum # yum list | grep gmp gmp.i686 4.3.1-6.fc13 @fedora gmp.x86_64 4.3.1-6.fc13 @fedora gmp-devel.x86_64 ... (3 Replies)
Discussion started by: kristinu
3 Replies

10. Programming

C++ linking library to a library

Hi All, My application main engine will use a shared library where we do many operation. We are trying to implement the linear algebra operation on the shared library for that I need to link my shared library to the lapack library in /usr/lib. Below is my make file. Can you please let me... (2 Replies)
Discussion started by: arunkumar_mca
2 Replies
IRSEND(1)							   User Commands							 IRSEND(1)

NAME
irsend - basic LIRC program to send infra-red commands SYNOPSIS
irsend [options] DIRECTIVE REMOTE CODE [CODE...] DESCRIPTION
Asks the lircd daemon to send one or more CIR (Consumer Infra-Red) commands. This is intended for remote control of electronic devices such as TV boxes, HiFi sets, etc. DIRECTIVE can be: SEND_ONCE - send CODE [CODE ...] once SEND_START - start repeating CODE SEND_STOP - stop repeating CODE LIST - list configured remote items SET_TRANSMITTERS - set transmitters NUM [NUM ...] SIMULATE - simulate IR event REMOTE is the name of a remote, as described in the lircd configuration file. CODE is the name of a remote control key of REMOTE, as it appears in the lircd configuration file. NUM is the transmitter number of the hardware device. For the LIST DIRECTIVE, REMOTE and/or CODE can be empty: LIST "" "" - list all configured remote names LIST REMOTE "" - list all codes of REMOTE LIST REMOTE CODE - list only CODE of REMOTE The SIMULATE command only works if it has been explicitly enabled in lircd. -h --help display usage summary -v --version display version -d --device use given lircd socket [/var/run/lirc/lircd] -a --address=host[:port] connect to lircd at this address -# --count=n send command n times EXAMPLES
irsend LIST DenonTuner "" irsend SEND_ONCE DenonTuner PROG-SCAN irsend SEND_ONCE OnkyoAmpli VOL-UP VOL-UP VOL-UP VOL-UP irsend SEND_START OnkyoAmpli VOL-DOWN ; sleep 3 irsend SEND_STOP OnkyoAmpli VOL-DOWN irsend SET_TRANSMITTERS 1 irsend SET_TRANSMITTERS 1 3 4 irsend SIMULATE "0000000000000476 00 OK TECHNISAT_ST3004S" FILES
/etc/lirc/lircd.conf Default lircd configuration file. It should contain all the remotes, their infra-red codes and the corresponding timing and wave- form details. DIAGNOSTICS
If lircd is not running (or /var/run/lirc/lircd lacks write permissions) irsend aborts with the following diagnostics: "irsend: could not connect to socket" "irsend: Connection refused" (or "Permission denied"). SEE ALSO
The documentation for lirc is maintained as html pages. They are located under html/ in the documentation directory. lircd(8), mode2(1), smode2(1), xmode2(1), irrecord(1), irw(1), http://www.lirc.org. irsend 0.9.0-pre1 October 2010 IRSEND(1)
All times are GMT -4. The time now is 03:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy