[LLVMdev] clang error: multiple definition of `gnu_dev_*'

Abhishek Kulkarni abbyzcool at gmail.com
Sun Dec 13 20:36:30 PST 2009

On Sun, Dec 13, 2009 at 10:42 PM, Andrew Jeffery <andrew at aj.id.au> wrote:
> On 14/12/09 13:57, Abhishek Kulkarni wrote:
>> When trying to link more than one object files compiled with clang, I run into
>> errors of the following type:
>> $ clang -fblocks -g -I$HOME/opt/include -L$HOME/opt/lib/ -o helloworld
>> helloworld.c hello.o world.o -lBlocksRuntime
>> world.o: In function `gnu_dev_major':
>> /usr/include/sys/sysmacros.h:43: multiple definition of `gnu_dev_major'
>> hello.o:/usr/include/sys/sysmacros.h:43: first defined here
>> world.o: In function `gnu_dev_minor':
>> /usr/include/sys/sysmacros.h:49: multiple definition of `gnu_dev_minor'
>> hello.o:/usr/include/sys/sysmacros.h:49: first defined here
>> world.o: In function `gnu_dev_makedev':
>> /usr/include/sys/sysmacros.h:55: multiple definition of `gnu_dev_makedev'
>> hello.o:/usr/include/sys/sysmacros.h:55: first defined here
>> collect2: ld returned 1 exit status
>> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> I've recently been playing around with using Clang as the system
> compiler on a Gentoo system and found several packages that did
> something similar. The fix appears to be to add the -std=c89 option;

Thanks, that worked!

> from memory Clang defaults to c99 (while GCC defaults to c89) and there
> is a difference in the handling of inlining functions. One instance of
> this was also fixed by compiling Clang/LLVM from SVN, so if the c89
> option doesn't fix it maybe give that a go (if you aren't already).

Yes, I was compiling from the current trunk r91244.

> Hope that helps,
> Andrew
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list