Intel compiler undefined reference to symbol 'for_inquire' - fortran

I'm running a Makefile given to me to compile some Fortran code along with some C++ code. This is being compiled on CentOS using the intel compiler.I didn't write any of the code or the Makefile, also I have no clue what I'm doing.
When I run the Makefile script I get the following error when trying to do something with Fortran code 'libStuff':
ld: /home/myProject/trunk/libStuff/lib/libStuff.a(stuff.o): undefined reference to symbol 'for_inquire'
/opt/intel2019/compilers_and_libraries_2019.0.117/linux/compiler/lib/intel64_lin/libifcore.so.5: error adding symbols: DSO missing from command line
make[1]: *** [myProject] Error 1
I've played around with the Makefile and I've figured out that I need to add a flag to a specific line
MYFORTRANCODE=-L$(MYFORTRANCODE_LIB) -lSTUFF -lmpi_usempif08 -lmpi_mpifh -l_I_NEED_TO_ADD_SOMETHING_HERE
The problem is I don't know which flag to add, and couldn't find any helpful documentation on the intel website. Also I couldn't figure out what the 'for_inquire' thing means.
Anybody got any ideas?

the flag I needed to add was -lifcore. I figured it out.

Related

libstdc++.so.6: error adding symbols: DSO missing from command line

I have started learning C++ on Ubuntu. I am only a few months into using Linux as well.
I am attempting to port over a 2D Ball Collision Script from Javascript to C++ for learning purposes.
I am using simple2D for the drawing in C++: https://github.com/simple2d/simple2d
I go to run this command:
simple2d build c-code-test.cpp
I receive this response:
cc1plus: warning: command line option ‘-std=c11’ is valid for C/ObjC but not for C++
/usr/bin/ld: /tmp/ccl07DBG.o: undefined reference to symbol '_ZNSt8ios_base4InitD1Ev##GLIBCXX_3.4'
//usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Due to how fresh I am with Linux and C++ I am unable to make the correct inferences to solve this based on previous questions on stack overflow. I have installed libstdc++6 so I would have though it would be linked correctly.
Can someone walk me through in steps 1, 2, 3 ... Please? Thank you kindly!
The errors you see look to be from trying to compile C++ as C. The command line option is selecting the C11 standard, which is for C, not C++. The missing symbol is because the C++ library isn't being linked in, which also happens when linking a program as C.
I haven't used simple2d, but my guess here is that the compile script they wrote does not support C++ or there is some option you need to use C++. If we look at docs:
The simple2d build command is a helpful shortcut for compiling a
single source file. Of course, you can also use a compiler directly,
for example on Unix-like systems:
cc triangle.c `simple2d --libs` -o triangle
Why don't you try something like their example that invokes the compiler directly. But you would need to use g++ instead of cc. Something like: g++ c-code-test.cpp `simple2d --libs` -o c-code-test
This is a bug with the simple2d script.
They're basically using the wrong build command for C++.
You could work around it by patching in the fix I've linked to, or using the manual build step shown by TrentP.
Or wait for the next version after v1.1.0.

File in wromg format

I have searched this site and all over on Google for an answer to this problem. I am trying to compile a simple GL program and whenever I compile I get the following error:
C:\MinGW\lib\GL/glew32.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status
Looks like you may have a Unix make file (the forward slash /glew32.lib) running on Microsoft using MinGW. ld -1 is the linkage editor complaining about a previous error. You might want to review the GLEW documentation: http://glew.sourceforge.net/install.html and make sure the libraries are lined up for MinGW. You can make sure you have the right MinGW (32 bit or 64 bit) compiler here: http://mingw-w64.org/doku.php

How to solve C++ conflicts between system and library dependencies

My problem is rather specific, but bear with me.
This in the end is kinda reverse engineering, but this problem in particular seems to fit more this board.
So, I have a shared object compiled for MIPS written in C++. I don't have the source code of the lib. The lib is compiled using GCC 4.3.3. I want to use functions present in this shared object in my amd64 computer running elementary OS. To do this, I used the sourcery cross compiler to cross compile some C++ code to MIPS, that would use this object.
So far I managed this except for this one compile error, which I cannot figure out. The lib is called libdvl.so, and uses as dependency libc.so.0 (and both are in the same folder as the cpp code).
mips-linux-gnu-g++ -g -L/path/to/lib -Wl,-rpath,/path/to/lib -o verifier verifier.cpp -ldvl
which gives me
(...)/mgc/embedded/codebench/bin/../lib/gcc/mips-linux-gnu/4.9.1/../../../../mips-linux-gnu/bin/ld: warning: libc.so.0, needed by /path/to/lib/libdvl.so, may conflict with libc.so.6
(...)/mgc/embedded/codebench/bin/../lib/gcc/mips-linux-gnu/4.9.1/../../../../mips-linux-gnu/bin/ld: errno##GLIBC_PRIVATE: TLS definition in (...)/mgc/embedded/codebench/bin/../mips-linux-gnu/libc/lib/libc.so.6 section .tbss mismatches non-TLS definition in /path/to/lib/libc.so.0 section .bss
/path/to/lib/libc.so.0: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
So I added "-l:libc.so.0" and got this
(...)/mgc/embedded/codebench/bin/../lib/gcc/mips-linux-gnu/4.9.1/../../../../mips-linux-gnu/bin/ld: errno: TLS definition in (...)/mgc/embedded/codebench/bin/../mips-linux-gnu/libc/lib/libc.so.6 section .tbss mismatches non-TLS definition in libc.so.0 section .bss
(...)/mgc/embedded/codebench/bin/../mips-linux-gnu/libc/lib/libc.so.6: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Any idea how to solve this? I know I am using GCC 4.9.1, but I already downloaded the older code sourcery version which uses GCC 4.3.154 and got the exact same error.
EDIT 1: Exactly as Lol4t0 said, filtered using c++filt it gives an actual function name from stdc++. Using
mips-linux-gnu-g++ -g -L/path/to/lib -Wl,-rpath,/path/to/lib -I/path/to/lib -o verifier verifier.cpp -ldvl -l:libuClibc++.so.0 -l:libutil.so.0 -l:libc.so.0 -l:ld-uClibc.so.0 -nodefaultlibs
to give to libdvl its depencies (as I will not rewrite stdc++ :p), I get the following compile error:
(...)/mgc/embedded/codebench/bin/../lib/gcc/mips-linux-gnu/4.9.1/../../../../mips-linux-gnu/bin/ld: /tmp/cc66DLda.o: undefined reference to symbol '_Unwind_Resume##GCC_3.0'
(...)/mgc/embedded/codebench/bin/../mips-linux-gnu/libc/lib/libgcc_s.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
I already confirmed lib dependencies and the order in which they appear.
Any thoughts on this?
Thanks for all the help.
Using -nodefaultlibs solves the first problem though.
You are linking against GLIBC (libc.so.6) and some other libc (libc.so.0).
That could never work: you have to have everything compiled and linked against a single, consistent libc.
Since your libdvl.so uses as dependency libc.so.0, and assuming you can't rebuild libdvl.so, you have to use crosscompiler that targets libc.so.0 (which is possibly dietlibc, or uClibc), and compile and link everything else using that toolchain. Your crosscompiler on the other hand appears to target GLIBC, and will not do you any good.
After a lot of trial and error, you may be able to link the final binary using inconsistent builds, and your binary may even get to main (that is very unlikely). But chances of such binary actually working correctly are minuscule.

Undefined reference to 'inflateInit2_'

I'm using Code Blocks IDE and I want to install Tiled Map Editor for SFML. So, I downloaded the source and imported it to my project. Unfortunately, the build finished with an error due to missing zlib library. I downloaded it and built again. This time I received an error that reads:
undefined reference to `inflateInit2_'|
undefined reference to `inflateEnd'|
undefined reference to `inflateEnd'|
On the Internet I found the advice to join the linker command -lz, but the compiler refuses throwing the error: cannot find -lz. Does anyone know how to fix it?
Use the option -L<path> to tell the linker where to find libz.so.x.y.z.
For your reference: http://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html
you can see where your zlib is installed like this :
/sbin/ldconfig -p| grep libz.so
it should find one or more entries if installed, otherwise it will return blank line

ld warning: file A.o: attempted multiple inclusion of file

I am trying to port some windows C++ code to Solaris (Unix). I am compiling the code using CC(the SUN C++ compiler). After some efforts, I only have one warning message left as shown below.
ld: warning: file A.o: attempted multiple inclusion of file
I try to search the warning message. But what I got are some info that this warning can be ignored... Although it is a warning, I would really like to understand it and solve it.
May I know if any one can give me some clue what this warning means?
Thanks,