devernay / cminpack

A C/C++ rewrite of the MINPACK software (originally in FORTRAN) for solving nonlinear equations and nonlinear least squares problems
http://devernay.free.fr/hacks/cminpack/
149 stars 62 forks source link

Functions missing in windows #39

Closed cjzubiaga closed 3 years ago

cjzubiaga commented 4 years ago

I'm compiling a fortran package in linux and windows. It perfectly link with minpack in linux, but the next functions are missing in windows: qrfac_'qform' `dogleg' r1updt_'r1mpyq' `r1mpyq' I'm using the package stored in conda-forge

tadeu commented 4 years ago

The symbols seem to be there in cminpack_s.lib. How are you linking to it? What are the error messages you are getting?

cjzubiaga commented 4 years ago

In the conda package there is a cminpack.lib but not a cminpack_s.lib. The linker I'm using is ld of mingw32. The linker is called by disttulis of numpy Everything is obtained with anaconda

I get the next errors:

undefined reference to `qrfac_'
undefined reference to `qform_'
undefined reference to `dogleg_'
undefined reference to `r1updt_'
undefined reference to `r1mpyq_'
undefined reference to `r1mpyq_'

If I do not link with cminpack I also have the same errors and dpmpar_'enorm' `enorm' enorm_'enorm' `enorm' `enorm_' as well not found

tadeu commented 4 years ago

Indeed, the symbols are not in the lib in version 1.3.6 (before I was looking into 1.3.5, not from conda-forge).

Are these functions supposed to be publicly exported in cminpack? They seem to lack CMINPACK_EXPORT, also they are not declared in public headers, and are not tested.

devernay commented 4 years ago

Those are internal functions in MINPACK, and are not supposed to be exported. See here: https://github.com/devernay/cminpack/blob/master/minpack.h#L275 and here: https://github.com/devernay/cminpack/blob/master/cminpack.h#L343

If an external package uses these functions directly, it should probably include the source code for these as well. My guess is that the package you are trying to compile includes the source for hybrj or hybrd, but forgot to include dependencies.

I don't see much point in exposing/exporting these functions.

devernay commented 4 years ago

note that dpmpar and enorm are explicitely exported here: https://github.com/devernay/cminpack/blob/d1f5f5a273862ca1bbcf58394e4ac060d9e22c76/minpack.h#L244

devernay commented 4 years ago

but of course you would have to include "minpack.h" from this package