1 Reply Latest reply: May 12, 2013 5:29 PM by Steve.Clamage-Oracle RSS

    compiler/linker failure: ld: fatal: symbol 'XXXXX' is multiply-defined

      Hello all,

      I'm trying to compile Wine 1.3.13 on Solaris 11 x86 using Solaris Studio 12.3, but am running into the following linker failure:
      /opt/solarisstudio12.3/bin/cc -shared -Wl,-soname,libwine.so.1 c_037.o c_10000.o c_10006.o c_10007.o c_10029.o c_1006.o c_10079.o c_10081.o c_1026.o c_1250.o c_1251.o c_1252.o c_1253.o c_1254.o c_1255.o c_1256.o c_1257.o c_1258.o c_1361.o c_20127.o c_20866.o c_20932.o c_21866.o c_28591.o c_28592.o c_28593.o c_28594.o c_28595.o c_28596.o c_28597.o c_28598.o c_28599.o c_28600.o c_28603.o c_28604.o c_28605.o c_28606.o c_424.o c_437.o c_500.o c_737.o c_775.o c_850.o c_852.o c_855.o c_856.o c_857.o c_860.o c_861.o c_862.o c_863.o c_864.o c_865.o c_866.o c_869.o c_874.o c_875.o c_878.o c_932.o c_936.o c_949.o c_950.o casemap.o collation.o compose.o config.o cptable.o debug.o fold.o ldt.o loader.o mbtowc.o mmap.o port.o sortkey.o string.o utf8.o wctomb.o wctype.o version.o ../../libs/port/libwine_port.a -lsocket -lnsl -o libwine.so.1.0
      ld: fatal: symbol 'global_asm0' is multiply-defined:
           (file ldt.o type=FUNC; file port.o type=FUNC);
      ld: fatal: file processing errors. No output written to libwine.so.1.0
      *** Error code 2
      make: Fatal error: Command failed for target `libwine.so.1.0'
      Current working directory /export/aux/winaux/downloads/wine-1.3.13/libs/wine
      *** Error code 1
      The following command caused the error:
      cd libs/wine && /usr/bin/make
      make: Fatal error: Command failed for target `libs/wine'

      BUILD FAILED (exit value 1, total time: 8s)

      I've sifted through the code and the best I figure out is that it's being caused due to the following code blocks:
      __ASM_GLOBAL_FUNC( wine_get_cs, "movw %cs,%ax\n\tret" )
      __ASM_GLOBAL_FUNC( wine_get_ds, "movw %ds,%ax\n\tret" )
      __ASM_GLOBAL_FUNC( wine_get_es, "movw %es,%ax\n\tret" )
      __ASM_GLOBAL_FUNC( wine_get_fs, "movw %fs,%ax\n\tret" )
      __ASM_GLOBAL_FUNC( wine_get_gs, "movw %gs,%ax\n\tret" )
      __ASM_GLOBAL_FUNC( wine_get_ss, "movw %ss,%ax\n\tret" )
      __ASM_GLOBAL_FUNC( wine_set_fs, "movl 4(%esp),%eax\n\tmovw %ax,%fs\n\tret" )
      __ASM_GLOBAL_FUNC( wine_set_gs, "movl 4(%esp),%eax\n\tmovw %ax,%gs\n\tret" )

      __ASM_GLOBAL_FUNC( wine_call_on_stack,
      "pushl %ebp\n\t"
      __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
      __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
      "pushl %esi\n\t"
      __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
      __ASM_CFI(".cfi_rel_offset %esi,0\n\t")
      "movl %esp,%esi\n\t"
      __ASM_CFI(".cfi_def_cfa_register %esi\n\t")
      "movl 12(%esp),%ecx\n\t" /* func */
      "movl 16(%esp),%edx\n\t" /* arg */
      "movl 20(%esp),%eax\n\t" /* stack */
      "andl $~15,%eax\n\t"
      "subl $12,%eax\n\t"
      "movl %eax,%esp\n\t"
      "pushl %edx\n\t"
      "xorl %ebp,%ebp\n\t"
      "call *%ecx\n\t"
      "movl %esi,%esp\n\t"
      "popl %esi\n\t"
      __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
      __ASM_CFI(".cfi_same_value %esi\n\t")
      "popl %ebp\n\t"
      __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
      __ASM_CFI(".cfi_same_value %ebp\n\t")
      "ret" )

      __ASM_GLOBAL_FUNC is defined in config.h as:
      #define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(name,"",code)

      and __ASM_DEFINE_FUNC is defined just above it as:
      #define __ASM_DEFINE_FUNC(name,suffix,code) asm(".text\n\t.align 4\n\t.globl " #name suffix "\n\t.type " #name suffix ",@function\n" #name suffix ":\n\t" code "\n\t.previous");

      Anyone have any ideas how to work around this? Thanks.

        • 1. Re: compiler/linker failure: ld: fatal: symbol 'XXXXX' is multiply-defined
          The __ASM_GLOBAL_FUNC macro defines an assembler function whose name is the first argument of the macro. None of the macro invocation you show define a function called global_asm0, so the problem is somewhere else.

          Probably the name global_asm0 is a concatenation of "global", "asm" and a number, so searching for global_asm0 probably won't succeed. I would look for "global" and see what turns up. If nothing, try "asm".

          The next question is why the function is defined more than once by Studio, and presumably not by other compilers. With Open Source software, it is usually the case that conditional code either does not consider Studio C++ a possible compiler, or if it does, it expects only older version numbers. Either way, the compiler is "none of the above", and some code turns up missing or incorrect.

          Look in config files for code conditionalized on compilers.
          For Stuido C, the macro that defines the version number is __SUNPRO_C, and for Studio 12.3 (C 5.12), its value is 0x5120.
          For Stuido C++, the macro that defines the version number is __SUNPRO_CC, and for Studio 12.3 (C++ 5.12), its value is 0x5120.