Error with shared lIBMpi.so.1 when compiling CPP program


 
Thread Tools Search this Thread
Top Forums Programming Error with shared lIBMpi.so.1 when compiling CPP program
# 1  
Old 03-25-2014
Error with shared lIBMpi.so.1 when compiling CPP program

Hello,
Met a problem when compiling a C++ program from source code without error, but when ran it there was always an error message:
Code:
./Ray: error while loading shared libraries: libmpi_cxx.so.1: cannot open shared object file: No such file or directory

As the error points to openmpi which was installed at /usr/lib64/openmpi/bin/mpicxx
Code:
$ locate libmpi_cxx.so.1
$ /usr/lib64/openmpi/lib/libmpi_cxx.so.1

Then I did following without enough understanding
Code:
export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH

and compile again. It worked!
Now my questions are:
1) When should I export the shared libraries, especially when the shared library is installed at a local directory?
2) Is there any rule to find out any shared library is needed for the compilation of a program besides the system ones /lib:usr/lib:usr/local/lib?
I guessed out the needed library for my example is located at /usr/lib64/openmpi/lib as mpicxx is located at
/usr/lib64/openmpi/bin/
Thanks a lot!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Error in compiling .cpp file

I get this error, defaults.cpp: In member function ‘int Defaults::GetIntDefault(const std::string&)’: defaults.cpp:68: error: ‘atoi’ was not declared in this scope defaults.cpp: In member function ‘real_t Defaults::GetRealDefault(const std::string&)’: defaults.cpp:76: error: ‘atof’ was not... (1 Reply)
Discussion started by: bstephens
1 Replies

2. UNIX for Advanced & Expert Users

Error compiling program with extension .c

good morning, I have 64-bit DB2 V9.7 AIX 7.1.0.0 I am compiling a C program, when running cc-I / rutadb2/include-c programa.c this error. ksh: cc: not found. how I can check if I have installed the C compiler? Any help will be greatly appreciated. Thank you very much and best regards. (2 Replies)
Discussion started by: systemoper
2 Replies

3. Web Development

<Apache>error when compiling CPP modules

Hi, I am working on Linux Platform. I am just trying to port a CPP module to apache as a module. When I try to build the Apache , it throws an error as follows libtool: unrecognized option `-DLINUX=2' Later I did some search and changed the config_vars.mk file under the "build" directory of... (0 Replies)
Discussion started by: ashabb
0 Replies

4. Programming

Compiling and linking Shared Libraries.

I have one C program which contains a function call. I have been given some .so and .h files. I want to know how to compile and link the c program with .so files. I tried following: $ gcc My_program.c libCommon.so My_program.c: In function āmainā: My_program.c:11: warning: parameter names... (3 Replies)
Discussion started by: junaid.nehvi
3 Replies

5. Programming

Trubble in executing the cpp program...

I wrote a code like this....... #include <iostream> #include <stdio.h> #include <mysql.h> #include <string.h> #include <stdlib.h> using namespace std; #include "Connection.h" int main() { char *Host = (char *)"localhost"; char *Database =(char *)"sachin"; char... (3 Replies)
Discussion started by: ps_sach
3 Replies

6. Programming

Compiling multiple cpp files (abstract factory pattern)

Hi all, I have been working with java for awhile and because of my school projects I needed to switch C++. I tried to implement some patterns in C++ but unfortunately I couldn't. Specifically, I tried to implement abstract factory pattern but since I used separated files (habitual behavior from... (4 Replies)
Discussion started by: SaTYR
4 Replies

7. Shell Programming and Scripting

convert cpp program to c shell script ?

Hi guys I tried to convert this c++ code to c shell script but there are some bugs and I don't know how to solve it. This code prints the three variables in decreasing order: int main() { int x,y,z; cin >> x >> y >>z; if ( x < y ) if ( x < z ) if ( y < z ) cout << x <<" " <<... (2 Replies)
Discussion started by: domain
2 Replies

8. Programming

Compiling a C program

Help I know nothing about c programming. :confused: I want to compile the below c program. It extracts data from an oracle database into csv files. I have oracle 9206 installed with ProC. I dont have gcc My question is. How the hell do I make this into an file I can run? I am pulling... (3 Replies)
Discussion started by: ooploo
3 Replies

9. Programming

Compiling a program

Hello. I am trying to run a c program on a unix shell (ssh). I have searched this forum but have not come accross the soultion to my problem, so I am posting my question here :cool: I wrote the following simple code: #include <iostream.h> using namespace std; int main() { ... (7 Replies)
Discussion started by: Minnesota Red
7 Replies

10. Programming

Error Compiling C program

Hi All, I tried to compile a C program but i am getting error while Linking . it says Undefined reference to ' ' (here it gives a method name which is defined Globally ). Can any body tell the resaon and remedy for the same . Iam stuck up here . Thanks (3 Replies)
Discussion started by: Vivek
3 Replies
Login or Register to Ask a Question