snopt / snopt-python

MIT License
42 stars 13 forks source link

undefined reference to `snset_' #9

Open lijunDEC opened 5 years ago

lijunDEC commented 5 years ago

Hello , Thank you for your code, It is very nice, but I am in trouble for setting up it. And my dll file path is "E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only\solvers\lib\snopt7.dll". It takes me a long time to deal with this issue, but getting nothing. I am looking forward your help. E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only>python setup.py install Appending optimize.solvers configuration to optimize Ignoring attempt to set 'name' (from 'optimize' to 'optimize.solvers') Appending optimize.solvers/snopt configuration to optimize Ignoring attempt to set 'name' (from 'optimize' to 'optimize.solvers/snopt') running install running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler opti ons running config_fc unifing config_fc, config, build_clib, build_ext, build commands --fcompiler opt ions running build_src build_src building extension "optimize.solvers.snopt7_python" sources f2py options: [] adding 'build\src.win32-2.7\build\src.win32-2.7\solvers\f2py\fortranobject.c' to sources. adding 'build\src.win32-2.7\build\src.win32-2.7\solvers\f2py' to include_dirs.

building data_files sources build_src: building npy-pkg config files running build_py running build_ext customize Mingw32CCompiler customize Mingw32CCompiler using build_ext get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', ' intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']' customize GnuFCompiler Could not locate executable g77 Could not locate executable f77 customize IntelVisualFCompiler Could not locate executable ifort Could not locate executable ifl customize AbsoftFCompiler Could not locate executable f90 customize CompaqVisualFCompiler Could not locate executable DF customize IntelItaniumVisualFCompiler Could not locate executable efl customize Gnu95FCompiler Found executable D:\MinGW\bin\gfortran.exe customize Gnu95FCompiler customize Gnu95FCompiler using build_ext building 'optimize.solvers.snopt7_python' extension compiling C sources C compiler: gcc -O2 -Wall -Wstrict-prototypes

compile options: '-DNPY_MINGW_USE_CUSTOM_MSVCR -DMSVCRT_VERSION=0x1500 -Ibui ld\src.win32-2.7\build\src.win32-2.7\solvers\f2py -IC:\Python27\lib\site-package s\numpy\core\include -IC:\Python27\include -IC:\Python27\PC -c' gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -DMSVCRT_VERSIO N=0x1500 -Ibuild\src.win32-2.7\build\src.win32-2.7\solvers\f2py -IC:\Python27\ lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC -c b uild\src.win32-2.7\solvers\f2py\snopt7_pythonmodule.c -o build\temp.win32-2.7\Re lease\build\src.win32-2.7\solvers\f2py\snopt7_pythonmodule.ogcc -O2 -Wall -Wstri ct-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x1500 -Ibuild\s rc.win32-2.7\build\src.win32-2.7\solvers\f2py -IC:\Python27\lib\site-packages\nu mpy\core\include -IC:\Python27\include -IC:\Python27\PC -c build\src.win32-2.7\b uild\src.win32-2.7\solvers\f2py\fortranobject.c -o build\temp.win32-2.7\Release\ build\src.win32-2.7\build\src.win32-2.7\solvers\f2py\fortranobject.o

compiling Fortran sources Fortran f77 compiler: D:\MinGW\bin\gfortran.exe -Wall -g -ffixed-form -fno-secon d-underscore -O3 -funroll-loops Fortran f90 compiler: D:\MinGW\bin\gfortran.exe -Wall -g -fno-second-underscore -O3 -funroll-loops Fortran fix compiler: D:\MinGW\bin\gfortran.exe -Wall -g -ffixed-form -fno-secon d-underscore -Wall -g -fno-second-underscore -O3 -funroll-loops compile options: '-Ibuild\src.win32-2.7\build\src.win32-2.7\solvers\f2py -IC:\Py thon27\lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\ PC -c' gfortran.exe:f90: solvers\f2py\snopt7_python.f90 D:\MinGW\bin\gfortran.exe -Wall -g -Wall -g -shared build\temp.win32-2.7\Release \build\src.win32-2.7\solvers\f2py\snopt7_pythonmodule.o build\temp.win32-2.7\Rel ease\build\src.win32-2.7\build\src.win32-2.7\solvers\f2py\fortranobject.o build\ temp.win32-2.7\Release\solvers\f2py\snopt7_python.o -LE:\download\snopt-python-m aster\snopt-python-master -Ld:\mingw\lib\gcc\mingw32\6.3.0 -LC:\Python27\libs -L C:\Python27\PCbuild -LC:\Python27\PC\VS9.0 -lsnopt7 -lpython27 -lgfortran -o bui ld\lib.win32-2.7\optimize\solvers\snopt7_python.pyd build\temp.win32-2.7\Release\solvers\f2py\snopt7python.o: In function `copyopti ons': E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7 python.f90:46: undefined reference to `snset' build\temp.win32-2.7\Release\solvers\f2py\snopt7_python.o: In function sninit_w rap_': E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7_ python.f90:65: undefined reference tosnfileopenappend' E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7 python.f90:76: undefined reference to sninit_' build\temp.win32-2.7\Release\solvers\f2py\snopt7_python.o: In functionsnspecw rap': E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7 python.f90:96: undefined reference to `snfileopenread' E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7 python.f90:97: undefined reference to `snspec' E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7 python.f90:98: undefined reference to `snfileclose' build\temp.win32-2.7\Release\solvers\f2py\snopt7_python.o: In function snopta_w rap_': E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7_ python.f90:229: undefined reference tosnopta_' build\temp.win32-2.7\Release\solvers\f2py\snopt7_python.o: In function snoptb_w rap_': E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7_ python.f90:286: undefined reference tosnoptb_' build\temp.win32-2.7\Release\solvers\f2py\snopt7_python.o: In function snoptc_w rap_': E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7_ python.f90:338: undefined reference tosnoptc_' build\temp.win32-2.7\Release\solvers\f2py\snopt7_python.o: In function sqinit_w rap_': E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7_ python.f90:360: undefined reference tosnfileopenappend' E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7 python.f90:371: undefined reference to sqinit_' build\temp.win32-2.7\Release\solvers\f2py\snopt7_python.o: In functionsqspecw rap': E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7 python.f90:391: undefined reference to `snfileopenread' E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7 python.f90:392: undefined reference to `sqspec' E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7 python.f90:393: undefined reference to `snfileclose' build\temp.win32-2.7\Release\solvers\f2py\snopt7_python.o: In function sqopt_wr ap_': E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7_ python.f90:442: undefined reference tosqopt_' build\temp.win32-2.7\Release\solvers\f2py\snopt7_python.o: In function snmema_w rap_': E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7_ python.f90:120: undefined reference tosnmema_' build\temp.win32-2.7\Release\solvers\f2py\snopt7_python.o: In function snmem_wr ap_': E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7_ python.f90:140: undefined reference tosnmemb_' build\temp.win32-2.7\Release\solvers\f2py\snopt7_python.o: In function snjac_wr ap_': E:\DownLoad\snopt-python-snopt-only\snopt-python-snopt-only/solvers/f2py/snopt7_ python.f90:177: undefined reference tosnjac_' collect2.exe: error: ld returned 1 exit status error: Command "D:\MinGW\bin\gfortran.exe -Wall -g -Wall -g -shared build\temp.w in32-2.7\Release\build\src.win32-2.7\solvers\f2py\snopt7_pythonmodule.o build\te mp.win32-2.7\Release\build\src.win32-2.7\build\src.win32-2.7\solvers\f2py\fortra nobject.o build\temp.win32-2.7\Release\solvers\f2py\snopt7_python.o -LE:\downloa d\snopt-python-master\snopt-python-master -Ld:\mingw\lib\gcc\mingw32\6.3.0 -LC:\ Python27\libs -LC:\Python27\PCbuild -LC:\Python27\PC\VS9.0 -lsnopt7 -lpython27 - lgfortran -o build\lib.win32-2.7\optimize\solvers\snopt7_python.pyd" failed with exit status 1

gnowzil commented 5 years ago

Did you set the location of the SNOPT library? On Linux/MacOS, you have to set the environment variable SNOPT7LIB, e.g., export SNOPT7LIB=$HOME/lib. I think it should be the same in MinGW.

A-CGray commented 5 years ago

Hey, I'm having the same problem, I have my snopt libraries stored in: C:\Program Files\SNOPT\libsnopt7 The snopt-only branch of this repo under: Documents\snopt-python And I have a system environment variable SNOPT7LIB = C:\Program Files\SNOPT\libsnopt7

Am I doing something wrong?