RE: [LLVMdev] Building llvm and cfrontend under cygwin

Hi Chris,

Also note, LLVM 1.4 will be released in the next few days, so if

waiting is

an option, you might choose to do so.

Alright, I've got llvm and llvm-gcc from RELEASE_14 cvs and tried
building it under cygwin.

1) The first problem is with llvm in SysUtils.c:
int executeProgram(const char *filename, char *const argv, char *const
envp)
{
  ................
  execveTy execvePtr = (execveTy) dlsym(RTLD_NEXT, "execve");
  .....
}

RTLD_NEXT is not defined in cygwin headers.

2) cfontend built ok
3) full llvm failed to build:

make[3]: Entering directory
`/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend'
llvm[3]: Compiling Exception.cpp for Debug build (bytecode)
llvm[3]: Linking comp_genericeh.bc component...
llvm[3]: Compiling crtend.c for Debug build (bytecode)
llvm[3]: Compiling listend.ll for Debug build
llvm[3]: Linking comp_main.bc component...
assertion "(Result->isFirstClassType() || Result == Type::VoidTy ||
isa<OpaqueType>(Result)) && "LLVM functions cannot return aggregates""
failed: file "Type.cpp", line 373
make[3]: ***
[/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/comp_main.
bc] Error 1
make[3]: Leaving directory
`/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend'
make[2]: *** [crtend/.makeall] Error 2
make[2]: Leaving directory
`/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries'
make[1]: *** [GCCLibraries/.makeall] Error 2
make[1]: Leaving directory `/cygdrive/d/3rd-party/llvm/runtime'
make: *** [all] Error 1

Here is the output of "make VERBOSE=1" executed after "make clean" in
`/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend':

/cygdrive/d/3rd-party/llvm/autoconf/mkinstalldirs
/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug > /dev/null
/usr/bin/date >
/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/.dir
llvm[0]: Compiling Exception.cpp for Debug build (bytecode)
if
PATH=/cygdrive/d/3rd-party/llvm/Debug/bin:/cygdrive/d/3rd-party/llvm/Deb
ug/bin:/usr/local/bin:/usr/bin:/bin
/cygdrive/d/3rd-party/cfrontend/install/bin/g++
-I/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend
-I/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend
-I/cygdrive/d/3rd-party/llvm/include
-I/cygdrive/d/3rd-party/llvm/include
-I/cygdrive/d/3rd-party/llvm/include
-I/cygdrive/d/3rd-party/llvm/include -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
-Wall -W -Wwrite-strings -Wno-unused -g -D_DEBUG -c -Wa,-strip-debug
-MD -MT
/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/Exception.b
c -MP -MF
"/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/Exception.
BCCXXd" Exception.cpp -o
/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/Exception.b
c ; \
then /usr/bin/mv -f
"/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/Exception.
BCCXXd"
"/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/Exception.
d"; \
else /usr/bin/rm -f
"/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/Exception.
BCCXXd"; exit 1; fi
llvm[0]: Linking comp_genericeh.bc component...
/cygdrive/d/3rd-party/llvm/Debug/bin/gccld.exe -link-as-library \
-internalize-public-api-file=/cygdrive/d/3rd-party/llvm/runtime/GCCLibra
ries/crtend/comp_genericeh.lst \
/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/Exception.b
c -o
/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/comp_generi
ceh.bc
llvm[0]: Compiling crtend.c for Debug build (bytecode)
if
PATH=/cygdrive/d/3rd-party/llvm/Debug/bin:/cygdrive/d/3rd-party/llvm/Deb
ug/bin:/usr/local/bin:/usr/bin:/bin
/cygdrive/d/3rd-party/cfrontend/install/bin/gcc
-I/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend
-I/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend
-I/cygdrive/d/3rd-party/llvm/include
-I/cygdrive/d/3rd-party/llvm/include
-I/cygdrive/d/3rd-party/llvm/include
-I/cygdrive/d/3rd-party/llvm/include -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
-Wall -W -Wwrite-strings -Wno-unused -g -D_DEBUG -c -Wa,-strip-debug
-MD -MT
/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/crtend.bc
-MP -MF
"/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/crtend.BCC
d" crtend.c -o
/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/crtend.bc ;
\
then /usr/bin/mv -f
"/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/crtend.BCC
d"
"/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/crtend.d";
\
else /usr/bin/rm -f
"/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/crtend.BCC
d"; exit 1; fi
llvm[0]: Compiling listend.ll for Debug build
/cygdrive/d/3rd-party/llvm/Debug/bin/llvm-as.exe listend.ll -f -o
/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/listend.bc
llvm[0]: Linking comp_main.bc component...
/cygdrive/d/3rd-party/llvm/Debug/bin/gccld.exe -link-as-library \
-internalize-public-api-file=/cygdrive/d/3rd-party/llvm/runtime/GCCLibra
ries/crtend/comp_main.lst \
/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/crtend.bc
/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/listend.bc
-o
/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/comp_main.b
c
assertion "(Result->isFirstClassType() || Result == Type::VoidTy ||
isa<OpaqueType>(Result)) && "LLVM functions cannot return aggregates""
failed: file "Type.cpp", line 373
make: ***
[/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend/Debug/comp_main.
bc] Error 1

Thanks,
Oleg.

Hi Chris,

> Also note, LLVM 1.4 will be released in the next few days, so if
waiting is
> an option, you might choose to do so.
Alright, I've got llvm and llvm-gcc from RELEASE_14 cvs and tried
building it under cygwin.

1) The first problem is with llvm in SysUtils.c:
int executeProgram(const char *filename, char *const argv, char *const
envp)
{
  ................
  execveTy execvePtr = (execveTy) dlsym(RTLD_NEXT, "execve");
  .....
}

RTLD_NEXT is not defined in cygwin headers.

Yeah, that's bad. Unfortunately, there's not much I can do about that
for 1.4. You should know that my focus for 1.5 is to make LLVM
completely portable by putting all the code that varies from platform to
platform into lib/System. This is partially implemented but there is
much more work to do.

2) cfontend built ok
3) full llvm failed to build:

make[3]: Entering directory
`/cygdrive/d/3rd-party/llvm/runtime/GCCLibraries/crtend'
llvm[3]: Compiling Exception.cpp for Debug build (bytecode)
llvm[3]: Linking comp_genericeh.bc component...
llvm[3]: Compiling crtend.c for Debug build (bytecode)
llvm[3]: Compiling listend.ll for Debug build
llvm[3]: Linking comp_main.bc component...
assertion "(Result->isFirstClassType() || Result == Type::VoidTy ||
isa<OpaqueType>(Result)) && "LLVM functions cannot return aggregates""
failed: file "Type.cpp", line 373

I don't know what's up with that, but I'll do a cygwin build and see
what is happening.

Reid.