SDCC on Leopard 10.5.6 can't find library

Help
Martin
2009-03-11
2013-03-12
  • Martin
    Martin
    2009-03-11

    Hello Everyone,

    I am trying to get SDCC working on my mac.  I have downloaded the SDCC mac snapshot 20090309 and installed binaries in /usr/local/bin and libs, include, docs in /usr/local/share.
    I cannot get anything to compile without linker errors complaining about missing libraries, even when setting SDCC_LIB environment variable and using the -L command line option.  Oddly, my .hex file is created despite the missing libraries and warnings.  Can someone please tell me if I am making some obvious error?

    Thanks,

    Martin

    Below is my terminal output:

    skyhawk:test martin$ export SDCC_LIB=/usr/local/share/sdcc/lib
    skyhawk:test martin$ echo $SDCC_LIB
    /usr/local/share/sdcc/lib
    skyhawk:test martin$ ls $SDCC_LIB
    ds390            hc08            pic            small-stack-auto
    ds400            large            pic16            src
    gbz80            medium            small            z80
    skyhawk:test martin$ sdcc test.c
    ?ASlink-Warning-Couldn't find library 'mcs51'
    ?ASlink-Warning-Couldn't find library 'libsdcc'
    ?ASlink-Warning-Couldn't find library 'libint'
    ?ASlink-Warning-Couldn't find library 'liblong'
    ?ASlink-Warning-Couldn't find library 'libfloat'

    ?ASlink-Warning-Undefined Global '__mcs51_genRAMCLEAR' referenced by module 'test'

    ?ASlink-Warning-Undefined Global '__mcs51_genXINIT' referenced by module 'test'

    ?ASlink-Warning-Undefined Global '__mcs51_genXRAMCLEAR' referenced by module 'test'

    ?ASlink-Warning-Undefined Global '__sdcc_gsinit_startup' referenced by module 'test'
    skyhawk:test martin$ sdcc -L /usr/local/share/sdcc/lib/small/ test.c
    ?ASlink-Warning-Couldn't find library 'mcs51'
    ?ASlink-Warning-Couldn't find library 'libsdcc'
    ?ASlink-Warning-Couldn't find library 'libint'
    ?ASlink-Warning-Couldn't find library 'liblong'
    ?ASlink-Warning-Couldn't find library 'libfloat'

    ?ASlink-Warning-Undefined Global '__mcs51_genRAMCLEAR' referenced by module 'test'

    ?ASlink-Warning-Undefined Global '__mcs51_genXINIT' referenced by module 'test'

    ?ASlink-Warning-Undefined Global '__mcs51_genXRAMCLEAR' referenced by module 'test'

    ?ASlink-Warning-Undefined Global '__sdcc_gsinit_startup' referenced by module 'test'

     
    • Martin
      Martin
      2009-03-11

      Ok, so I answered my own stupid question.
      Although the lib/ folder and /small/large/etc subfolders are rwxr-xr-x, the actual library files are rwx------.  So a simple chmod -R 755 fixed everything.

       
      • Raphael Neider
        Raphael Neider
        2009-03-11

        I have the feeling that I read a similar problem report a few months ago.
        Maybe we should improve our install targets to `chmod ugo+rX,go-w' all files and to-be-created directories before or after copying them into their destination location. This would even allow paranoid ... errrr, no ... security/privace-aware root users with a umask of 077 to install the compiler/libraries/headers in a state useful to regular users. Additionally, regular users would more easily be able to share their installed sdcc with other users on the same machine when installing into their /home.

        On the other hand, opening files in ones home might not be desired. What is install supposed to do?!? I guess the regular install command sets file permissions to rwxr-xr-x (if I read the manpage correctly)?

        Any and all comments welcome.

        Best regards,
        Raphael