mlpack / ensmallen

A header-only C++ library for numerical optimization --
http://ensmallen.org
Other
742 stars 120 forks source link

Linker error #163

Closed dangulod closed 4 years ago

dangulod commented 4 years ago

Hi,

I was testint how the library works on Windows with Microsoft Visual Studio 2017. I compile every library manually: armadillo 9.8 and openblas 0.3.7 according to the documentation.

However, when i build a simple example:

#include <ensmallen.hpp>
#include <armadillo>

class SquaredFunction
{
public:
    double Evaluate(const arma::mat& x)
    {
        return 2 * std::pow(arma::norm(x), 2.0);
    }
};

int main()
{
    arma::mat x("1.0 -1.0 1.0");

    ens::CNE optimizer;
    SquaredFunction f; // Create function to be optimized.
    optimizer.Optimize(f, x);

    std::cout << "Minimum of squared function found with simulated annealing is " << x;

    return 0;
}

Moreover, I have linked armadillo.lib, openblas.lib and lapack.lib. Unfourtunately, I get two linker error:

Error   LNK2001 unresolved external symbol sgesdd_
Error   LNK2001 unresolved external symbol dgesdd_

I imagine that I am not building something properly, but I have tried to everything.

zoq commented 4 years ago

Looking at https://github.com/mlpack/ensmallen/pull/158/files it should be possible to use ensmallen on Windows, can you check the build steps used in the config and also provide some more information, e.g. command line you used to build each?

dangulod commented 4 years ago

Hi zoq,

Thank you for your reply. I have just solved the linker error by using the link you provided. Instead of build OpenBlas, I used nugget to download OpenBLAS.0.2.14.1 and then link to it,

However, I do not know if I was not building OpenBLAS properly or there is some kind of incompatibilities.

Regards

zoq commented 4 years ago

Great that you could solve the issue, difficult to tell what went wrong, maybe some missing flag, I'll see if I can reproduce the issue at some point.

Should we close the issue?

dangulod commented 4 years ago

Yes, you can close the issue.

Maybe a missing flag or some kind of incompatibility. Thank you for your help.

zoq commented 4 years ago

Okay, we can always reopen this one if there are any updates.