pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

(Linux?) issue with -ldl in math/lp_solve (or mk/dlopen.builtin.mk)



Hi,

without manual intervention, math/lp_solve fails to build on Linux
(Ubuntu 10.04 i686 / Ubuntu 12.04 i686 ) because of missing "-ldl"
linker option:

    ===> Building for lp_solve-5.5.2.0
    => Substituting "dl" in lp_solve/ccc lpsolve55/ccc demo/ccc
    /tmp/cczhxie2.o: In function `load_BLAS':
    myblas.c:(.text+0x56d): undefined reference to `dlclose'
    myblas.c:(.text+0x613): undefined reference to `dlopen'


It does build properly when I add an "-ldl" option to the bmake invocation:

    bmake BUILDLINK_LIBS.dl=-ldl
or 
    bmake DL_LIBS=-ldl 


math/lp_solve/Makefile does some SUBST magic with dl, thereby removing
"-ldl" entirely:

math/lp_solve/Makefile:
     16 SUBST_CLASSES+=         dl
     17 SUBST_STAGE.dl=         pre-build
=>   18 SUBST_SED.dl+=          -e s,-ldl,${DL_LIBS:Q},g
     19 SUBST_SED.dl+=          -e s,^opts=.*,opts=\'${CFLAGS:Q}\',g
     20 SUBST_SED.dl+=          -e s,-fpic,-fPIC,g
     21 SUBST_FILES.dl+=        lp_solve/ccc
     22 SUBST_FILES.dl+=        lpsolve55/ccc
     23 SUBST_FILES.dl+=        demo/ccc

hard-coded "-ldl" occurances in the "ccc" compile scripts will be
substituted with ${DL_LIBS:Q}, which seems fair enough, but ${DL_LIBS} is
empty, at least on Linux.

${DL_LIBS} is set in
mk/dlopen.buildlink3.mk:
     51 DL_LIBS=        ${BUILDLINK_LIBS.dl}

${BUILDLINK_LIBS.dl} explicitly will not have "-ldl" (see comment):
mk/dlopen.builtin.mk:
     93 # No need to add this to BUILDLINK_LIBS.dl since most GNU configure
     94 # scripts already check for -ldl themselves.
     95 #
     96 BUILDLINK_LDADD.dl=     -ldl



Possible solution(s):

math/lp_solve/Makefile:
     18 SUBST_SED.dl+=          -e 's,-ldl,${BUILDLINK_LDADD.dl:Q} 
${DL_LIBS:Q},g'

or
mk/dlopen.buildlink3.mk:
     51 DL_LIBS=        ${BUILDLINK_LDADD.dl} ${BUILDLINK_LIBS.dl}


Regards
Matthias Ferdinand


Home | Main Index | Thread Index | Old Index