What a surprise!
I wrote a helloworld C program (attached), and use clang to compile it.
And, clang failed at link time.

This happened with both clang-3.3-shared and clang-3.2-shared build. (these are 
PandaBoard/ARM only)

Thanks for Pekka and Kalle, you pointed me the right direction.

[hello.c]
#include <stdio.h>

int main(void){
  printf("sizeof(long double) %d\n", sizeof(long double));
  printf("sizeof(float) %d\n",       sizeof(float));

  return 0;
}

[compile with clang-3.2-shared build]
czhao@panda0:~/Test$ clang -v
clang version 3.2 (tags/RELEASE_32/final)
Target: armv7l-unknown-linux-gnueabi
Thread model: posix
czhao@panda0:~/Test$ clang hello.c -o hello.exe
/usr/bin/ld: cannot find -lgcc_s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
czhao@panda0:~/Test$


[compile with clang-3.3-shared build]
czhao@panda0:~/Test$ clang -v
clang version 3.3 (tags/RELEASE_33/final)
Target: armv7l-unknown-linux-gnueabi
Thread model: posix
czhao@panda0:~/Test$ clang hello.c -o hello.exe
/usr/bin/ld: cannot find -lgcc_s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
czhao@panda0:~/Test$


So, the issue is now firmed to be clang can't link simple code to create an 
executable.

I was reading the issue on the web, there seems to be a few links discussing 
the it:
https://blogs.oracle.com/mandalika/entry/quick_fix_to_the_linker
http://askubuntu.com/questions/220282/how-to-solve-the-link-library-problem-lgcc-s
http://serverfault.com/questions/266138/cannot-find-lgcc-s-from-gcc-3-4-on-unbuntu-11-04
http://stackoverflow.com/questions/14118224/clang-linker-issues-from-source-to-gcc-snapshot


Investigating more now.

Thank you

Chuck


I was

On 7/19/2013 11:58 PM, Pekka Jääskeläinen wrote:

On 07/20/2013 03:41 AM, Chuck Zhao wrote:

Did anybody ever seems to have seen such a behavior before?



Yes. I remember this problem has occured  before. Then it was a problem

with the 'xclang' script we use to figure out the alignments (config/xclang).

Then the issue, IIRC, was that we used wrong switch in clang or llc

to pass the target triplet. It had changed in some LLVM version.



Can you create a dummy hello.c with e.g. a Hello World program,

and feed it to xclang and see what it says?

Run with: config/xclang hello.c



Are you using LLVM 3.2 or 3.3?



------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
pocl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pocl-devel

Reply via email to