problems linking

Zombiedeth
2009-04-25
2013-06-06
  • Zombiedeth

    Zombiedeth - 2009-04-25

    I'm trying to compile MAME [http://www.mamedev.org/] using mingw-w64-bin_i686-mingw_20090420.zip and i'm stuck on some linker errors that i can't figure out. There are some undefined references but AFAICS using OBJDUMP these references are defined in the obj files in question.

    GNU C (GCC) version 4.4.0 20090326 (experimental) (x86_64-pc-mingw32)
            compiled by GNU C version 4.3.0 20080305 (alpha-testing) mingw-20080502,
    GMP version 4.2.2, MPFR version 2.4.1.
    GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
    Compiler executable checksum: de42dd7d004e4bd4da50666b5153ae23
    COMPILER_PATH=c:/mingw64/bin/../libexec/gcc/x86_64-pc-mingw32/4.4.0/;c:/mingw64/
    bin/../libexec/gcc/;c:/mingw64/bin/../lib/gcc/x86_64-pc-mingw32/4.4.0/../../../.
    ./x86_64-pc-mingw32/bin/
    LIBRARY_PATH=c:/mingw64/bin/../lib/gcc/x86_64-pc-mingw32/4.4.0/;c:/mingw64/bin/.
    ./lib/gcc/;c:/mingw64/bin/../lib/gcc/x86_64-pc-mingw32/4.4.0/../../../../x86_64-
    pc-mingw32/lib/
    COLLECT_GCC_OPTIONS='-DCRLF=3' '-DINLINE=static __inline__' '-DLSB_FIRST' '-DPTR
    64' '-DNDEBUG' '-DX64_WINDOWS_ABI' '-Dmain=utf8_main' '-DUNICODE' '-D_UNICODE' '
    -D_COM_interface=struct' '-DNATIVE_DRC=drcbe_x64_be_interface' '-DHAS_SAMPLES=1'
    '-DHAS_DAC=1' '-DHAS_DMADAC=1' '-DHAS_SPEAKER=1' '-DHAS_BEEP=1' '-DHAS_CDDA=1'
    '-DHAS_DISCRETE=1' '-DHAS_POKEY=1' '-DHAS_TIA=1' '-DHAS_ASTROCADE=1' '-DHAS_CEM3
    394=1' '-DHAS_BSMT2000=1' '-DHAS_ES5503=1' '-DHAS_ES5505=1' '-DHAS_ES5506=1' '-D
    HAS_ES8712=1' '-DHAS_GAELCO_CG1V=1' '-DHAS_GAELCO_GAE1=1' '-DHAS_CDP1869=1' '-DH
    AS_AY8910=1' '-DHAS_HC55516=1' '-DHAS_C6280=1' '-DHAS_ICS2115=1' '-DHAS_IREMGA20
    =1' '-DHAS_K005289=1' '-DHAS_K007232=1' '-DHAS_K051649=1' '-DHAS_K053260=1' '-DH
    AS_K054539=1' '-DHAS_NAMCO=1' '-DHAS_NAMCO_15XX=1' '-DHAS_NAMCO_CUS30=1' '-DHAS_
    NAMCO_52XX=1' '-DHAS_NAMCO_63701X=1' '-DHAS_C140=1' '-DHAS_C352=1' '-DHAS_DIGITA
    LKER=1' '-DHAS_NES=1' '-DHAS_UPD7759=1' '-DHAS_MSM5205=1' '-DHAS_MSM5232=1' '-DH
    AS_OKIM6376=1' '-DHAS_OKIM6295=1' '-DHAS_OKIM6258=1' '-DHAS_SAA1099=1' '-DHAS_QS
    OUND=1' '-DHAS_RF5C68=1' '-DHAS_RF5C400=1' '-DHAS_SEGAPCM=1' '-DHAS_MULTIPCM=1'
    '-DHAS_SCSP=1' '-DHAS_AICA=1' '-DHAS_ST0016=1' '-DHAS_NILE=1' '-DHAS_X1_010=1' '
    -DHAS_SID6581=0' '-DHAS_SID8580=0' '-DHAS_T6W28=1' '-DHAS_SNKWAVE=1' '-DHAS_PSXS
    PU=1' '-DHAS_SP0256=1' '-DHAS_SP0250=1' '-DHAS_S14001A=1' '-DHAS_SN76477=1' '-DH
    AS_SN76496=1' '-DHAS_TMS36XX=1' '-DHAS_TMS3615=1' '-DHAS_TMS5100=1' '-DHAS_TMS51
    10=1' '-DHAS_TMS5110A=1' '-DHAS_CD2801=1' '-DHAS_TMC0281=1' '-DHAS_CD2802=1' '-D
    HAS_M58817=1' '-DHAS_TMC0285=1' '-DHAS_TMS5200=1' '-DHAS_TMS5220=1' '-DHAS_VLM50
    30=1' '-DHAS_VOTRAX=0' '-DHAS_VRENDER0=1' '-DHAS_WAVE=1' '-DHAS_YM2151=1' '-DHAS
    _YM2203=1' '-DHAS_YM2413=1' '-DHAS_YM2608=1' '-DHAS_YM2610=1' '-DHAS_YM2610B=1'
    '-DHAS_YM2612=1' '-DHAS_YM3438=1' '-DHAS_YM3812=1' '-DHAS_YM3526=1' '-DHAS_Y8950
    =1' '-DHAS_YMF262=1' '-DHAS_YMF271=1' '-DHAS_YMF278B=1' '-DHAS_YMZ280B=1' '-pipe
    ' '-v' '-O3' '-fno-strict-aliasing' '-Wall' '-Wcast-align' '-Wundef' '-Wformat-s
    ecurity' '-Wwrite-strings' '-Wno-sign-compare' '-Isrc/mame' '-Isrc/mame/includes
    ' '-Iobj/windows/mame/mame/layout' '-Isrc/emu' '-Iobj/windows/mame/emu' '-Iobj/w
    indows/mame/emu/layout' '-Isrc/lib/util' '-Isrc/osd' '-Isrc/osd/windows' '-Isrc/
    lib/expat' '-Isrc/lib/zlib' '-include' 'src/osd/windows/winprefix.h' '-DDIRECTIN
    PUT_VERSION=0x0800' '-DDIRECT3D_VERSION=0x0900' '-std=gnu89' '-Wpointer-arith' '
    -Wbad-function-cast' '-Wstrict-prototypes' '-Wdeclaration-after-statement' '-c'
    '-o' 'obj/windows/mame/version.o' '-mtune=generic'
    Linking mame.exe...
    c:/mingw64/bin/../lib/gcc/x86_64-pc-mingw32/4.4.0/../../../../x86_64-pc-mingw32/
    lib/libmingw32.a(lib64_libmingw32_a-mingw_helpers.o): warning: common of `__dyn_
    tls_init_callback' overridden by definition
    c:/mingw64/bin/../lib/gcc/x86_64-pc-mingw32/4.4.0/../../../../x86_64-pc-mingw32/
    lib/libmingw32.a(lib64_libmingw32_a-tlssup.o): warning: defined here
    obj/windows/mame/libemu.a(inptport.o):inptport.c:(.text+0x4b2e): undefined refer
    ence to `osd_customize_input_type_list'
    obj/windows/mame/libemu.a(mame.o):mame.c:(.text+0x1da6): undefined reference to
    `osd_init'
    obj/windows/mame/libemu.a(video.o):video.c:(.text+0xdcae): undefined reference t
    o `osd_update'
    obj/windows/mame/libemu.a(video.o):video.c:(.text+0xdd1f): undefined reference t
    o `osd_update'
    obj/windows/mame/libemu.a(video.o):video.c:(.text+0xdf27): undefined reference t
    o `osd_update'
    obj/windows/mame/libemu.a(video.o):video.c:(.text+0xdfe6): undefined reference t
    o `osd_update'
    obj/windows/mame/libemu.a(sound.o):sound.c:(.text+0x9e3): undefined reference to
    `osd_update_audio_stream'
    obj/windows/mame/libemu.a(sound.o):sound.c:(.text+0x1189): undefined reference t
    o `osd_set_mastervolume'
    obj/windows/mame/libemu.a(sound.o):sound.c:(.text+0x3d1): undefined reference to
    `osd_set_mastervolume'
    obj/windows/mame/libemu.a(sound.o):sound.c:(.text+0x3f9): undefined reference to
    `osd_set_mastervolume'
    obj/windows/mame/libemu.a(sound.o):sound.c:(.text+0x41e): undefined reference to
    `osd_set_mastervolume'
    obj/windows/mame/libemu.a(sound.o):sound.c:(.text+0x449): undefined reference to
    `osd_set_mastervolume'
    obj/windows/mame/libemu.a(sound.o):sound.c:(.text+0x46e): more undefined referen
    ces to `osd_set_mastervolume' follow
    obj/windows/mame/libemu.a(debugcpu.o):debugcpu.c:(.text+0x309b): undefined refer
    ence to `osd_wait_for_debugger'
    obj/windows/mame/libocore.a(main.o):main.c:(.text+0xa4): undefined reference to
    `utf8_main'
    collect2: ld returned 1 exit status
    make: *** [mame.exe] Error 1

     
    • Kai Tietz

      Kai Tietz - 2009-04-25

      Well, these kind of failures are mostly reasoned by wrong order of link objects and libraries. Possibly you have to change the order of the libaries and objects, so that it works.

      Cheers,
      Kai

       
    • Zombiedeth

      Zombiedeth - 2009-04-25

      Changing the libraries link order of libemu.a libosd.a does get rid of the other errors but creates a new error that does seem like it can be worked around.

      Linking mame.exe...
      c:/mingw64/bin/../lib/gcc/x86_64-pc-mingw32/4.4.0/../../../../x86_64-pc-mingw32/
      lib/libmingw32.a(lib64_libmingw32_a-mingw_helpers.o): warning: common of `__dyn_
      tls_init_callback' overridden by definition
      c:/mingw64/bin/../lib/gcc/x86_64-pc-mingw32/4.4.0/../../../../x86_64-pc-mingw32/
      lib/libmingw32.a(lib64_libmingw32_a-tlssup.o): warning: defined here
      obj/windows/mame/libosd.a(winmain.o):winmain.c:(.text+0x3b7): undefined referenc
      e to `cli_execute'
      collect2: ld returned 1 exit status
      make: *** [mame.exe] Error 1

       
    • Zombiedeth

      Zombiedeth - 2009-04-25

      I meant to say it doesn't seem like it can be worked around.

       
      • Kai Tietz

        Kai Tietz - 2009-04-25

        ok, I'll take a look on that

        Cheers,
        Kai

         
    • Kai Tietz

      Kai Tietz - 2009-04-25

      Well, as far as I can see is the issue you have, that the libmingwex.a library is linked multiple times.
      In general gcc adds this library by default. So please check you linker options, if you have possibly added this library twice.

      Cheers,
      Kai

       
      • Kai Tietz

        Kai Tietz - 2009-04-25

        Ups, I meant of course libmingw.a

        Sorry,
        Kai

         
        • Zombiedeth

          Zombiedeth - 2009-04-25

          there are no occurrences of mingw being manually linked that i can see.

          source for the makefile can be browsed here:
          http://mamedev.org/source/src/osd/windows/windows.mak.html

           
          • Kai Tietz

            Kai Tietz - 2009-04-26

            Thank you for reporting this, there was a typo in our startup code. It is fixed by rev 820.

            Best regards,
            Kai

             
            • Zombiedeth

              Zombiedeth - 2009-04-26

              Cool i'm really looking forward to the next release. With any luck i'll come back with good news and you'll be able to add a new success story to your front page.

               
            • Zombiedeth

              Zombiedeth - 2009-05-29

              The latest build mingw-w64_x86-64_mingw32_4.4.0-1.zip does get rid of the 2 warnings but the undefined referenc
              e errors still remain.

               
              • NightStrike

                NightStrike - 2009-05-29

                I would recommend using the daily snapshot of 4.5.0.

                 
                • Zombiedeth

                  Zombiedeth - 2009-05-29

                  I would but mingw-w64-bin_i686-mingw_20090420.zip is the latest Windows build and i've already tested on it.

                   
                  • NightStrike

                    NightStrike - 2009-05-29

                    Yes, you're right, sorry.  That'll be fixed soon.

                     
                • Justin Kerk

                  Justin Kerk - 2009-06-14

                  Unfortunately, I tried using the 4.5.0 snapshot and now MAME causes an internal compiler error: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40364

                   
  • Zombiedeth

    Zombiedeth - 2009-10-13

    With the release of mingw-w64-1.0-bin_i686-mingw_20091012.zip MAME successfully compiles and links and the resulting EXE does does run. There is a problem outputting to Direct3D 9 though i get an error "Unable to create the Direct3D device (8876086C)". I'm not sure if this is a mingw-w64 issue but it would seem to be since MSVC 64-bit builds work fine with Direct3D 9.

     
  • Kai Tietz

    Kai Tietz - 2009-10-13

    Hello Zombiedeth,

    Nice to hear the 4.4.2 Version 1.0 works for you without issues in compiler. What is exactly the issue you have about Direct3D 9? Could it be reasoned by a wrong GUID for it?
    If you could provide some more detailed information about this issue, we can try to help.

    Kai

     
  • Zombiedeth

    Zombiedeth - 2009-10-13

    To give some background MAME at runtime can be set to use any of 3 video output methods GDI, DirectDraw, or  Direct3D. the other 2 work fine but Direct3D fails and the program exits. If it is a problem of wrong GUID where should i start looking for the proper value required?

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks