[LLVMdev] llvm-gcc linking errors

llvm at assumetheposition.nl llvm at assumetheposition.nl
Tue Jul 29 07:27:18 PDT 2008


Hello all,

I was under the impression that llvm-gcc (and g++) could be used as a
standin for plain gcc, without any extra options needed on the
command-line. Is this correct?

If so, then I'm at a loss why I get the linking errors below when using
llvm-gcc compared to a successful gcc build. The multiply defined symbols
reported all seem to come from <stdlib.h>

Any clues?

Thanks,
Paul

========
With GCC
========

16:24|paul at tabu:~/> make
gcc -c -g -O2 -std=c99 -Wall -Wextra -Werror-implicit-function-declaration
-Wshadow -Wstrict-prototypes -pedantic-errors main.c
main.c: In function 'KeyPressed':
main.c:291: warning: unused parameter 'x'
main.c:291: warning: unused parameter 'y'
gcc -c -g -O2 -std=c99 -Wall -Wextra -Werror-implicit-function-declaration
-Wshadow -Wstrict-prototypes -pedantic-errors trirast.c
gcc -g -lGL -lglut -o trirast main.o trirast.o
16:24|paul at tabu:~/>

=============
With llvm-gcc
=============

16:25|paul at tabu:~/> make
llvm-gcc -c -g -O2 -std=c99 -Wall -Wextra
-Werror-implicit-function-declaration -Wshadow -Wstrict-prototypes
-pedantic-errors main.c
main.c: In function 'KeyPressed':
main.c:291: warning: unused parameter 'x'
main.c:291: warning: unused parameter 'y'
llvm-gcc -c -g -O2 -std=c99 -Wall -Wextra
-Werror-implicit-function-declaration -Wshadow -Wstrict-prototypes
-pedantic-errors trirast.c
llvm-gcc -g -lGL -lglut -o trirast main.o trirast.o
trirast.o(.text+0x0): In function `strtod':
: multiple definition of `strtod'
main.o(.text+0x0): first defined here
trirast.o(.text+0x10d0): In function `putchar':
: multiple definition of `putchar'
main.o(.text+0x1310): first defined here
trirast.o(.text+0x10f0): In function `getchar':
: multiple definition of `getchar'
main.o(.text+0x1330): first defined here
trirast.o(.text+0x1110): In function `vprintf':
: multiple definition of `vprintf'
main.o(.text+0x1350): first defined here
trirast.o(.text+0x1140): In function `strtoull':
: multiple definition of `strtoull'
main.o(.text+0x1380): first defined here
trirast.o(.text+0x1170): In function `strtoll':
: multiple definition of `strtoll'
main.o(.text+0x13b0): first defined here
trirast.o(.text+0x11a0): In function `strtold':
: multiple definition of `strtold'
main.o(.text+0x13e0): first defined here
trirast.o(.text+0x11d0): In function `strtof':
: multiple definition of `strtof'
main.o(.text+0x1410): first defined here
trirast.o(.text+0x1200): In function `strtoul':
: multiple definition of `strtoul'
main.o(.text+0x1440): first defined here
trirast.o(.text+0x1230): In function `strtol':
: multiple definition of `strtol'
main.o(.text+0x1470): first defined here
trirast.o(.text+0x1260): In function `atoi':
: multiple definition of `atoi'
main.o(.text+0x14a0): first defined here
trirast.o(.text+0x1290): In function `atol':
: multiple definition of `atol'
main.o(.text+0x14d0): first defined here
trirast.o(.text+0x12c0): In function `atoll':
: multiple definition of `atoll'
main.o(.text+0x1500): first defined here
trirast.o(.text+0x12f0): In function `atof':
: multiple definition of `atof'
main.o(.text+0x1530): first defined here
collect2: ld returned 1 exit status
make: *** [trirast] Error 1
16:25|paul at tabu:~/>




More information about the llvm-dev mailing list