MPIRUN - symbol lookup error - undefined symbol - fortran

I have Fortran code that is compiled using mpiifort. I have an error when running this code using mpirun. Bellow I am pasting both how I compile and run. I get two warnings that are ignored, and one error. I believe the error is the real issue, not the warnings. I would greatly appreciate any help!
mpiifort mycode.f90 -r8 -O2 -xHost -override-limits -o output.out
[me#gauss ORIGINALV]$ mpirun -n 1 ./output.out
[gauss:31148] mca: base: component_find: unable to open /usr/local/openmpi/1.10.0/lib/openmpi/mca_plm_tm: libtorque.so.2: cannot open shared object file: No such file or directory (ignored)
[gauss:31148] mca: base: component_find: unable to open /usr/local/openmpi/1.10.0/lib/openmpi/mca_ras_tm: libtorque.so.2: cannot open shared object file: No such file or directory (ignored)
./output.out: symbol lookup error: /srv/home/shaorshadze/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/lib/libmpifort.so.12: undefined symbol: MPI_UNWEIGHTED
Primary job terminated normally, but 1 process returned a non-zero exit code.. Per user-direction, the job has been aborted.
mpirun detected that one or more processes exited with non-zero status, thus causing the job to be terminated. The first process to do so was:

Related

g++ error : zsh: command not found: subtitle_modifier

when i was trying to run my c++ program with these 2 command:
g++ subtitle_modifier.cpp -o subtitle_modifier
subtitle_modifier subtitle.srt 3000
I got some error:
zsh: command not found: subtitle_modifier
How can i solve this problem?
Prefix your binary with ./ such as ./subtitle_modifier to invoke it from the current directory. Only writing the name assumes it is present in path, which in your case is not true.

How do i call External Code from Oct Files without Errors?

I want to run a Fortran program within Octave. I found a document, that has an example that i followed step by step. Here is the link. I compiled fortransub.f with the command gfortran -c fortransub.f and fortrandemo.cc with the command mkoctfile -c fortrandemo.cc. Now i have two header files. In the document it says :
Both the Fortran and C++ files need to be compiled in order for the example to work.
For me it is really a vague statement. Now to my problem. I don't know if i have to create an octfile. When i try to create one with the command mkoctfile fortrandemo.cc i get the following error:
c:/octave/octave~1.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\goebl\AppData\Local\Temp/oct-A409yh.o: in function `Ffortrandemo(octav
e_value_list const&, int)':
C:\Users\goebl\Desktop\Test_1/fortrandemo.cc:23: undefined reference to `fortransub_'
collect2.exe: error: ld returned 1 exit status
warning: mkoctfile: building exited with failure status
When i try to run the command that is the next step in the document, i get the following error:
mkoctfile fortrandemo.cc fortransub.f
gfortran: fatal error: cannot specify '-o' with '-c', '-S' or '-E' with multiple files
compilation terminated.
What did i miss or did wrong? Can someone help me out? Thank you very much!

error while invoking an online header file involving futures

I have written a template function wait_for_all(vector) which blocks until every future in the vector is ready and then exits.
The problem and an implementation were originally given by Stroustrup in "The C++ Programming Language", 4th ed, pg 1243. However, I have changed the implementation, since Stroustrup's didn't handle exceptions thrown by a passed future. I have successfully tested my implementation: http://coliru.stacked-crooked.com/a/43bc327ac9f77f48. This solution combines the function and the tester in a single source file.
However, when I split the function and the tester into 2 separate files on coliru, I run into an error for the tester.
Header: http://coliru.stacked-crooked.com/a/5f3e11b783baf2e7 : It's OK
Tester: http://coliru.stacked-crooked.com/a/9badf42d85fc4e96 : Gives an error
The compilation output for the tester is:
ln -s /Archive2/5f/3e11b783baf2e7/main.cpp wait_for_all.h #link to the header file
clang++ -std=c++14 -stdlib=libc++ -O2 -Wall -Wextra -pedantic-errors main.cpp -o wait_for_all_test
./wait_for_all_test
/usr/bin/ld: /tmp/main-28d9f5.o: undefined reference to symbol 'pthread_setspecific##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
bash: line 11: ./wait_for_all_test: No such file or directory
What exactly is this error and how do I fix it?

How to compile this C++ code on Linux with relevant header files?

I am trying to compile this C++ code in my Linux box using g++ but it fails with the following error:
enigma/Enigma# g++ -I . main.cpp -o main
In file included from machine.h:14:0,
from tests.h:13,
from main.cpp:10:
plug.h:13:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
#import "util.h"
^~~~~~
/tmp/ccxyoEC2.o: In function `main':
main.cpp:(.text+0x10): undefined reference to `test_machine_encode_decode()'
collect2: error: ld returned 1 exit status
The error indicates that the compiler cannot find the tests.h file present in the same folder. How can I compile and run this code?
I now understand that I needed to link the object files together, I did so using:
g++ -c *.cpp
g++ *.o -o enig
It still does not work though, the resulting binary executes with ./enig but is broken and does not function as intended:
Entire encoded message: TZQA
Decoding now...
Entire decoded message: AHOJ
Entire encoded message: HBIU
Decoding now...
Entire decoded message: AHOJ
Entire encoded message: ZSNE
Decoding now...
Entire decoded message: AHOJ
Entire encoded message: ICRH
It just keeps encoding and decoding those random texts as opposed to the functionality mentioned on the git page I shared above.
Anything I'm missing?
The error indicates that the compiler cannot find the tests.h file present in the same folder.
No, it doesn't. In fact, the compiler successfully compiled main.cpp.
The error indicates that the linker cannot find test_machine_encode_decode. This is hardly surprising, since test_machine_encode_decode is defined in test.cpp. You have to link the object files of main.cpp and test.cpp to get a complete executable.
If you look at the actual code, you'll see that main only calls the test_machine_encode_decode() Unit-test. You'll have to implement the functionality from the readme yourself or you search through the git history and try to find out, if the program actually worked in the past.

File not recognized: File truncated GCC error

I'm trying to compile a simple "Hello World" program in Linux using Eclipse, but I always get this:
Building target: hello
Invoking: GCC C++ Linker
g++ -o "hello" ./src/hello.o
./src/hello.o: file not recognized: File truncated
collect2: ld returned 1 exit status
make: *** [hello] Error 1
**** Build Finished ****
Does anyone have an idea what the problem is?
Just remove the object file.
This error most likely appeared after the previous build was interrupted and object file was not generated completely.
Just as an info if someone comes around here.
Another problem (with the same error) could be, that you are using ccache for faster compilation. In this case, the corrupt *.o file is there as well. So for that reason you have to clean the cache with
ccache -C (note the upper case C!)
Wasted me hours the first time ;-)
I think
g++ -o "hello" ./src/hello.o
should be ./src/hello.(c | cpp | cc depending on your language type)