Opened 13 years ago

Closed 12 years ago

#31663 closed defect (fixed)

llvm-gcc42 doesn't compile with clang

Reported by: tobias.noebauer@… Owned by: erickt@…
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: clang Cc: jeremyhu (Jeremy Huddleston Sequoia), larryv (Lawrence Velázquez), Sam.Halliday@…
Port: llvm-gcc42

Description

Hi,

running "sudo port install llvm-gcc4" results in the following error (excerpt from the log file, which is attached):

:info:build shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/build" && /usr/bin/make -j2 -w bootstrap BOOT_CFLAGS="-O2 -g -D_FORTIFY_SOURCE=0" STAGE1_CFLAGS="-O2 -fkeep-inline-functions -D_FORTIFY_SOURCE=0" " returned error 2

When running the second part of that shell command (make) by hand, the following error appears (full output attached):

/Developer/usr/bin/clang -c   -O2 -fkeep-inline-functions -D_FORTIFY_SOURCE=0 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wmissing-format-attribute -fno-common  -mdynamic-no-pic -DHAVE_CONFIG_H -I. -I. -I../../llvm-gcc-4.2-2.9.source/gcc -I../../llvm-gcc-4.2-2.9.source/gcc/. -I../../llvm-gcc-4.2-2.9.source/gcc/../include -I../../llvm-gcc-4.2-2.9.source/gcc/../libcpp/include -I/opt/local/include -I/opt/local/include -I../../llvm-gcc-4.2-2.9.source/gcc/../libdecnumber -I../libdecnumber -I/opt/local/include -DENABLE_LLVM -I/opt/local/include  -DNDEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS   ../../llvm-gcc-4.2-2.9.source/gcc/passes.c -o passes.o
...
...
...
../../llvm-gcc-4.2-2.9.source/gcc/toplev.c:577:1: error: redefinition of a 'extern inline' function 'floor_log2' is not supported in C99 mode
floor_log2 (unsigned HOST_WIDE_INT x)
^
../../llvm-gcc-4.2-2.9.source/gcc/toplev.h:180:1: note: previous definition is here
floor_log2 (unsigned HOST_WIDE_INT x)
^
../../llvm-gcc-4.2-2.9.source/gcc/toplev.c:612:1: error: redefinition of a 'extern inline' function 'exact_log2' is not supported in C99 mode
exact_log2 (unsigned HOST_WIDE_INT x)
^
../../llvm-gcc-4.2-2.9.source/gcc/toplev.h:186:1: note: previous definition is here
exact_log2 (unsigned HOST_WIDE_INT x)
^
5 warnings and 2 errors generated.
make[3]: *** [toplev.o] Error 1

My system: MacOS 10.7.2, XCode 4.2, MacPorts 2.0.3

Any help appreciated (and as always I hope that the bug is not me...) Regards, planck

Attachments (2)

main.log (3.8 MB) - added by tobias.noebauer@… 13 years ago.
ports logfile
make.log (3.2 MB) - added by tobias.noebauer@… 13 years ago.
output of manual make run

Change History (16)

Changed 13 years ago by tobias.noebauer@…

Attachment: main.log added

ports logfile

Changed 13 years ago by tobias.noebauer@…

Attachment: make.log added

output of manual make run

comment:1 Changed 13 years ago by tobias.noebauer@…

Cc: tobias.noebauer@… added

Cc Me!

comment:2 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: mfeiri@… added; tobias.noebauer@… removed
Owner: changed from macports-tickets@… to erickt@…

Out of curiosity, why do you want to compile the llvm-gcc42 port? Apple already includes a version of llvm-gcc-4.2 in Xcode.

comment:3 Changed 13 years ago by tobias.noebauer@…

Ummm, because... I didn't know that, and for some reason it was not on the path (which was probably my fault). Thanks for the hint!

comment:4 Changed 13 years ago by larryv (Lawrence Velázquez)

Cc: larry.velazquez@… added

Cc Me!

comment:5 Changed 13 years ago by larryv (Lawrence Velázquez)

I tried using Apple's GCC to build llvm-gcc42, and it worked.

sudo port install llvm-gcc42          # Installed dependencies, but failed on llvm-gcc itself
sudo port install apple-gcc
sudo port clean --all llvm-gcc42
sudo port install llvm-gcc42 configure.compiler=apple-gcc-4.2

comment:6 in reply to:  5 Changed 13 years ago by larryv (Lawrence Velázquez)

To be clear, llvm-gcc42 itself was the only port that was built using the compiler override. Whatever dependencies were installed had worked fine with the default.

I am also on OS X 10.7.2, with Xcode 4.2 (4D199) and MacPorts 2.0.3.

comment:7 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: Sam.Halliday@… added
Keywords: clang added
Summary: llvm-gcc42 doesn't compilellvm-gcc42 doesn't compile with clang

Has duplicate #32117.

Larry, thank you for finding out that llvm-gcc42 works when compiled with apple-gcc-4.2. However, we would rather compile with llvm-gcc-4.2, if that would work. See ProblemHotlist#compiler. Can you or someone try that?

comment:8 in reply to:  7 Changed 13 years ago by larryv (Lawrence Velázquez)

Replying to ryandesign@…:

However, we would rather compile with llvm-gcc-4.2, if that would work. See ProblemHotlist#compiler. Can you or someone try that?

Building llvm-gcc42 using llvm-gcc-4.2 works fine for me. I'm pretty sure all dependencies had been built using their default compilers.

comment:9 Changed 13 years ago by mmuurr@…

i encountered the same error, OS 10.7.2, Xcode 4.2.1, MacPorts 2.0.3 (fresh install, first command after selfupdate was "sudo port install R-framework"... all other dependencies up until llvm-gcc42 compiled/built fine).

i, too, only got around it by switching compiler to apple-gcc-4.2.

comment:10 Changed 12 years ago by jmroot (Joshua Root)

Cc: jeremyhu@… added

Workaround of not using clang was added in r88057. Does it work with clang if -std=gnu89 is added to BOOT_CFLAGS/STAGE1_CFLAGS?

comment:11 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

I'm sure I tried that. I don't remember why it didn't work, though.

FWIW, if you really want llvm and gcc, you're best bet is using dragonegg-3.1 instead of llvm-gcc

comment:12 Changed 12 years ago by larryv (Lawrence Velázquez)

Cc: larryv@… added; larry.velazquez@… removed

comment:13 Changed 12 years ago by mfeiri

Cc: mfeiri@… removed

comment:14 Changed 12 years ago by larryv (Lawrence Velázquez)

Resolution: fixed
Status: newclosed

Indirectly fixed in r101497. Version 2336.11 builds fine with Clang.

Note: See TracTickets for help on using tickets.