4


Programming newbie here so please bear with me!

I am investigating using Armadillo (with Lapack and Blas or OpenBlas) in a custom C++ Qt GUI project to do some rather heavy matrix arithmetic and manipulations and am having a few issues that reading prior posts on stackoverflow hasn't helped with yet.

Setup:
- Windows x64 build of Qt 5.3.2 using MingW 4.9.1 obtained from this website (http://sourceforge.net/projects/qtx64/)
- QtCreator 3.3.0
- Armadillo 4.600.3 package from (http://arma.sourceforge.net/download.html) with the included Lapack and Blas x64 dlls and libs in the extracted example folder. - The dlls and libs mentioned above are the pre-compiled x64 files available in the Armadillo package. I have NOT recompiled Lapack or Blas, etc.

Issue:
- When attempting to run a subset of the included Armadillo example, a seg fault is thrown when attempting to compute the determinant (B = det(A)). Below is the .cpp and .pro files that I am using. I will also include the "Compile Output" results from QtCreator which shows the output from compiling in debug mode, the g++ command, etc.
- The "include" folder referenced below has the armadillo file and the armadillo_bits subfolder.
- The "dependencies" folder has the .dll and .lib x64 files for Lapack and Blas included with Armadillo.
- I know from reading here that Lapack should be passed to g++ prior to Blas. This should be the case.
- The "config.hpp" Armadillo file has the following lines ENABLED (or NOT commented out). All other entries are commented out:

#define ARMA_USE_LAPACK
#define ARMA_USE_BLAS
#define ARMA_BLAS_UNDERSCORE

main.cpp

#include <iostream>
#include <armadillo>

using namespace std;
using namespace arma;

int main()
{
    cout << "Armadillo version: " << arma_version::as_string() << endl;

    mat A(2,3);  // directly specify the matrix size (elements are uninitialised)

    cout << "A.n_rows: " << A.n_rows << endl;  // .n_rows and .n_cols are read only
    cout << "A.n_cols: " << A.n_cols << endl;

    A(1,2) = 456.0;  // directly access an element (indexing starts at 0)
    A.print("A:");

    A.resize(2,2);
    A.fill(97.0);
    A.print("A:");

    mat B;
    B = det(A); // throws seg fault here

    return 0;
}

arma_test_21jan2015.pro

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

INCLUDEPATH += "c:/qt/armadillo/include"
DEPENDPATH += "c:/qt/armadillo/dependencies"

LIBS += -L"c:/qt/armadillo/dependencies/" -llapack_win64_MT
LIBS += -L"c:/qt/armadillo/dependencies/" -lblas_win64_MT

SOURCES += main.cpp

include(deployment.pri)
qtcAddDeployment()

Compile Window Output

11:42:01: Running steps for project arma_test_21jan2015...
11:42:01: Configuration unchanged, skipping qmake step.
11:42:01: Starting: "C:\Qt\qt-5.3.2-x64-mingw491r1-seh\mingw64\bin\mingw32-make.exe" 
C:/Qt/qt-5.3.2-x64-mingw491r1-seh/mingw64/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Qt/projects/arma_test_21jan2015'
g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -I. -I"..\..\..\qt\armadillo\include" -I"..\..\qt-5.3.2-x64-mingw491r1-seh\qt-5.3.2-x64-mingw491r1-seh\mkspecs\win32-g++" -o debug\main.o main.cpp
g++ -Wl,-subsystem,console -mthreads -o debug\arma_test_21jan2015.exe debug/main.o  -Lc:/qt/armadillo/dependencies/ -llapack_win64_MT -lblas_win64_MT 
mingw32-make[1]: Leaving directory 'C:/Qt/projects/arma_test_21jan2015'
11:42:04: The process "C:\Qt\qt-5.3.2-x64-mingw491r1-seh\mingw64\bin\mingw32-make.exe" exited normally.
11:42:04: Elapsed time: 00:03.

I honestly have no clue how to solve this issue. Maybe it is my newness to this that is causing me to miss something fundamental and obvious. I've seen some references to adding PRE_TARGETDEPS to the QtCreator project file but am unsure if I point to the .lib files or something else.

Would anybody out there be able to take a look at this and offer some insights?
Thanks

Jas
  • 73
  • 1
  • 6

0 Answers0