[LLVMbugs] [Bug 15403] New: clang complains of undefined _main symbol for x86_64 when compiling from stdin
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Feb 28 15:42:18 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=15403
Bug ID: 15403
Summary: clang complains of undefined _main symbol for x86_64
when compiling from stdin
Product: clang
Version: 3.2
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: jtolds at xnet5.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
This works:
echo "int main() {}" > test.cpp
clang++ -stdlib=libc++ -std=c++0x -arch i386 -arch x86_64 -x c++ test.cpp -o
/dev/null
But this doesn't:
echo "int main() {}" | clang++ -stdlib=libc++
-std=c++0x -arch i386 -arch x86_64 -x c++ - -o /dev/null
It fails with this message:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Running again with -v gives:
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix
"/usr/bin/clang" -cc1 -triple i386-apple-macosx10.8.0 -emit-obj -mrelax-all
-disable-free -disable-llvm-verifier -main-file-name - -pic-level 2
-mdisable-fp-elim -masm-verbose -target-cpu yonah -target-linker-version 136 -v
-resource-dir /usr/bin/../lib/clang/4.2 -fmodule-cache-path
/var/folders/qj/qqp5sv157yx96nj0rt_g96rw0000gn/T/clang-module-cache
-stdlib=libc++ -std=c++0x -fdeprecated-macro -fdebug-compilation-dir /Users/jt
-ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-fragile-10.8.0 -fobjc-default-synthesize-properties
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/qj/qqp5sv157yx96nj0rt_g96rw0000gn/T/--iarxmw.o -x c++ -
clang -cc1 version 4.2 based upon LLVM 3.2svn default target
x86_64-apple-darwin12.2.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
/usr/bin/../lib/c++/v1
/usr/local/include
/usr/bin/../lib/clang/4.2/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/usr/bin/ld" -demangle -dynamic -arch i386 -macosx_version_min 10.8.0 -o
/var/folders/qj/qqp5sv157yx96nj0rt_g96rw0000gn/T/--x57dHr.out
/var/folders/qj/qqp5sv157yx96nj0rt_g96rw0000gn/T/--iarxmw.o -arch_multiple
-final_output /dev/null -lc++ -lSystem
/usr/bin/../lib/clang/4.2/lib/darwin/libclang_rt.eprintf.a
/usr/bin/../lib/clang/4.2/lib/darwin/libclang_rt.osx.a
"/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.8.0 -emit-obj -mrelax-all
-disable-free -disable-llvm-verifier -main-file-name - -pic-level 2
-mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 136 -v -resource-dir /usr/bin/../lib/clang/4.2
-fmodule-cache-path
/var/folders/qj/qqp5sv157yx96nj0rt_g96rw0000gn/T/clang-module-cache
-stdlib=libc++ -std=c++0x -fdeprecated-macro -fdebug-compilation-dir /Users/jt
-ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.8.0 -fobjc-dispatch-method=mixed
-fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/qj/qqp5sv157yx96nj0rt_g96rw0000gn/T/--pIxdEO.o -x c++ -
clang -cc1 version 4.2 based upon LLVM 3.2svn default target
x86_64-apple-darwin12.2.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
/usr/bin/../lib/c++/v1
/usr/local/include
/usr/bin/../lib/clang/4.2/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.8.0 -o
/var/folders/qj/qqp5sv157yx96nj0rt_g96rw0000gn/T/--7tM9gO.out
/var/folders/qj/qqp5sv157yx96nj0rt_g96rw0000gn/T/--pIxdEO.o -arch_multiple
-final_output /dev/null -lc++ -lSystem
/usr/bin/../lib/clang/4.2/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130228/6734a1b1/attachment.html>
More information about the llvm-bugs
mailing list