Building llvm under cygwin

Hi!

I’m trying to build LLVM under cygwin.
I have the latest version of cygwin and CVS versions of llvm, llvm-test and llvm-gcc.
make of tools only succeeded.
make of frontend succeeded too
but full make of llvm failed on crtend in llvm/runtime/GCCLibraries with the following message:

llvm[0]: Compiling crtend.c for Debug build (bytecode)
/bin/sh: -c: line 0: syntax error near unexpected token (' /bin/sh: -c: line 0: if PATH=“/llvmobj/Debug/bin:/bin:/llvmobj/Debug/bin:/bin:/
usr/local/bin:/usr/bin:/bin:“C:/Program Files/Microsoft DirectX SDK (June 2006)/
Utilities/Bin/x86”:/usr/bin:/cygdrive/c/CB6/Bin:/cygdrive/c/CB6/Projects/Bpl:/cy
gdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:
/cygdrive/c/Program Files/Microsoft SDK/Bin/:/cygdrive/c/Program Files/Microsoft
SDK/Bin/WinNT/:/cygdrive/c/Program Files/Common Files/Autodesk Shared/:/cygdriv
e/c/Program Files/backburner 2/:/cygdrive/c/Program Files/Microsoft SQL Server/8
0/Tools/BINN:/cygdrive/c/Program Files/Microsoft SQL Server/90/Tools/binn/:/cygd
rive/c/Program Files/Subversion/bin:/cygdrive/c/Program Files/doxygen/bin:/cygdr
ive/c/Program Files/ionForge/ionForge Evolution:/cygdrive/c/Program Files/CVSNT/
:/cygdrive/c/jdk1.5.0/ant/bin” /bin/llvm-gcc.exe -I/llvmobj/runtime/GCCLibraries
/crtend -I/llvm/runtime/GCCLibraries/crtend -I/llvmobj/include -I/llvm/include -
I/llvmobj/include -I/llvm/include -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -Wall -W
-Wwrite-strings -Wno-unused -Wno-long-long -pedantic -g -D_DEBUG -MD -MT /llvm
obj/runtime/GCCLibraries/crtend/Debug/crtend.ll -MP -MF “/llvmobj/runtime/GCCLib
raries/crtend/Debug/crtend.BCCd” '
make: *** [/llvmobj/runtime/GCCLibraries/crtend/Debug/crtend.ll] Error 2

What should I do to finish building llvm?

Thanks.

Tony.

If you're building llvm-gcc4, you don't need the runtime libraries, so
I'd just stick with the "tools-only" build and declare success. If
you're building llvm-gcc3, I'd suggest you switch to llvm-gcc4 :slight_smile:

However, the problem appears to be your PATH variable. In your path you
have the following directory: C:/Program Files/Microsoft DirectX SDK
(June 2006)/Utilities/Bin/x86. The bash shell doesn't like this because
( and ) are operators that invoke a sub-shell. You can do one of two
things: either remove this directory from your path (its probably not
needed), or enclose it in single quotes.

Reid.

If you’re building llvm-gcc4, you don’t need the runtime libraries, so
I’d just stick with the “tools-only” build and declare success. If
you’re building llvm-gcc3, I’d suggest you switch to llvm-gcc4 :slight_smile:

I switched to llvm-gcc4 but when I run make from obj folder i run into folowing errors:

Can’t find a library with no dependencies at /llvm/obj/Debug/bin/llvm-config lin
e 420, line 30.
…/…/src/gcc/gcc.c: In function process_command': ../../src/gcc/gcc.c:3499: warning: assignment discards qualifiers from pointer t arget type ../../src/gcc/gcc.c:3504: warning: assignment from incompatible pointer type ../../src/gcc/gcc.c: In function main’:
…/…/src/gcc/gcc.c:6357: warning: ‘value’ might be used uninitialized in this f
unction
/bin/sh: -c: line 0: syntax error near unexpected token ;' /bin/sh: -c: line 0: if ; then '
make[1]: *** [xlimits.h] Error 2
make: *** [all-gcc] Error 2

and there is the output of standart stream:

make[1]: Entering directory /llvm-gcc/obj/libiberty' make[2]: Entering directory /llvm-gcc/obj/libiberty/testsuite’
make[2]: Nothing to be done for all'. make[2]: Leaving directory /llvm-gcc/obj/libiberty/testsuite’
make[1]: Leaving directory /llvm-gcc/obj/libiberty' make[1]: Entering directory /llvm-gcc/obj/fixincludes’
make[1]: Nothing to be done for all'. make[1]: Leaving directory /llvm-gcc/obj/fixincludes’
make[1]: Entering directory /llvm-gcc/obj/intl' rm -f stamp-h1 /bin/sh ./config.status config.h config.status: creating config.h config.status: config.h is unchanged test -f config.h || (rm -f stamp-h1 && make stamp-h1) make[1]: Leaving directory /llvm-gcc/obj/intl’
make[1]: Entering directory /llvm-gcc/obj/build-i686-pc-cygwin/libiberty' make[2]: Entering directory /llvm-gcc/obj/build-i686-pc-cygwin/libiberty/testsuite’
make[2]: Nothing to be done for all'. make[2]: Leaving directory /llvm-gcc/obj/build-i686-pc-cygwin/libiberty/testsuite’
make[1]: Leaving directory /llvm-gcc/obj/build-i686-pc-cygwin/libiberty' make[1]: Entering directory /llvm-gcc/obj/build-i686-pc-cygwin/fixincludes’
make[1]: Nothing to be done for all'. make[1]: Leaving directory /llvm-gcc/obj/build-i686-pc-cygwin/fixincludes’
make[1]: Entering directory /llvm-gcc/obj/libcpp' test -f config.h || (rm -f stamp-h1 && make stamp-h1) test -d po || mkdir po : --statistics -o po/be.gmo ../../src/libcpp/po/be.po test -d po || mkdir po : --statistics -o po/ca.gmo ../../src/libcpp/po/ca.po test -d po || mkdir po : --statistics -o po/da.gmo ../../src/libcpp/po/da.po test -d po || mkdir po : --statistics -o po/de.gmo ../../src/libcpp/po/de.po test -d po || mkdir po : --statistics -o po/el.gmo ../../src/libcpp/po/el.po test -d po || mkdir po : --statistics -o po/es.gmo ../../src/libcpp/po/es.po test -d po || mkdir po : --statistics -o po/fr.gmo ../../src/libcpp/po/fr.po test -d po || mkdir po : --statistics -o po/ja.gmo ../../src/libcpp/po/ja.po test -d po || mkdir po : --statistics -o po/nl.gmo ../../src/libcpp/po/nl.po test -d po || mkdir po : --statistics -o po/rw.gmo ../../src/libcpp/po/rw.po test -d po || mkdir po : --statistics -o po/sv.gmo ../../src/libcpp/po/sv.po test -d po || mkdir po : --statistics -o po/tr.gmo ../../src/libcpp/po/tr.po test -d po || mkdir po : --statistics -o po/vi.gmo ../../src/libcpp/po/vi.po make[1]: Leaving directory /llvm-gcc/obj/libcpp’
make[1]: Entering directory `/llvm-gcc/obj/gcc’
test -d po || mkdir po
: --statistics -o po/be.gmo …/…/src/gcc/po/be.po
test -d po || mkdir po
: --statistics -o po/ca.gmo …/…/src/gcc/po/ca.po
test -d po || mkdir po
: --statistics -o po/da.gmo …/…/src/gcc/po/da.po
test -d po || mkdir po
: --statistics -o po/de.gmo …/…/src/gcc/po/de.po
test -d po || mkdir po
: --statistics -o po/el.gmo …/…/src/gcc/po/el.po
test -d po || mkdir po
: --statistics -o po/es.gmo …/…/src/gcc/po/es.po
test -d po || mkdir po
: --statistics -o po/fr.gmo …/…/src/gcc/po/fr.po
test -d po || mkdir po
: --statistics -o po/ja.gmo …/…/src/gcc/po/ja.po
test -d po || mkdir po
: --statistics -o po/nl.gmo …/…/src/gcc/po/nl.po
test -d po || mkdir po
: --statistics -o po/rw.gmo …/…/src/gcc/po/rw.po
test -d po || mkdir po
: --statistics -o po/sv.gmo …/…/src/gcc/po/sv.po
test -d po || mkdir po
: --statistics -o po/tr.gmo …/…/src/gcc/po/tr.po
test -d po || mkdir po
: --statistics -o po/zh_CN.gmo …/…/src/gcc/po/zh_CN.po
gcc -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -fno-common -DHAVE_CONFIG_H -DENABLE_LLVM -D__STDC_LIMIT_MACROS -I. -I. -I…/…/src/gcc -I…/…/src/gcc/. -I…/…/src/gcc/…/include -I./…/intl -I…/…/src/gcc/…/libcpp/include -I/llvm/include -I/llvm/obj/include
-DTARGET_MACHINE="i686-pc-cygwin"
-c …/…/src/gcc/collect2.c -o collect2.o
gcc -c -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -fno-common -DHAVE_CONFIG_H -DENABLE_LLVM -D__STDC_LIMIT_MACROS -I. -I. -I…/…/src/gcc -I…/…/src/gcc/. -I…/…/src/gcc/…/include -I./…/intl -I…/…/src/gcc/…/libcpp/include -I/llvm/include -I/llvm/obj/include …/…/src/gcc/tlink.c -o tlink.o

APPLE LOCAL LLVM

c++ -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -fno-common -DHAVE_CONFIG_H -o Tcollect2.exe
collect2.o tlink.o intl.o version.o …/libcpp/libcpp.a ./…/intl/libintl.a -liconv …/libiberty/libiberty.a
mv -f Tcollect2.exe collect2.exe
if test yes = yes \

test -n “”; then
/bin/sh …/…/src/gcc/genmultilib
“”
“”
“”
“”
“”
“”
“”
“yes”
tmp-mlib.h;
else
/bin/sh …/…/src/gcc/genmultilib ‘’ ‘’ ‘’ ‘’ ‘’ ‘’ ‘’ no
tmp-mlib.h;
fi
/bin/sh …/…/src/gcc/…/move-if-change tmp-mlib.h multilib.h
echo timestamp > s-mlib
lsf=“…/…/src/gcc/cp/lang- specs.h”; for f in $lsf; do
echo “#include "$f"”;
done | sed ‘s|…/…/src/gcc/||’ > tmp-specs.h
/bin/sh …/…/src/gcc/…/move-if-change tmp-specs.h specs.h
echo timestamp > s-specs
(SHLIB_LINK=‘’
SHLIB_MULTILIB=‘’;
gcc -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -fno-common -Wno-error -DHAVE_CONFIG_H -DENABLE_LLVM -D__STDC_LIMIT_MACROS -I. -I. -I…/…/src/gcc -I…/…/src/gcc/. -I…/…/src/gcc/…/include -I./…/intl -I…/…/src/gcc/…/libcpp/include -I/llvm/include -I/llvm/obj/include
-DSTANDARD_STARTFILE_PREFIX="…/…/…/" -DSTANDARD_EXEC_PREFIX="/llvm-gcc/…/install//lib/gcc/" -DSTANDARD_LIBEXEC_PREFIX="/llvm-gcc/…/install//libexec/gcc/" -DDEFAULT_TARGET_VERSION=" 4.0.1" -DDEFAULT_TARGET_MACHINE="i686-pc-cygwin" -DSTANDARD_BINDIR_PREFIX="/llvm-gcc/…/install//bin/" -DTOOLDIR_BASE_PREFIX="…/…/…/…/" test "X${SHLIB_LINK}" = "X" || test "yes" != "yes" || echo "-DENABLE_SHARED_LIBGCC" test "X${SHLIB_MULTILIB}" = "X" || echo "-DNO_SHARED_LIBGCC_MULTILIB"
-c …/…/src/gcc/gcc.c -o gcc.o)
(SHLIB_LINK=‘’
SHLIB_MULTILIB=‘’;
gcc -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -fno-common -DHAVE_CONFIG_H -DENABLE_LLVM -D__STDC_LIMIT_MACROS -I. -I. -I…/…/src/gcc -I…/…/src/gcc/. -I…/…/src/gcc/…/include -I./…/intl -I…/…/src/gcc/…/libcpp/include -I/llvm/include -I/llvm/obj/include
-DSTANDARD_STARTFILE_PREFIX="…/…/…/" -DSTANDARD_EXEC_PREFIX="/llvm-gcc/…/install//lib/gcc/" -DSTANDARD_LIBEXEC_PREFIX="/llvm-gcc/…/install//libexec/gcc/" -DDEFAULT_TARGET_VERSION=" 4.0.1" -DDEFAULT_TARGET_MACHINE="i686-pc-cygwin" -DSTANDARD_BINDIR_PREFIX="/llvm-gcc/…/install//bin/" -DTOOLDIR_BASE_PREFIX="…/…/…/…/" test "X${SHLIB_LINK}" = "X" || test "yes" != "yes" || echo "-DENABLE_SHARED_LIBGCC" test "X${SHLIB_MULTILIB}" = "X" || echo "-DNO_SHARED_LIBGCC_MULTILIB"
-c …/…/src/gcc/gccspec.c -o gccspec.o)
gcc -c -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -fno-common -DHAVE_CONFIG_H -DENABLE_LLVM -D__STDC_LIMIT_MACROS -I. -I. -I…/…/src/gcc -I…/…/src/gcc/. -I…/…/src/gcc/…/include -I./…/intl -I…/…/src/gcc/…/libcpp/include -I/llvm/include -I/llvm/obj/include
…/…/src/gcc/config/i386/cygwin1.c

APPLE LOCAL LLVM

c++ -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -fno-common -DHAVE_CONFIG_H -o xgcc.exe gcc.o gccspec.o intl.o
prefix.o version.o cygwin1.o …/libcpp/libcpp.a ./…/intl/libintl.a -liconv …/libiberty/libiberty.a
gcc -c -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -fno-common -DHAVE_CONFIG_H -DENABLE_LLVM -D__STDC_LIMIT_MACROS -I. -I. -I…/…/src/gcc -I…/…/src/gcc/. -I…/…/src/gcc/…/include -I./…/intl -I…/…/src/gcc/…/libcpp/include -I/llvm/include -I/llvm/obj/include …/…/src/gcc/cppspec.c -o cppspec.o

APPLE LOCAL LLVM

c++ -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -fno-common -DHAVE_CONFIG_H -o cpp.exe gcc.o cppspec.o intl.o
prefix.o version.o cygwin1.o …/libcpp/libcpp.a ./…/intl/libintl.a -liconv …/libiberty/libiberty.a
/llvm-gcc/obj/gcc/xgcc -B/llvm-gcc/obj/gcc/ -B/llvm-gcc/…/install//i686-pc-cygwin/bin/ -B/llvm-gcc/…/install//i686-pc-cygwin/lib/ -isystem /llvm-gcc/…/install//i686-pc-cygwin/include -isystem /llvm-gcc/…/install//i686-pc-cygwin/sys-include -dumpspecs > tmp-specs
mv tmp-specs specs
if ; then
cat …/…/src/gcc/limitx.h …/…/src/gcc/glimits.h …/…/src/gcc/limity.h > tmp-xlimits.h;
else
cat …/…/src/gcc/glimits.h > tmp-xlimits.h;
fi
make[1]: Leaving directory `/llvm-gcc/obj/gcc’

I though it was ld error, first, and reinstalled it to clean 2.17 instead of cygwn experimental version. but that didn’t help.

However, the problem appears to be your PATH variable. In your path you
have the following directory: C:/Program Files/Microsoft DirectX SDK
(June 2006)/Utilities/Bin/x86. The bash shell doesn’t like this because
( and ) are operators that invoke a sub-shell. You can do one of two
things: either remove this directory from your path (its probably not
needed), or enclose it in single quotes.

Reid.

Yeah, thas moved me a little far until another error appeared and I switched to llvm-gcc4.

Thanks for any help.

        If you're building llvm-gcc4, you don't need the runtime
        libraries, so
        I'd just stick with the "tools-only" build and declare
        success. If
        you're building llvm-gcc3, I'd suggest you switch to
        llvm-gcc4 :slight_smile:

I switched to llvm-gcc4 but when I run make from obj folder i run into
folowing errors:

Can't find a library with no dependencies
at /llvm/obj/Debug/bin/llvm-config lin
e 420, <DATA> line 30.

The key is the above line. IIRC this is fixed in a recent patch. Have
you updated your LLVM tree recently?

Reid.

I switched to llvm-gcc4 but when I run make from obj folder i run into
folowing errors:

Can’t find a library with no dependencies
at /llvm/obj/Debug/bin/llvm-config lin
e 420, line 30.

The key is the above line. IIRC this is fixed in a recent patch. Have
you updated your LLVM tree recently?

I’ve updated it yesterday and rebuilt - llvm built fine. But when building llvm-gcc4 (also updated yesterday from new /trunk directory) it fails with the same error.

I’ve managed to build llvm-gcc3 though.

Thanks.

Hello Anton

Thu, 3 Aug 2006 12:38:54 +0400 you wrote:

I've updated it yesterday and rebuilt - llvm built fine. But when
building llvm-gcc4 (also updated yesterday from new /trunk
directory) it fails with the same error.

You might easily get llvm-gcc4-mingw32 binaries from "prerelease"
directory. Since stdcall, fastcall & dllimport stuff is unsupported
right now, I don't see too much difference between cygwin & mingw
builds of llvm-gcc except the extended file names support of the former
(e.g. it can accept "/home/user/foo.c").

Could you please show us the contents of your llvm-confg file (it
should be in your /llvm/obj/Debug/bin/)

here it is:

#!/usr/bin/perl
##===- tools/llvm-config ---------------------------------------- perl --===##

here it is in the attachment :slight_smile:

llvm-config (18.4 KB)

Hello Anton

Thu, 3 Aug 2006 15:06:56 +0400 you wrote:

here it is in the attachment :slight_smile:

Well. There seems to be some additional dependencies not seen here.
Reid, is there any way to workaround this?

Hello,

Thu, 3 Aug 2006 15:41:58 +0400 you wrote:

> here it is in the attachment :slight_smile:
Well. There seems to be some additional dependencies not seen here.

I was wrong. There are some things looking very bad:

1. Line endings. CRLF mixed with CR. Also LF in the middle of the line
2. Two lines (around libLLVMTarget.a) looks merged together.

However, when I fix that problems i'm starting to get rather cryptic
messages about usage of uninitialized hash element. Will investigate :slight_smile:

Antons,

I think the line-ending problem is a red herring. I saved the file
directly from Anton's email on Linux and it looked fine. Perhaps it was
a cut & paste issue or some other artifact of saving the file on Windows
from email. In any event, it should not be delivered in that form via
CVS or a tarball.

The original symptom:
     > Can't find a library with no dependencies
        > at /llvm/obj/Debug/bin/llvm-config lin
        > e 420, <DATA> line 30.

is caused when llvm-config returns empty or no libraries back to the
llvm-gcc4 makefile system. We ran into this about a week ago and applied
some changes to llvm-config to correct the library dependencies and it
went away. That was to get llvm-config to work correctly on PPC/Darwin.
It looks like a similar process is needed for cygwin/mingw

I have replicated the problem using the llvm-config that Anton V
supplied. I'll take a look at what might be causing this.

Reid.

Hello Anton

Thu, 3 Aug 2006 15:06:56 +0400 you wrote:

here it is in the attachment :slight_smile:

Ok. Could you also send LibDeps.txt file? It should be
in /obj/tools/llvm-config directory

Hello Anton

Hello, Anton :slight_smile:

Thu, 3 Aug 2006 15:06:56 +0400 you wrote:

here it is in the attachment :slight_smile:
Ok. Could you also send LibDeps.txt file? It should be
in /obj/tools/llvm-config directory

It is attached.

I won’t be available for the next 10-12 hours if you’ll need some more files.

Thanks.

LibDeps.txt (3.4 KB)

Hello Anton

Thu, 3 Aug 2006 23:13:52 +0400 you wrote:

I won't be available for the next 10-12 hours if you'll need some more
files.

Well. I have one idea. Could you please execute "sort --version" from
your cygwin shell and let me know, whether it's GNU one (it should
reply with the words "textutils") or windows-supplied one (it should
just give you and error)?

It turned out ot be a GNU version.

sort (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License < http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and Paul Eggert.

I’ve updated llvm and llvm-gcc4 ant trying to build it again after PR845 was resolved. According to Reid’s letter this PR coud be the reason of my problem.

When I’ll have the results of llvm-gcc4 build I’ll report.

Hello Anton

Fri, 4 Aug 2006 21:45:19 +0400 you wrote:

Written by Mike Haertel and Paul Eggert.
I've updated llvm and llvm-gcc4 ant trying to build it again after
PR845 was resolved. According to Reid's letter this PR coud be the
reason of my problem.

Anyway, "sort" call can cause large problems depending, where in your
PATH cygwin directory is (before %SystemRoot%, or after). Another
question: is your perl a cygwin's supplied one?

Anton V,

While removing the cyclic dependencies will help, it may not be the
final solution. I think Anton K is onto something with the "sort"
output, there was also a regex pattern in llvm-config that needs to be
updated loosened up a bit. Anton K is checking these things now and
will commit them if successful. One more update (after Anton K is done)
might just do it.

Thanks for your help!

Reid.

LibDeps.txt (3.05 KB)

Yes, I didn’t install it myself.

llvm-gcc4 has built successfully.

Making install configuration now.

Will report about the result tomorrow.

Thanks.

install configuration built successfully too. llvm-gcc version is:
gcc version 4.0.1 LLVM <Apple Computer, Inc. build 5400>

how can I test it? I need to run make check in llvm/obj dir or in llvm-gcc/obj dir?

Thanks