Error 0xc000007b after building with gcc flag -m32

0

I have installed mingw-w64 because I need C++11/C11 multithreading features for execute armadillo library (http://arma.sourceforge.net/) but I need to compile program with 32bit dll too. When I compile this 32bit program with the flag -m32 there are no problem when I run it but when I run a program with armadillo library with this flag the error 0xc000007b appears. For builds a program with armadillo library I need to link Intel Math Kernel Library (https://software.intel.com/en-us/mkl) for 32bit arquitecture.

I already tried to use dependency walker but the results don't clarify anything.

This is the command line that I use:

g++ --std=c++11 -o PruebaArmadillo PruebaArmadillo.cpp -IC:\armadillo-9.800.4\include -LC:\mkl_32\redist\ia32_win\mkl -lmkl_rt -m32

I work on windows 10 with g++ (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) 8.1.0

CODE

#include <iostream>
#include <armadillo>
#include <vector>


using namespace std;
using namespace arma;

int main()
  {

    vec p = { 1, 1, 3 };
    cout << p << endl;
}

Result

Error programa


EDIT

To clarify certain aspects I show here the result of the same code compiled with mingw and with mingw-w64.

With mingw:

C:\MicoCode\prueba1>g++ --version
g++ (MinGW.org GCC-8.2.0-5) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


C:\MicoCode\prueba1>g++ --std=c++11 -o PruebaArmadillo PruebaArmadillo.cpp -IC:\armadillo-9.800.4\include -LC:\mkl_32\redist\ia32_win\mkl -lmkl_rt
In file included from C:\armadillo-9.800.4\include/armadillo:171,
                 from PruebaArmadillo.cpp:4:
C:\armadillo-9.800.4\include/armadillo_bits/SpMat_bones.hpp:675:29: error: 'mutex' in namespace 'std' does not name a type
   arma_aligned mutable std::mutex cache_mutex;

This cause mutex error and that's why I need to use mingw-w64 but this give me the error what I pointed out at the beginning. But if I use the mkl library for 64 bits it's work fine:

C:\MicoCode\prueba1>g++ --version
g++ (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


C:\MicoCode\prueba1>g++ --std=c++11 -o PruebaArmadillo PruebaArmadillo.cpp -IC:\armadillo-9.800.4\include -LC:\mkl_2\redist\intel64_win\mkl -lmkl_rt

C:\MicoCode\prueba1>PruebaArmadillo.exe
   1.0000
   1.0000
   3.0000
mingw
mingw-w64
armadillo
intel-mkl
asked on Stack Overflow Jan 29, 2020 by Rafa Hernández • edited Jan 31, 2020 by Rafa Hernández

1 Answer

1

Finally, I found the solution, the error appeared because the system can't find the 32bit libraies because the program is compiled on a 64bit arquitecture. To solve it, it's enough to include these libraries as a path environment variable. The 32bit library it's found on: C:\---\mingw64\x86_64-w64-mingw32\lib32

answered on Stack Overflow Feb 1, 2020 by Rafa Hernández

User contributions licensed under CC BY-SA 3.0