mingw-cross-env-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mingw-cross-env-list] fix for shared a52dec linking error: "multiple de


From: Hamza Alloush
Subject: [Mingw-cross-env-list] fix for shared a52dec linking error: "multiple definition of xxx"
Date: Thu, 14 May 2015 01:46:47 +0000

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
                                          


reply via email to

[Prev in Thread] Current Thread [Next in Thread]