Note that there are some explanatory texts on larger screens.

plurals
  1. POmake with g++/intel C++ compiler calling fortran functions
    primarykey
    data
    text
    <p>I have been trying to call some functions from a library provided by a commercial finite element code. The examples on using this library are being compiled with intel fortran compiler for my type of system so I am using intel c++ compiler to link the object files, I have set up a simple test case with the extern declerations as </p> <pre><code>extern "C" { int binini_( int* ); int biniqr8_( int*, int* ); int binset_( int*, int*, int*, int*, int*, int*, const char*, int*, int*, int* ); int binrd8_( int*, int*, int*, int*, int*, int* ); int binclo_( int*, const char*, int* ); } </code></pre> <p>And now, I am trying to use intel c++ compiler with the below makefile:</p> <pre><code>CXX = icpc -parallel IncludeDir = /home/utabak/external_libraries/boost_1_46_1 LinkingDir0 = /home/utabak/external_libraries/boost_1_46_1/stage/lib LinkingDir1 = /opt/ansys-12.1/v121/ansys/customize/misc/linx64 LibLink1 = bin LibLink2 = boost_filesystem LibLink3 = boost_system all: test1 test1: test_binlib1.o ${CXX} -o $@ $? -L${LinkingDir0} \ -L${LinkingDir1} \ -l${LibLink1} -l${LibLink2} -l${LibLink3} test_binlib1.o: test_binlib1.cc ${CXX} -I${IncludeDir} -c $? </code></pre> <p>which links and compiles fine. And run as expected. I wanted to do the same with the g++ also, after some trial and error, I set up a make file that is compiling and linking fine: </p> <pre><code>CXX = g++ -g -pg -Wall -pthread IncludeDir = /home/utabak/external_libraries/boost_1_46_1 LinkingDir0 = /home/utabak/external_libraries/boost_1_46_1/stage/lib LinkingDir1 = /opt/ansys-12.1/v121/ansys/customize/misc/linx64 LinkingDir2 = /home/utabak/intel/composerxe-2011/lib/intel64 LibLink1 = bin LibLink2 = boost_filesystem LibLink3 = boost_system LibLink4 = iomp5 # an extra library from intel compiler # openmp, for intel C++ -parallel does it # for g++ I have to explicitly link this all: test1 test1: test_binlib1.o ${CXX} ${LFLAGS} -o $@ $? -L${LinkingDir0} \ -L${LinkingDir1} -L${LinkingDir2} \ -l${LibLink1} -l${LibLink2} -l${LibLink3} -l${LibLink4} test_binlib1.o: test_binlib1.cc ${CXX} -I${IncludeDir} -c $? </code></pre> <p>Hoever, this executable does not run correctly, and strangely, it some times gives a segmentation fault, or file open error, where I first try to open a file using the above mentioned fortran library function, binset_ .</p> <p>I am puzzling on the reason of these errors and the differences. What could be the answer to this problem?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload