[LLVMbugs] [Bug 890] NEW: convert C++ to C fails? linker problem?

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Aug 29 07:49:07 PDT 2006


http://llvm.org/bugs/show_bug.cgi?id=890

           Summary: convert C++ to C fails? linker problem?
           Product: libraries
           Version: 1.8
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Transformation Utilities
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: hp48gx at gmail.com


Hi, I just installed LLVM1.8 with the shipped binaries of GCC4. To test the installation I just entered 
some simple commands manually at the terminal.
I'm not sure of what was wrong, maybe I made some wrong steps, but I think llc is trying to make ld 
link a c file against c++ libraries...


powerbookg4:/llvm/test mycroft$ cat hello.cpp 
#include <iostream>

int main() 
{
     std::cout << "hello world\n";
     return 0;
}
powerbookg4:/llvm/test mycroft$ ls -l
total 8
-rw-r--r--   1 mycroft  admin  95 Jan 12  2006 hello.cpp
powerbookg4:/llvm/test mycroft$ llvm-g++ hello.cpp 
powerbookg4:/llvm/test mycroft$ ls -l
total 40
-rwxr-xr-x   1 mycroft  admin  14284 Aug 29 16:38 a.out
-rw-r--r--   1 mycroft  admin     95 Jan 12  2006 hello.cpp
powerbookg4:/llvm/test mycroft$ ./a.out 
hello world
powerbookg4:/llvm/test mycroft$ llvm-g++ hello.cpp -c -emit-llvm -o hello.bc    
powerbookg4:/llvm/test mycroft$ ls -l
total 48
-rwxr-xr-x   1 mycroft  admin  14284 Aug 29 16:38 a.out
-rw-r--r--   1 mycroft  admin   1948 Aug 29 16:38 hello.bc
-rw-r--r--   1 mycroft  admin     95 Jan 12  2006 hello.cpp
powerbookg4:/llvm/test mycroft$ lli hello.bc 
hello world
powerbookg4:/llvm/test mycroft$ llc -march=c hello.bc -o hello.c
powerbookg4:/llvm/test mycroft$ ls -l
total 72
-rwxr-xr-x   1 mycroft  admin  14284 Aug 29 16:38 a.out
-rw-r--r--   1 mycroft  admin   1948 Aug 29 16:38 hello.bc
-rw-r--r--   1 mycroft  admin  11771 Aug 29 16:39 hello.c
-rw-r--r--   1 mycroft  admin     95 Jan 12  2006 hello.cpp
powerbookg4:/llvm/test mycroft$ cc hello.c
hello.c:221: warning: conflicting types for built-in function 'malloc'
/usr/bin/ld: Undefined symbols:
std::ios_base::Init::Init()
std::ios_base::Init::~Init()
std::cout
std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >
(std::basic_ostream<char, std::char_traits<char> >&, char const*)
collect2: ld returned 1 exit status



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list