Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang [built from source] on Mageia v6/Cauldron x86-64 fails with an error on the Hello World program #27289

Open Quuxplusone opened 8 years ago

Quuxplusone commented 8 years ago
Bugzilla Link PR27290
Status NEW
Importance P normal
Reported by Shlomi Fish (shlomif@shlomifish.org)
Reported on 2016-04-08 11:04:34 -0700
Last modified on 2016-04-24 00:29:10 -0700
Version 3.8
Hardware PC Linux
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments clang.strace.xz (7252 bytes, application/x-xz)
Blocks
Blocked by
See also
Hi all,

I previously reported a similar bug (with the Mageia Linux packages) here -
https://bugs.mageia.org/show_bug.cgi?id=18138 . Anyway, building llvm and then
clang from source using this bash script:

#!/bin/bash
b='/opt/llvm'
export PATH="$b/bin:$PATH"
export PKG_CONFIG_PATH="$b/lib64/pkgconfig:$b/lib/pkgconfig:$PKG_CONFIG_PATH"
cmake -DCMAKE_BUILD_TYPE="release" -DCMAKE_INSTALL_PREFIX="$b" "$@"

And doing "make -j4 ; make -j4 check ; make -j4 install" and then running clang
from /opt/llvm on the hello world program results in an error (at least here on
Mageia Linux x86-64 v6):

< SHELL >
shlomif@telaviv1 C/snippets/shlomif-c-snippets $ cat hello_world.c
/*
 * The canonical Hello World program kept here to avoid code duplication
 *
 * License is the MIT/X11 license - http://opensource.org/licenses/MIT .
 * ( https://en.wikipedia.org/wiki/MIT_License ).
 */
#include <stdio.h>

int main(void)
{
    printf ("%s\n", "Hello World!");

    return 0;
}
shlomif@telaviv1 C/snippets/shlomif-c-snippets $ /opt/llvm/bin/clang
hello_world.c
/..//bin/ld: cannot find crtbegin.o: No such file or directory
/..//bin/ld: cannot find -lgcc
clang-3.8: error: linker command failed with exit code 1 (use -v to see
invocation)
shlomif@telaviv1 C/snippets/shlomif-c-snippets $
< / SHELL >

I'll attach the strace output of clang soon.
Quuxplusone commented 8 years ago

Attached clang.strace.xz (7252 bytes, application/x-xz): The clang strace output as compressed by xz

Quuxplusone commented 8 years ago

Today I built llvm and clang from their 3.8.0 sources under /opt/llvm using the same build scripts - on a Debian Jessie x86-64 VM - and /opt/llvm/bin/clang compiled the Hello World perfectly fine.

Quuxplusone commented 8 years ago
Hi all,

copying from the Mageia bug tracker:

One workaround I found for this bug today (thanks in part to this stackoverflow
thread - http://stackoverflow.com/questions/4160262/clang-linker-
problem#4160340 ) is to set these environment variables (e.g: by sourcing the
code from Bash):

«
export COMPILER_PATH=/usr/lib/gcc/x86_64-mageia-linux-gnu/5.3.1/
export LIBRARY_PATH="$COMPILER_PATH"
»

after doing that, the Hello World program compiles and I was able to get
Freecell Solver to build and pass its tests' suite using /usr/bin/clang.