How to link library scalapack and blacs while compilation - fortran

When compiling a fortran code, I set
FCL = mpiifort -qmkl=sequential
LLIBS += -L$(MKLROOT)/lib/intel64 -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
but when compiling code, it always links to libmkl_scalapack_lp64.so, not libmkl_scalapack_lp64.a. Then error appears,
ifort: command line warning #10006: ignoring unknown option '-qmkl=sequential'
mpi.o: In function `m_max_d_':
mpi.f90:(.text+0x4b52): undefined reference to `dcopy_'
umco.o: In function `umco_mp_umco_calc_trafo_':
umco.f90:(.text+0x8c30): undefined reference to `dgetrf_'
umco.f90:(.text+0x8c69): undefined reference to `dgetri_'
umco.f90:(.text+0x8dde): undefined reference to `dgetri_'
umco.f90:(.text+0x9911): undefined reference to `dgeev_'
umco.f90:(.text+0x9aa4): undefined reference to `dgeev_'
mathtools.f90:(.text+0x3d08): undefined reference to `zgesdd_'
In function `w90_utility_mp_utility_zgemm_new_':
utility.F90:(.text+0x3712): undefined reference to `zgemm_'
/home/app/intel/compilers_and_libraries_2020.0.166/linux/mkl/lib/intel64/libmkl_scalapack_lp64.so: undefined reference to `ssteqr_'
/home/app/intel/compilers_and_libraries_2020.0.166/linux/mkl/lib/intel64/libmkl_scalapack_lp64.so: undefined reference to `dlahqr_'
What is the correct way to link these two libraries?

It depends very much on what you are doing and compiler versions, amongst other things. As such you don't provide sufficient detail for us to answer the question. But the recommended way is to use the Intel link line advisor, which will help you find the answer by filling in all the required details into a web form. You can find this at https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html#gs.tephcr

Related

How to use STL on ARM Cortex-M chips?

I am using STM32 dev board with MCU G++ Compiler & Linker: arm-none-eabi-g++. However, it seems not compatible with STL:
#include <list>
int main (void)
{
std::list<int> list;
list.push_back(1);
list.sort();
return 0;
}
The linker error messages:
abort.c:(.text.abort+0xa): undefined reference to `_exit'
fstatr.c:(.text._fstat_r+0x10): undefined reference to `_fstat'
signalr.c:(.text._kill_r+0x10): undefined reference to `_kill'
signalr.c:(.text._getpid_r+0x0): undefined reference to `_getpid'
writer.c:(.text._write_r+0x12): undefined reference to `_write'
closer.c:(.text._close_r+0xc): undefined reference to `_close'
isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty'
lseekr.c:(.text._lseek_r+0x12): undefined reference to `_lseek'
readr.c:(.text._read_r+0x12): undefined reference to `_read'
The C++ STL seems dependent on operating systems. Since the micro-controller has no such things, those essential parts are missing while linking ELF.
The problem is how can I use STL on STM32 L4-series chips?
This problem can be solved by adding -specs=nosys.specs to the G++ linker. This links in a separate library with implementations for all required system functions.
See also: http://pabigot.github.io/bspacm/newlib.html
The C Standardlibrary needs some basic functions (called stubs) to work properly. Normally the OS provides these functions.
-specs= nosys.specs provides very dumb versions of these functions. In your compiler path under /share/doc/gcc-arm-none-eabi/pdf there should be a pdf libc.pdf there you will find some information how to implement those stubs yourself (chapter Systemcalls).

GLEW Library and Code::Blocks

I know, i already asked this question but it was tagged as duplicate but no other Question was answered with a answer that worked for me, so i have to ask this question again, beacuse the duplicate flag was not removed after i edited this question.
So here is my question (again):
i have a problem with Code::Blocks.
I want to try out some stuff i have learned about OpenGL and because of reasons i want to do it with Code::Blocks.
But every time i try to link the library (GLEW), i cannot compile my code.
obj\Debug\source\main.o:main.cpp:(.text+0x97): undefined reference to `ChoosePixelFormat#8'
obj\Debug\source\main.o:main.cpp:(.text+0xad): undefined reference to `SetPixelFormat#12'
obj\Debug\source\main.o:main.cpp:(.text+0xbb): undefined reference to `wglCreateContext#4'
obj\Debug\source\main.o:main.cpp:(.text+0xd0): undefined reference to `wglMakeCurrent#8'
obj\Debug\source\main.o:main.cpp:(.text+0xdf): undefined reference to `glMatrixMode#4'
obj\Debug\source\main.o:main.cpp:(.text+0xe7): undefined reference to `glLoadIdentity#0'
obj\Debug\source\main.o:main.cpp:(.text+0x103): undefined reference to `gluOrtho2D#32'
obj\Debug\source\main.o:main.cpp:(.text+0x112): undefined reference to `glMatrixMode#4'
obj\Debug\source\main.o:main.cpp:(.text+0x247): undefined reference to `GetStockObject#4'
obj\Debug\source\main.o:main.cpp:(.text+0x439): undefined reference to `GetStockObject#4'
obj\Debug\source\main.o:main.cpp:(.text+0x5b8): undefined reference to `wglMakeCurrent#8'
obj\Debug\source\main.o:main.cpp:(.text+0x5c6): undefined reference to `wglDeleteContext#4'
obj\Debug\source\main.o:main.cpp:(.text+0x64a): undefined reference to `wglMakeCurrent#8'
obj\Debug\source\main.o:main.cpp:(.text+0x65a): undefined reference to `wglDeleteContext#4'
obj\Debug\source\main.o:main.cpp:(.text+0x850): undefined reference to `glBegin#4'
obj\Debug\source\main.o:main.cpp:(.text+0x893): undefined reference to `glColor3ub#12'
obj\Debug\source\main.o:main.cpp:(.text+0x8a8): undefined reference to `glVertex2d#16'
obj\Debug\source\main.o:main.cpp:(.text+0x8b0): undefined reference to `glEnd#0'
I included GL/glew.h and GL/gl.h on the top of my code and the linker-settings are:
1. ...\glew\lib\Release\x64\glew32s.lib
2. ...\glew\lib\Release\x64\glew32.lib
This was the Build command:
mingw32-g++.exe -LE:...\glew-1.13.0\include -o bin\Debug\TestProject.exe obj\Debug\source\main.o ...\glew-1.13.0\lib\Release\x64\glew32s.lib ...\glew-1.13.0\lib\Release\x64\glew32.lib "...\glew-1.13.0\lib\Release MX\x64\glew32mxs.lib" "...\glew-1.13.0\lib\Release MX\x64\glew32mx.lib"
I tried all answers to previous questions and nothing worked for me... Even if i dont use any OpenGL Function i get this errors. I know what these Errors are and would know what i should do if they would come from me code, but i dont know what to do now.
Please remove the double-post-notation because the answers to the recommend question are not helpful for me.
I really hope you can help me.
Thank you.
Did you defined GLEW_STATIC before including GL/glew.h? Also go to compiler settings panel, and to other options add -DGLEW_STATIC.
Make sure you linked the lib correctly by adding glew32s and opengl32 to the linker settings.

Programming with Kinect on Ubuntu Linux

First time asking a question here so please bear with me if I'm not entirely coherent.
I've been attempting to learn how to use the OpenNI, libfreenect, and SensorKinect libraries to create some code for the kinect. However, the issue I'm running into is that I cannot seem to get the kinect setup properly so that I may actually test code and understand how everything works. The issue that has been the most problematic has been when I try to compile I receive a plethora of undefined reference errors and the compiler quits.
/tmp/ccnXAyOZ.o: In function `main':
KinectDraw.cpp:(.text+0x9a): undefined reference to `xnEnumerationErrorsAllocate'
KinectDraw.cpp:(.text+0xb6): undefined reference to `xnGetStatusString'
KinectDraw.cpp:(.text+0xfa): undefined reference to `xnInitFromXmlFileEx'
KinectDraw.cpp:(.text+0x12a): undefined reference to `xnEnumerationErrorsToString'
KinectDraw.cpp:(.text+0x148): undefined reference to `xnEnumerationErrorsFree'
KinectDraw.cpp:(.text+0x169): undefined reference to `xnGetStatusString'
KinectDraw.cpp:(.text+0x18a): undefined reference to `xnEnumerationErrorsFree'
KinectDraw.cpp:(.text+0x1a4): undefined reference to `xnEnumerationErrorsFree'
KinectDraw.cpp:(.text+0x1bf): undefined reference to `xnFindExistingRefNodeByType'
KinectDraw.cpp:(.text+0x1db): undefined reference to `xnGetStatusString'
KinectDraw.cpp:(.text+0x202): undefined reference to `xnAllocateDepthMetaData'
KinectDraw.cpp:(.text+0x227): undefined reference to `xnWaitOneUpdateAll'
KinectDraw.cpp:(.text+0x243): undefined reference to `xnGetStatusString'
KinectDraw.cpp:(.text+0x273): undefined reference to `xnGetDepthMetaData'
KinectDraw.cpp:(.text+0x2fe): undefined reference to `xnOSWasKeyboardHit'
KinectDraw.cpp:(.text+0x31a): undefined reference to `xnFreeDepthMetaData'
KinectDraw.cpp:(.text+0x329): undefined reference to `xnProductionNodeRelease'
KinectDraw.cpp:(.text+0x338): undefined reference to `xnProductionNodeRelease'
KinectDraw.cpp:(.text+0x347): undefined reference to `xnContextRelease'
/tmp/ccnXAyOZ.o: In function `xn::NodeWrapper::SetHandle(XnInternalNodeData*)':
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x39): undefined reference to `xnGetRefContextFromNodeHandle'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x54): undefined reference to `xnContextUnregisterFromShutdown'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x60): undefined reference to `xnContextRelease'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x6f): undefined reference to `xnProductionNodeRelease'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x82): undefined reference to `xnProductionNodeAddRef'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x91): undefined reference to `xnGetRefContextFromNodeHandle'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0xb2): undefined reference to `xnContextRegisterForShutdown'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0xc1): undefined reference to `xnContextRelease'
collect2: error: ld returned 1 exit status
The command being that receives the error is g++ KinectDraw.cpp -I /usr/include/ni -I ~/KinectLibs/OpenNI/Include. I have used https://www.kdab.com/setting-up-kinect-for-programming-in-linux-part-1/ to setup the kinect. If anyone has any insight into my issue or even just a good place to start reading to figure it out I would be very appreciative. Thank you for your time and assistance!
UPDATE: Thanks to lxrec's comment, I'm fairly certain that she/he and my initial assumption were correct in that I am not linking the libraries correctly. I haven't found any documentation for Linux implementations of code that include the directories used in compiling so if anyone has insight into this I would be appreciative.
UPDATE: So I've still yet to resolve the issue (I cannot figure out how to compile the code), however thinking that my installation of OpenNI or libfreenect was bad I have resinstalled them. That however did not solve my problem. Thank you to anyone who can provide insight!
UPDATE: Below is the code that I'm having issues compiling. I haven't even tried to add anything into it yet...
#include <XnCppWrapper.h>
#include <XnStatusCodes.h>
#include <XnOS.h>
#include <math.h>
#include <XnOpenNI.h>
#include <iostream>
using namespace xn;
using namespace std;
int main()
{
cout<<"This is a test\n";
return 0;
}
OpenNI source-code should include the libs files (.so files) in its lib directory ($SOURCE_DIR/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10-$YOUR_VERSION/lib). All of these files (for me there 5 files: libnimCodecs.so, libnimMockNodes.so, libnimRecorder.so, libOpenNI.jni.so and libOpenNI.so) are being copied to /usr/lib after you run the install.sh (please follow the OpenNI build/installation instructions)
Your example code needs a -lOpenNI arg to complete the compile process. So you should compile your code like this: g++ your_code.cpp -I/usr/include/ni -lOpenNI
This might already an old question, hopefully your prob are already solved, and this answer can help someone next time.

Undefined references errors linking libQxt to project. Migrating from Qt4 to Qt5

I am migrating a project from Qt4.x to 5, I am almost finished but I am getting errors when linking libQxt.
At first I downloaded the libQxt for Qt5 & compiled it with Qt5 then included them in the project, but it didnt solve any of the undefined references, (probably because there are deprecated functions and such) so I downloaded the libQxt for Qt4 and compiled the libraries using Qt4, and it did solve many of the undefined references, but I am still getting two errors, which shouldnt because the functions the errors refer to are in the included libraries.
These are the errors:
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x82b9): undefined reference to `_imp___ZN14QxtMailMessageC1ERK10QByteArray'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaebc): undefined reference to `_imp___ZNK17QxtMailAttachment7rawDataEv'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./release\csnmailbox.o: bad reloc address 0x1 in section `.text$_ZN16AttachmentsModelD1Ev[__ZN16AttachmentsModelD1Ev]'
collect2.exe: error: ld returned 1 exit status
And these are the linkings to the libraries:
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtCore.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtDesignerPlugins.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtGui.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtNetwork.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtSql.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtWeb.a" \
If I comment the line that includes the libQxtnetwork (which is the one that the program really uses) there are more errors, so I dont understand why its not detecting those 2 functions. Here are the errors I get when I comment that line:
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x167): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x61c4): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x6227): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x62a7): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x6dac): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x73c9): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x7500): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x82b9): undefined reference to `_imp___ZN14QxtMailMessageC1ERK10QByteArray'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x85dc): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x8814): undefined reference to `_imp___ZN14QxtMailMessage14setExtraHeaderERK7QStringS2_'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x9b61): undefined reference to `_imp___ZNK14QxtMailMessage14hasExtraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x9cad): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaaff): undefined reference to `_imp___ZNK14QxtMailMessage4bodyEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xab40): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xacb6): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaeb0): undefined reference to `_imp___ZNK14QxtMailMessage10attachmentERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaebc): undefined reference to `_imp___ZNK17QxtMailAttachment7rawDataEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaee7): undefined reference to `_imp___ZN17QxtMailAttachmentD1Ev'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xafd2): undefined reference to `_imp___ZN17QxtMailAttachmentD1Ev'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xb695): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./release\csnmailbox.o: bad reloc address 0x1 in section `.text$_ZN16AttachmentsModelD1Ev[__ZN16AttachmentsModelD1Ev]'
I hope someone can enlighten me with some knowledge.
Thankyou very much.
EDIT: I managed to 'fix' those errors, I was missing something so simple as
#include <QxtNetwork>
(I didnt write this code, which makes porting harder than it should)
Bad thing is I have very similar errors now:
..\marssies\csnmailbox.cpp: In member function 'void CSNMailBox::onAttachmentDoubleClicked(const QModelIndex&)':
..\marssies\csnmailbox.cpp:183:46: error: 'class QxtMailAttachment' has no member named 'rawData'
_f.write(_m->attachment(_fname.toLatin1()).rawData());
..\marssies\csnmailbox.cpp: In member function 'virtual void MailWorker::run()':
..\marssies\csnmailbox.cpp:491:57: error: no matching function for call to 'QxtMailMessage::QxtMailMessage(QByteArray)'
m_nm.append(__mm = new QxtMailMessage(_m.toLatin1()));
^
I will try to solve these now, at least I got past that point.
EDIT2: I have managed to solve the first error by changing rawData() to mimeData(), it must have been deprecated. I hope the functionality stays the same.
EDIT3: Apparently the last error is just an issue with the constructor:
QxtMailMessage* __mm= new QxtMailMessage(_m.toLatin1());
The constructor accepts either a QxtMailMessage object or qstrings sender, recipient, but I think _m is the message. I will have to ask who wrote the code, because the names of the variables dont help at all.
I can say the question has been solved. Thankyou.

Building Zetacoin on FreeBSD: undefined reference to `Shutdown()

I am trying to build zetacoin on FreeBSD 9.2 but I have come across a compiler error that I can't figure out.
obj/bitcoind.o: In function `AppInit(int, char**)':
/root/zetacoin/work/zetacoin-zetacoin-5eed859/src/bitcoind.cpp:43: undefined reference to `Shutdown()'
/root/zetacoin/work/zetacoin-zetacoin-5eed859/src/bitcoind.cpp:57: undefined reference to `HelpMessage()'
/root/zetacoin/work/zetacoin-zetacoin-5eed859/src/bitcoind.cpp:102: undefined reference to `AppInit2(boost::thread_group&)'
/root/zetacoin/work/zetacoin-zetacoin-5eed859/src/bitcoind.cpp:121: undefined reference to `Shutdown()'
obj/bitcoind.o: In function `DetectShutdownThread(boost::thread_group*)':
/root/zetacoin/work/zetacoin-zetacoin-5eed859/src/bitcoind.cpp:12: undefined reference to `ShutdownRequested()'
/root/zetacoin/work/zetacoin-zetacoin-5eed859/src/bitcoind.cpp:17: undefined reference to `ShutdownRequested()'
It turns out that this was indeed building correctly and failing during the test target. Zetacoin currently does not have a test suite.
Problem solved.