[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mingw-cross-env-list] fix for shared a52dec linking error: "multipl
From: |
Nagaev Boris |
Subject: |
Re: [Mingw-cross-env-list] fix for shared a52dec linking error: "multiple definition of xxx" |
Date: |
Sun, 6 Sep 2015 17:26:37 +0300 |
On Thu, May 14, 2015 at 4:46 AM, Hamza Alloush <address@hidden> wrote:
> while linking to build .libs/liba52-0.dll from these generated objects
> (.libs/bitstream.o .libs/imdct.o .libs/bit_allocate.o .libs/parse.o
> .libs/downmix.o), the linker complains about multiple defenitions in the C
> standard library(include/inttypes.h, include/string.h), included by
> <inttypes.h> and <string.h> from the source files.
>
> grep -r "inttypes.h" a52dec-0.7.4/liba52/
> a52dec-0.7.4/liba52/bitstream.c:#include <inttypes.h>
> a52dec-0.7.4/liba52/bit_allocate.c:#include <inttypes.h>
> a52dec-0.7.4/liba52/downmix.c:#include <inttypes.h>
> a52dec-0.7.4/liba52/parse.c:#include <inttypes.h>
> a52dec-0.7.4/liba52/imdct.c:#include <inttypes.h>
>
> grep -r "string.h" a52dec-0.7.4/liba52/
> a52dec-0.7.4/liba52/downmix.c:#include <string.h>
> a52dec-0.7.4/liba52/parse.c:#include <string.h>
>
> the reason is that in both of these standard library
> files(include/inttypes.h, include/string.h), an undefined conditional
> "#ifndef __CRT__NO_INLINE", will cause multiple definitions of the same
> functions, albiet an inline definition.
>
> what i have found to work was to pass pre-process directive to define this
> macro to "1" so i can skip this conditional.
>
> //a52dec.mk
>
> -- $(MAKE) -C '$(1)' -j '$(JOBS)' bin_PROGRAMS= sbin_PROGRAMS=
> noinst_PROGRAMS=
>
> ++$(MAKE) -C '$(1)' -j '$(JOBS)' bin_PROGRAMS= sbin_PROGRAMS=
> noinst_PROGRAMS= CFLAGS="${CFLAGS} -Wall -Difndef\ __CRT__NO_INLINE=1"
>
> i have tried passing directly to the linker to allow multiple definitions
> such as: LDFLAGS="${LDFLAGS -Xlinker -z -Xlinker muldef}" and the
> "-Wl,-z,muldef" equivelant, but looks like the
> "mxe/usr/bin/i686-w64-mingw32.shared-ld" seem to be lacking this feature
> compared to my native linux /usr/bin/ld linker. as i found from the --help to
> both.
>
> these are the nature of the errors given:
>
> .libs/bit_allocate.o: In function `imaxabs':
> /home/hamza/build/mxe/usr/i686-w64-mingw32.shared/include/inttypes.h:282:
> multiple definition of `imaxabs'
> .libs/bitstream.o:/home/hamza/build/mxe/usr/i686-w64-mingw32.shared/include/inttypes.h:282:
> first defined here
> .libs/parse.o: In function `imaxabs':
> /home/hamza/build/mxe/usr/i686-w64-mingw32.shared/include/inttypes.h:282:
> multiple definition of `imaxabs'
> .libs/bitstream.o:/home/hamza/build/mxe/usr/i686-w64-mingw32.shared/include/inttypes.h:282:
> first defined here
> .libs/downmix.o: In function `strncasecmp':
> /home/hamza/build/mxe/usr/i686-w64-mingw32.shared/include/string.h:106:
> multiple definition of `strncasecmp'
> .libs/parse.o:/home/hamza/build/mxe/usr/i686-w64-mingw32.shared/include/string.h:106:
> first defined here
>
> i will post the full log here on my pastebin:
> http://pastebin.com/keLp89L0
>
> i have also tried using the $(if $(BUILD_STATIC),) in the a52dec.mk to allow
> compatability for static builds, but i failed to so, i appreciate if someone
> handled can help me make this as a patch to a52dec.mk.
>
> Thanks
> Hamza
>
For the record, this issue was fixed by
commit 9b102b89566f92f5fb466edba6ad8f2265c0a99d
Author: Clark Li <address@hidden>
Date: Wed May 27 23:28:28 2015 +0930
Enable ISO C90 inline
Otherwise imaxabs() and other functions in _mingw.h will not
be inlined and produce link error
--
Best regards,
Boris Nagaev
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Mingw-cross-env-list] fix for shared a52dec linking error: "multiple definition of xxx",
Nagaev Boris <=