esa / pagmo_plugins_nonfree

A pagmo affiliated package (https://github.com/esa/pagmo2) adding commercial solvers to the list of solvers/algorithms: SNOPT7, WORHP
GNU General Public License v3.0
10 stars 9 forks source link

SNOPT 7.4 library cannot be loaded #11

Closed sanjeev-narayanaswamy closed 5 years ago

sanjeev-narayanaswamy commented 5 years ago

Hi @darioizzo,

I am trying to use Snopt 7.4 (compiled from source) with snopt-interface commit 76b166e as mentioned in the README file. However I get a run-time error message that is quite similar to the one encountered in Issue #2:

ValueError:
function: evolve_version
where: /home/conda/feedstock_root/build_artifacts/pygmo_plugins_nonfree_1549017917386/work/include/pagmo_plugins_nonfree/snopt7.hpp, 766
what:
An error occurred while loading the snopt7_c library at run-time. This is typically caused by one of the following
reasons:

- The file declared to be the snopt7_c library, i.e. $HOME/software/lib/libsnopt7_c.so, is not a shared library containing the necessary C interface symbols (is the file path really pointing to
a valid shared library?)
 - The library is found and it does contain the C interface symbols, but it needs linking to some additional libraries that are not found
at run-time.

We report the exact text of the original exception thrown:

function: evolve_version
where: /home/conda/feedstock_root/build_artifacts/pygmo_plugins_nonfree_1549017917386/work/include/pagmo_plugins_nonfree/snopt7.hpp, 718
what: The snopt7_c library path was constructed to be: $HOME/software/lib/libsnopt7_c.so and it does not appear to be a file

Both libsnopt7_c.so and libsnopt7.so are located in the folder specified and I ran the command patchelf --add-needed libsnopt7.so libsnopt7_c.so as mentioned in Issue #3. Please also find the results of the command ldd libsnopt7_c.so below:

linux-vdso.so.1 =>  (0x00007ffe6ef13000)
    libsnopt7.so => ~/software/lib/libsnopt7.so (0x00007f0b66272000)
    libgfortran.so.4 => /scinet/niagara/software/2018a/opt/base/anaconda3/5.1.0/lib/libgfortran.so.4 (0x00007f0b65f48000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f0b65c46000)
    libgcc_s.so.1 => /scinet/niagara/software/2018a/opt/base/anaconda3/5.1.0/lib/libgcc_s.so.1 (0x00007f0b65a34000)
    libquadmath.so.0 => /scinet/niagara/software/2018a/opt/base/anaconda3/5.1.0/lib/libquadmath.so.0 (0x00007f0b65803000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f0b65440000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f0b66735000)

And here is the result of nm -D libsnopt_c.so:

00000000000059b3 T allocI
0000000000007096 T allocIQ
00000000000059eb T allocR
00000000000070ce T allocRQ
                 U __assert_fail
000000000020a308 B __bss_start
                 w __cxa_finalize
0000000000006eb7 T deleteSNOPT
0000000000007cbf T deleteSQOPT
000000000020a308 D _edata
000000000020c280 B _end
                 U fflush
0000000000007d20 T _fini
0000000000003350 T f_npkern
0000000000003480 T f_npopt
                 U free
00000000000032e0 T f_snend
0000000000002ed0 T f_sngetc
0000000000002df0 T f_sngeti
0000000000002d10 T f_sngetr
00000000000046f0 T f_sninit
0000000000004270 T f_snjac
0000000000003e60 T f_snkera
0000000000003990 T f_snkerb
0000000000003560 T f_snkerc
0000000000004f50 T f_snkerq
0000000000003dc0 T f_snmem
0000000000004360 T f_snmema
00000000000040b0 T f_snopta
0000000000003bf0 T f_snoptb
00000000000037c0 T f_snoptc
0000000000003200 T f_snset
0000000000003110 T f_snseti
0000000000004590 T f_snsetprint
0000000000003020 T f_snsetr
00000000000043f0 T f_snspec
0000000000004ee0 T f_sqend
0000000000004ad0 T f_sqgetc
00000000000049f0 T f_sqgeti
0000000000004910 T f_sqgetr
0000000000005690 T f_sqinit
0000000000005310 T f_sqmem
0000000000005140 T f_sqopt
0000000000004e00 T f_sqset
0000000000004d10 T f_sqseti
0000000000005530 T f_sqsetprint
0000000000004c20 T f_sqsetr
0000000000005390 T f_sqspec
0000000000005dc2 T getIntParameter
0000000000005c82 T getParameter
0000000000005ef6 T getRealParameter
                 U _gfortran_st_close
                 U _gfortran_st_inquire
                 U _gfortran_string_len_trim
                 U _gfortran_string_trim
                 w __gmon_start__
0000000000002598 T _init
00000000000058fb T init2zero
0000000000007002 T init2zeroQ
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U malloc
                 U memset
                 U npkern_
                 U npopt_
                 U printf
                 U puts
                 U realloc
0000000000005a23 T reallocI
0000000000007106 T reallocIQ
0000000000005a88 T reallocR
000000000000716b T reallocRQ
0000000000005d30 T setIntParameter
0000000000006251 T setLog
0000000000005bf8 T setParameter
0000000000005aed T setPrintfile
0000000000005e55 T setRealParameter
0000000000005b6e T setSpecsfile
000000000000628c T setSTOP
0000000000005f8b T setUserI
0000000000005fb3 T setUserR
0000000000005fdb T setUserspace
0000000000006021 T setWorkspace
000000000000613f T setWorkspaceA
                 U snfileopenappend_
                 U snfileopenread_
                 U sngetc_
                 U sngeti_
                 U sngetr_
0000000000005811 T snInit
                 U sninit_
00000000000065bc T snJac
                 U snjac_
                 U snkera_
                 U snkerb_
                 U snkerc_
                 U snkerq_
                 U snlog_
                 U snlog2_
                 U snmem_
                 U snmema_
00000000000062a7 T snoptA
                 U snopta_
000000000000676d T snoptB
                 U snoptb_
0000000000006a16 T snoptC
                 U snoptc_
000000000020a340 B __snopt_wrapper_MOD_cw
                 U snset_
                 U snseti_
                 U snsetr_
                 U snspec_
                 U snstop_
0000000000006cb5 T solveA
0000000000006d67 T solveB
0000000000006e10 T solveC
000000000000780f T solveQ
                 U sqgetc_
                 U sqgeti_
00000000000074a5 T sqGetIntParameter
0000000000007365 T sqGetParameter
                 U sqgetr_
00000000000075d9 T sqGetRealParameter
0000000000006f18 T sqInit
                 U sqinit_
                 U sqlog_
                 U sqmem_
0000000000007a67 T sqopt
                 U sqopt_
000000000020b2e0 B __sqopt_wrapper_MOD_cw
00000000000071d0 T sqPrintfile
                 U sqset_
                 U sqseti_
0000000000007413 T sqSetIntParameter
00000000000077f4 T sqSetLog
00000000000072db T sqSetParameter
                 U sqsetr_
0000000000007538 T sqSetRealParameter
                 U sqspec_
0000000000007251 T sqSpecsfile
000000000000766e T sqUserI
0000000000007696 T sqUserR
00000000000076be T sqUserspace
0000000000007704 T sqWorkspace
                 U stdout
                 U strlen

Could you please help me identify the problem? I would really appreciate it.

darioizzo commented 5 years ago

``` $HOME/software/lib/libsnopt7_c.so and it does not appear to be a file````

I think you are just passing the path wrongly? whats the full path of the library? How do you construct the snopt7 uda?

sanjeev-narayanaswamy commented 5 years ago

Perfect! I replaced $HOME with the full path and it works now. Thanks!

 ==============================
   SNOPT  C interface  2.0.0
 ==============================
 S N O P T  7.4-1.2  (Feb 2015)
 ==============================

 SNMEMA EXIT 100 -- finished successfully
 SNMEMA INFO 104 -- memory requirements estimated

 Nonlinear constraints      19     Linear constraints       1
 Nonlinear variables        34     Linear variables         0
 Jacobian  variables        34     Objective variables     34
 Total constraints          20     Total variables         34

 The user has defined     680   out of     680   first  derivatives

 Major Minors     Step   nCon Feasible  Optimal  MeritFunction     nS Penalty
     0     50               1  1.8E+03  5.0E+05  2.2203909E+12                  r i
     1      1  1.6E-02      2  1.8E+03  5.3E+05  2.2043523E+12      1           rli
     2      2  1.6E-02      4  1.8E+03  5.6E+05  2.1878429E+12                sM li
     3     32  1.0E+00      6  4.5E+02  2.1E+06  3.1448262E+11      1          M  i
     4     30  9.6E-01     17  8.5E+02  2.6E+03  5.9837308E+11      1 7.9E-03  m  i
darioizzo commented 5 years ago

Good to see that you managed to compile snopt and use it in plugins!!!!

Will close the ticket now.