Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Linker problem in Windows

sjblair2
2005-07-30
2013-03-12
  • sjblair2
    sjblair2
    2005-07-30

    // Here's my test program...

    #include <string.h>

    char s[10];

    void main(void) {

        strcpy(s, "hello");
    }

    REM Here's the batch file...
    SDCC -c test.c
    SDCC test.rel

    And here are the errors...

    C:\Data\Engineering\SDCC\TELELINK>SDCC -c test.c

    C:\Data\Engineering\SDCC\TELELINK>SDCC test.rel
    ?Aslink-Warning-Definition of public symbol '__mcs51_genRAMCLEAR' found more tha
    n once:
       Library: 'C:\Progra~1\SDCC\lib\small/mcs51.lib', Module: 'crtclear.rel'
       Library: 'C:\Program Files\SDCC\bin\..\lib\small/mcs51.lib', Module: 'crtclea
    r.rel'
    ?Aslink-Warning-Definition of public symbol '__mcs51_genXINIT' found more than o
    nce:
       Library: 'C:\Progra~1\SDCC\lib\small/mcs51.lib', Module: 'crtxinit.rel'
       Library: 'C:\Program Files\SDCC\bin\..\lib\small/mcs51.lib', Module: 'crtxini
    t.rel'
    ?Aslink-Warning-Definition of public symbol '__mcs51_genXRAMCLEAR' found more th
    an once:
       Library: 'C:\Progra~1\SDCC\lib\small/mcs51.lib', Module: 'crtxclear.rel'
       Library: 'C:\Program Files\SDCC\bin\..\lib\small/mcs51.lib', Module: 'crtxcle
    ar.rel'
    ?Aslink-Warning-Definition of public symbol '__XPAGE' found more than once:
       Library: 'C:\Progra~1\SDCC\lib\small/mcs51.lib', Module: 'crtpagesfr.rel'
       Library: 'C:\Program Files\SDCC\bin\..\lib\small/mcs51.lib', Module: 'crtpage
    sfr.rel'
    ?Aslink-Warning-Definition of public symbol '__sdcc_gsinit_startup' found more t
    han once:
       Library: 'C:\Progra~1\SDCC\lib\small/mcs51.lib', Module: 'crtstart.rel'
       Library: 'C:\Program Files\SDCC\bin\..\lib\small/mcs51.lib', Module: 'crtstar
    t.rel'
    ?Aslink-Warning-Definition of public symbol '__sdcc_external_startup' found more
    than once:
       Library: 'C:\Progra~1\SDCC\lib\small/libsdcc.lib', Module: '_startup'
       Library: 'C:\Program Files\SDCC\bin\..\lib\small/libsdcc.lib', Module: '_star
    tup'
    C:\Data\Engineering\SDCC\TELELINK>

    Any help is appreciated.

    sjblair2

     
    • For some reason the two forms of the same library path are passed to sdcc.  Can you please send the output of these two commands?

      set | find "SDCC"

      and

      sdcc -V test.c

      Jesus

       
      • sjblair2
        sjblair2
        2005-07-31

        C:\Data\Engineering\SDCC\TELELINK>set | find "SDCC"
        find: SDCC: No such file or directory

        C:\Data\Engineering\SDCC\TELELINK>cd\

        C:\&gt;set | find "SDCC"
        find: SDCC: No such file or directory

        C:\&gt;sdcc -v test.c
        SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.5.2 #1
        072 (Jul 30 2005) (MINGW32)

        C:\&gt;

        Thanks for your time...
        SJB

         
    • sjblair2
      sjblair2
      2005-07-31

      With a capital V it comes back with:

      C:\&gt;sdcc -V test.c
      -:0: error 4: 'fopen' failed on file 'test.c'

      SJB

       
    • Ok, lets try again.  Could you please type in a DOS command window

      C:\&gt;sdcc --print-search-dirs

      and then

      C:\&gt;set

      and send the output?

      Jesus

       
    • sjblair2
      sjblair2
      2005-07-31

      While at the proper directory:

      C:\Data\Engineering\SDCC\TELELINK>sdcc -V test.c
      + C:\PROGRA~1\SDCC\bin\sdcpp.exe -nostdinc -Wall -std=c99 -DSDCC=1 -DSDCC_MODEL_
      SMALL -DSDCC_mcs51 -D__mcs51 -I"C:\Program Files\SDCC\bin\..\include\mcs51" -I"C
      :\Program Files\SDCC\bin\..\include"  "test.c"
      + C:\PROGRA~1\SDCC\bin\asx8051.exe -plosgff "test.asm"
      + C:\PROGRA~1\SDCC\bin\aslink.exe -nf "test.lnk"

      C:\Data\Engineering\SDCC\TELELINK>

      SJB

       
    • sjblair2
      sjblair2
      2005-07-31

      C:\&gt;sdcc --print-search-dirs
      programs:
      C:\Program Files\SDCC\bin
      datadir:
      C:\Program Files\SDCC\bin\..
      includedir:
      C:\Program Files\SDCC\bin\..\include\mcs51
      C:\Program Files\SDCC\bin\..\include
      libdir:
      C:\Program Files\SDCC\bin\..\lib

      C:\&gt;set
      $MODELSIM=C:\Modeltech_XE\ ALLUSERSPROFILE=C:\Documents and Settings\All Users
      APPDATA=C:\Documents and Settings\Administrator\Application Data
      CommonProgramFiles=C:\Program Files\Common Files
      COMPUTERNAME=SJB4
      ComSpec=C:\WINNT\system32\cmd.exe
      DiskeeperIcon=C:\Program Files\Executive Software\DiskeeperWorkstation\ HOMEDRIVE=C:
      HOMEPATH=\Documents and Settings\Administrator
      include=C:\Program Files\Microsoft Visual Studio\VC98\atl\include;C:\Program Fil
      es\Microsoft Visual Studio\VC98\mfc\include;C:\Program Files\Microsoft Visual St
      udio\VC98\include
      lib=C:\Program Files\Microsoft Visual Studio\VC98\mfc\lib;C:\Program Files\Micro
      soft Visual Studio\VC98\lib
      LMC_HOME=c:\Xilinx\smartmodel\nt\installed_nt
      LM_LICENSE_FILE=C:\Modeltech_XE\win32xoem\license.dat
      LOGONSERVER=\\SJB4
      MSDevDir=C:\Program Files\Microsoft Visual Studio\Common\MSDev98
      NUMBER_OF_PROCESSORS=2
      OS=Windows_NT
      Os2LibPath=C:\WINNT\system32\os2\dll;
      Path=C:\Tcl\bin;C:\WinAVR\bin;C:\WinAVR\utils\bin;C:\WINNT\system32;C:\WINNT;C:\ WINNT\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Progr
      am Files\Executive Software\DiskeeperWorkstation\;C:\Program Files\Microsoft SQL
      Server\80\Tools\BINN;c:\Xilinx\bin\nt;C:\Program Files\Common Files\Autodesk Sh
      ared\;c:\mc;c:\mc\include;C:\Program Files\Microsoft Visual Studio\Common\Tools\ WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Fil
      es\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio
      \VC98\bin;c:\modeltech_xe\win32xoem;C:\Program Files\CVSNT\;C:\Program Files\SDC
      C\bin
      PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.tcl
      PROCESSOR_ARCHITECTURE=x86
      PROCESSOR_IDENTIFIER=x86 Family 15 Model 3 Stepping 3, GenuineIntel
      PROCESSOR_LEVEL=15
      PROCESSOR_REVISION=0303
      ProgramFiles=C:\Program Files
      PROMPT=$P$G
      SystemDrive=C:
      SystemRoot=C:\WINNT
      TEMP=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp
      TMP=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp
      tvdumpflags=10
      USERDOMAIN=SJB4
      USERNAME=Administrator
      USERPROFILE=C:\Documents and Settings\Administrator
      windir=%SystemRoot%
      XILINX=c:\Xilinx

      C:\&gt;

      SJB

       
    • Ok, last time you compiled and linked without problems:

      sdcc -V test.c

      Please repeat to the original experiment:

      SDCC -c test.c
      SDCC test.rel

      and type the resulting linker script:

      type test.lnk

       
    • sjblair2
      sjblair2
      2005-07-31

      C:\Data\Engineering\SDCC\TELELINK>SDCC -c test.c

      C:\Data\Engineering\SDCC\TELELINK>SDCC test.rel
      C:\Data\Engineering\SDCC\TELELINK>type test.lnk
      -myuxi
      -Y
      -b HOME = 0x0000
      -b ISEG = 0x0080
      -b BSEG = 0x0000
      -k C:\Program Files\SDCC\bin\..\lib\small
      -l mcs51
      -l libsdcc
      -l libint
      -l liblong
      -l libfloat
      test.rel

      -e

      C:\Data\Engineering\SDCC\TELELINK>

      Steve

       
    • sjblair2
      sjblair2
      2005-07-31

      I tried it again and got:

      C:\Data\Engineering\SDCC\TELELINK>SDCC -c test.c

      C:\Data\Engineering\SDCC\TELELINK>SDCC test.rel
      ?Aslink-Warning-Definition of public symbol '_strcpy' found more than once:
         Library: 'C:\Progra~1\SDCC\lib\small/libsdcc.lib', Module: '_strcpy'
         Library: 'C:\Program Files\SDCC\bin\..\lib\small/libsdcc.lib', Module: '_strc
      py'
      ?Aslink-Warning-Definition of public symbol '__mcs51_genRAMCLEAR' found more tha
      n once:
         Library: 'C:\Progra~1\SDCC\lib\small/mcs51.lib', Module: 'crtclear.rel'
         Library: 'C:\Program Files\SDCC\bin\..\lib\small/mcs51.lib', Module: 'crtclea
      r.rel'
      ?Aslink-Warning-Definition of public symbol '__mcs51_genXINIT' found more than o
      nce:
         Library: 'C:\Progra~1\SDCC\lib\small/mcs51.lib', Module: 'crtxinit.rel'
         Library: 'C:\Program Files\SDCC\bin\..\lib\small/mcs51.lib', Module: 'crtxini
      t.rel'
      ?Aslink-Warning-Definition of public symbol '__gptrput' found more than once:
         Library: 'C:\Progra~1\SDCC\lib\small/libsdcc.lib', Module: '_gptrput'
         Library: 'C:\Program Files\SDCC\bin\..\lib\small/libsdcc.lib', Module: '_gptr
      put'
      ?Aslink-Warning-Definition of public symbol '__mcs51_genXRAMCLEAR' found more th
      an once:
         Library: 'C:\Progra~1\SDCC\lib\small/mcs51.lib', Module: 'crtxclear.rel'
         Library: 'C:\Program Files\SDCC\bin\..\lib\small/mcs51.lib', Module: 'crtxcle
      ar.rel'
      ?Aslink-Warning-Definition of public symbol '__XPAGE' found more than once:
         Library: 'C:\Progra~1\SDCC\lib\small/mcs51.lib', Module: 'crtpagesfr.rel'
         Library: 'C:\Program Files\SDCC\bin\..\lib\small/mcs51.lib', Module: 'crtpage
      sfr.rel'
      ?Aslink-Warning-Definition of public symbol '__sdcc_gsinit_startup' found more t
      han once:
         Library: 'C:\Progra~1\SDCC\lib\small/mcs51.lib', Module: 'crtstart.rel'
         Library: 'C:\Program Files\SDCC\bin\..\lib\small/mcs51.lib', Module: 'crtstar
      t.rel'
      ?Aslink-Warning-Definition of public symbol '__gptrget' found more than once:
         Library: 'C:\Progra~1\SDCC\lib\small/libsdcc.lib', Module: '_gptrget'
         Library: 'C:\Program Files\SDCC\bin\..\lib\small/libsdcc.lib', Module: '_gptr
      get'
      ?Aslink-Warning-Definition of public symbol '__sdcc_external_startup' found more
      than once:
         Library: 'C:\Progra~1\SDCC\lib\small/libsdcc.lib', Module: '_startup'
         Library: 'C:\Program Files\SDCC\bin\..\lib\small/libsdcc.lib', Module: '_star
      tup'
      C:\Data\Engineering\SDCC\TELELINK>type test.lnk
      -myuxi
      -Y
      -b HOME = 0x0000
      -b ISEG = 0x0080
      -b BSEG = 0x0000
      -k C:\Progra~1\SDCC\lib\small
      -k C:\Progra~1\SDCC\bin\lib\small
      -k C:\Program Files\SDCC\bin\..\lib\small
      -l mcs51
      -l libsdcc
      -l libint
      -l liblong
      -l libfloat
      test.rel

      -e

      C:\Data\Engineering\SDCC\TELELINK>

       
    • sjblair2
      sjblair2
      2005-08-01

      It seems that the test.c program will build just fine when I first turn on the computer.

      Once I try to build my monster program nothing will build after that program errors.

      It seems like a problem with SDCC.

      Steve

       
    • Are you setting the environment variable SDCC_LIB at some point during build?  After you encounter the problem can you try, once again

      C:>set | find "SDCC"

      to see if SDCC_LIB is set?

       
      • sjblair2
        sjblair2
        2005-08-01

        Here's my batch file:

        @ECHO OFF
        @REM  Purpose:  Compiles the TeleLink program
        ECHO+
        ECHO SDCC 8051 compiling %1
        REM ----------------------

        REM ---------------------------------------------
        REM   Set up environment variables for SDCC.
        REM ---------------------------------------------
        SET TEMP=c:\temp
        SET SDCC_HOME=C:\Progra~1\SDCC\bin
        SET SDCC_INCLUDE=C:\Progra~1\SDCC\include
        SET SDCC_LIB=C:\Progra~1\SDCC\lib
        SET download=no

        REM ----------------------
        REM Do the deed...
        REM ECHO --- clean up old files
        REM IF exist *.HEX DEL *.HEX

        ECHO --- C compiler
        SDCC -c --model-large dw10.c
        SDCC -c --model-large general.c
        SDCC -c --model-large hcs.c
        SDCC -c --model-large int0.c
        SDCC -c --model-large int1.c
        SDCC -c --model-large m957.c
        SDCC -c --model-large m982.c
        SDCC -c --model-large moncall.c
        REM SDCC -c MT8888.c
        SDCC -c --model-large phone.c
        SDCC -c --model-large telelink.c
        SDCC telelink.rel int0.rel int1.rel m957.rel m982.rel moncall.rel general.rel hcs.rel dw10.rel

        IF ERRORLEVEL 1 ECHO Error in SDCC
        IF ERRORLEVEL 1 GOTO errors
        GOTO done

        :errors
        ECHO *** Got problems, mon...
        :done

        =====================================

        I'm not getting anything back from set | find "SDCC"

        Steve

         
    • Remove the line from the batch file where SDCC_LIB is set and the problem should go away:

      [...]
      SET SDCC_INCLUDE=C:\Progra~1\SDCC\include
      REM SET SDCC_LIB=C:\Progra~1\SDCC\lib
      SET download=no
      [...]

      Jesus

       
    • sjblair2
      sjblair2
      2005-08-02

      This rid me of the more obscure messages but I'm still getting:

      C:\Data\Engineering\SDCC\TELELINK>z

      SDCC 8051 compiling
      --- C compiler
      int0.c:66: warning 110: conditional flow changed by optimizer: so said EVELYN th
      e modified DOG
      int0.c:66: warning 110: conditional flow changed by optimizer: so said EVELYN th
      e modified DOG
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "_strcpy".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "_atoi".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "_strcat".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "_gptrput".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "_mulint".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "sprintf".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "_isupper".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "puts".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "_bp".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "vprintf".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "printf_large".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "_strlen".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "_gptrget".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "_isdigit".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "_startup".
      ?ASlink-Warning-Conflicting sdcc options:
         "-mmcs51 --model-large" in module "telelink" and
         "-mmcs51 --model-small" in module "_islower".

      Steve

       
    • Erik Petrich
      Erik Petrich
      2005-08-02

      If you are using --model-large, you'll also need to use it when linking everything together so that the correct library is used:

      SDCC --model-large telelink.rel int0.rel int1.rel m957.rel m982.rel moncall.rel general.rel hcs.rel dw10.rel

      The "conditional flow changed by optimizer..." message indicates that the compiler discovered that it was able to fully evaluate a conditional expression at compile tile and so replaced it with an unconditional branch. If this was unexpected, you may have forgotten a "volatile" qualifier somewhere.

       
    • For the second problem, you need to link using the large libraries:

      SDCC --model-large telelink.rel int0.rel int1.rel m957.rel m982.rel moncall.rel general.rel hcs.rel dw10.rel

      For the first one, check this message in this forum

      https://sourceforge.net/forum/message.php?msg_id=1999064

       
    • sjblair2
      sjblair2
      2005-08-02

      The last two answers fixed the problem.

      Thank you very much gentlemen.

      Steve

       
  • erik malund
    erik malund
    2010-05-27

    when compiling many files therogh a .bat setup it is quite a nuisance all the "OK" stuff thet clutters the screen.  It would be a GREAT improvement if (a simple task for those that know how to do such) to make SDCC return nonzero ERRORLEVEL if errors or warnings happened.  That way it would be possible to suppress the output from good compiles.

    Erik

     
  • Maarten Brock
    Maarten Brock
    2010-05-28

    What "OK" stuff? AFAIK sdcc is totally silent if everything works ok unless you use -V or -verbose. All errors set ERRORLEVEL and warnings only do when -Werror is used.