SDCC_LIB Search

thornd
2011-03-01
2013-03-12
  • thornd

    thornd - 2011-03-01

    I upgraded to SDCC on Windows (mcs51) to 3.0.0 #6037  from an earlier version and found the library search had changed.  In the previous version the model was appended to what was specified in the the SDCC_LIB environment variable as per the online documentation here: http://sdcc.sourceforge.net/doc/sdccman.html/node13.html.  This appears not to be the case in the current version (see sdccmain.c: setLibPath()).  Feature or Bug?  (I did a forum search on SDCC_LIB and didn't turn up anything so forgive me if this is well known behavior).

    If Feature I would suggest reverting back or adding a new environment variable that is model sensitive.  I maintain two sets of libraries for small and small-stack-auto models and want to be able to change the models without messing with the tool chain (I use the SiLabs IDE).  I was able to change the code in sdccmain.c pretty easily to revert but would rather not use a customized version.

     
  • Borut Ražem

    Borut Ražem - 2011-03-01

    You are right, this is sdcc 3.0 incompatibility with sdcc 2.9 and older versions and the documentation was not updated. My personal opinion is that the current behavior is correct: SDCC_LIB should point directly to the directory containing the library files, same as -L command line option, but for the compatibility sake I propose the following (actually you already proposed it):
    - revert the SDCC_LIB behavior, so that it points to the directory containing model subdirectories
    - introduce SDCC_MODEL_LIB environment variable,  which should point to the model directory (same as current implementation of SDCC_LIB)

    The new priority for library search paths would be:
    1. -L dir
    2. $SDCC_MODULE_LIB
    3. $SDCC_LIB/<model>
    4. $SDCC_HOME/$PREFIX2DATA_DIR/$LIB_DIR_SUFFIX/<model>
    5. path(argv)/$BIN2DATADIR/$LIB_DIR_SUFFIX/<model>
    6. $DATADIR/non-free/$LIB_DIR_SUFFIX/<model>
    7. $SDCC_HOME/$PREFIX2DATA_DIR/non-free/$LIB_DIR_SUFFIX/<model>
    8. path(argv)/$BIN2DATADIR/non-free/$LIB_DIR_SUFFIX/<model>
    9. $DATADIR/non-free/$LIB_DIR_SUFFIX/<model>

    Does it make sense?

    Borut

     
  • thornd

    thornd - 2011-03-02

    Works for me.  Thanks!

     
  • Borut Ražem

    Borut Ražem - 2011-03-02

    The SDCC_LIB search was totally broken, so the the libraries was never searched in $SDCC_LIB directory.
    I fixed it in svn revision #6253: I used only SDCC_LIB environment variable and the priority for library search paths is:
    1. -L dir
    2. $SDCC_LIB/<model>
    3. $SDCC_LIB
    4. $SDCC_HOME/$PREFIX2DATA_DIR/$LIB_DIR_SUFFIX/<model>
    5. path(argv)/$BIN2DATADIR/$LIB_DIR_SUFFIX/<model>
    6. $DATADIR/non-free/$LIB_DIR_SUFFIX/<model>
    7. $SDCC_HOME/$PREFIX2DATA_DIR/non-free/$LIB_DIR_SUFFIX/<model>
    8. path(argv)/$BIN2DATADIR/non-free/$LIB_DIR_SUFFIX/<model>
    9. $DATADIR/non-free/$LIB_DIR_SUFFIX/<model>

    thornd, can you please verify if it works for you?

    Borut

     
  • thornd

    thornd - 2011-03-02

    Sure.  Should be able to get to it today. 

     
  • thornd

    thornd - 2011-03-02

    Built and tried out 6253 and it appears to work properly now.  Thanks.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks