[LLVMdev] gfortran: link error building gfortran on linux

Chris Lattner sabre at nondot.org
Mon Sep 11 14:48:48 PDT 2006


On Fri, 8 Sep 2006, Michael McCracken wrote:
> Hi, in trying to build an llvm-gfortran on linux from today's gcc4
> SVN, I get the following link errors that didn't show up on OS X. This
> is also using LLVM CVS from this morning.

ok

> They appear to mostly be related to CodeWarrior compatibility code,
> but a couple are less obvious.
> What's the best way to fix this? I'm stuck without my powerbook for at
> least three weeks and I'd like to keep working on llvm-gfortran in
> Linux in the meantime.

I'm not sure what the best way to fix this is.  These functions are 
defined in c-common.c.  Lemme guess, fortran doesn't use c-common.o :).

cw-asm support was hacked into the apple compiler in a pretty ugly way. 
If possible, one solution might be to link c-common.o into gfortran: I'm 
not sure if it would work.  If that doesn't work, we can move the cw-asm 
support stuff from c-common.c to some other .c file that is generally 
available.  Alternatively, we could #ifdef out the referneces if not 
compiling the C compiler.

I'm not sure what the best approach is.

-Chris

> Here's how I configured and built it:
>
> % ../src/configure --prefix=/home/mmccrack/gfortran-llvm/install
> --enable-llvm=/home/mmccrack/gfortran-llvm/llvm-obj --enable-checking
> --disable-threads --enable-languages=c,c++,f95
>
> % make LLVM_VERSION_INFO="20060908+f95"
>
> ...snip lots of compilations...
>
>
> c++ -c -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -pedantic
> -Wno-long-long -Wno-variadic-macros -fno-common -DHAVE_CONFIG_H
> -Wno-unused -DTARGET_NAME=\"i686-pc-linux-gnu
> \" -DENABLE_LLVM -D__STDC_LIMIT_MACROS
> -DLLVM_VERSION_INFO='"20060908+f95"'   -I. -I. -I../../src/gcc
> -I../../src/gcc/. -I../../src/gcc/../include -I../../src/gcc/../l
> ibcpp/include  -I/home/mmccrack/gfortran-llvm/llvm-cvs/include
> -I/home/mmccrack/gfortran-llvm/llvm-obj/include
> ../../src/gcc/llvm-debug.cpp -o llvm-debug.o
> gcc -c   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings
> -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long
> -Wno-variadic-macros -Wold-style-definition -fno-
> common   -DHAVE_CONFIG_H -DENABLE_LLVM -D__STDC_LIMIT_MACROS
> -DLLVM_VERSION_INFO='"20060908+f95"'   -I. -I. -I../../src/gcc
> -I../../src/gcc/. -I../../src/gcc/../includ
> e -I../../src/gcc/../libcpp/include
> -I/home/mmccrack/gfortran-llvm/llvm-cvs/include
> -I/home/mmccrack/gfortran-llvm/llvm-obj/include \
>   ../../src/gcc/config/i386/i386.c -o i386.o
> ../../src/gcc/config/i386/i386.c:1735: warning: no previous prototype
> for 'reset_optimization_options'
> ../../src/gcc/config/i386/i386.c: In function 'ix86_file_end':
> ../../src/gcc/config/i386/i386.c:4304: warning: implicit declaration
> of function 'text_coal_section'
> ../../src/gcc/config/i386/i386.c: In function 'ix86_expand_move':
> ../../src/gcc/config/i386/i386.c:8087: warning: unused variable 'insn'
> ../../src/gcc/config/i386/i386.c: In function 'ix86_expand_convert_DI2DF_sse':
> ../../src/gcc/config/i386/i386.c:8895: warning: large integer
> implicitly truncated to unsigned type
>
> ...snip lots of compilations...
>   # APPLE LOCAL LLVM
> c++   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes
> -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros
> -Wold-style-definition -fno-common   -DHAVE_CONFIG_H  -o f951 \
>   fortran/arith.o fortran/array.o fortran/bbt.o fortran/check.o
> fortran/data.o fortran/decl.o fortran/dump-parse-tree.o
> fortran/error.o fortran/expr.o fortran/interface.o fortran/intrinsic.o
> fortran/io.o fortran/iresolve.o fortran/match.o fortran/matchexp.o
> fortran/misc.o fortran/module.o fortran/options.o fortran/parse.o
> fortran/primary.o fortran/resolve.o fortran/scanner.o
> fortran/simplify.o fortran/st.o fortran/symbol.o fortran/convert.o
> fortran/dependency.o fortran/f95-lang.o fortran/trans.o
> fortran/trans-array.o fortran/trans-common.o fortran/trans-const.o
> fortran/trans-decl.o fortran/trans-expr.o fortran/trans-intrinsic.o
> fortran/trans-io.o fortran/trans-stmt.o fortran/trans-types.o
> llvm-main.o tree-browser.o libbackend.a ../libcpp/libcpp.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMTransforms.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMipo.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMBCWriter.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/LLVMX86.o
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMSelectionDAG.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMCodeGen.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMScalarOpts.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMTransformUtils.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMipa.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMAnalysis.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMTarget.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMCore.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMSupport.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMbzip2.a
> /home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib/libLLVMSystem.a -lmpfr
> -lgmp ../libcpp/libcpp.a   ../libiberty/libiberty.a
> -L/home/mmccrack/gfortran-llvm/llvm-obj/Debug/lib  -lpthread -ldl -lm
> libbackend.a(i386.o)(.text+0x13aa5): In function
> `ix86_make_regparmandstackparmee':
> ../../src/gcc/config/i386/i386.c:17940: undefined reference to `decl_attributes'
> libbackend.a(i386.o)(.text+0x14438): In function
> `ix86_darwin_handle_regparmandstackparm':
> ../../src/gcc/config/i386/i386.c:18249: undefined reference to
> `build_function_call'
> libbackend.a(i386.o)(.text+0x144bf):../../src/gcc/config/i386/i386.c:18267:
> undefined reference to `build_modify_expr'
> libbackend.a(i386.o)(.text+0x155c8): In function `x86_canonicalize_operands':
> ../../src/gcc/config/i386/i386.c:18552: undefined reference to
> `cw_build_bracket'
> libbackend.a(i386.o)(.text+0x15e17): In function `cw_print_op':
> ../../src/gcc/config/i386/i386.c:18886: undefined reference to
> `print_cw_asm_operand'
> libbackend.a(i386.o)(.text+0x15ef8):../../src/gcc/config/i386/i386.c:18836:
> undefined reference to `print_cw_asm_operand'
> libbackend.a(i386.o)(.text+0x15f3b):../../src/gcc/config/i386/i386.c:18850:
> undefined reference to `cw_force_constraint'
> libbackend.a(i386.o)(.text+0x15f54):../../src/gcc/config/i386/i386.c:18851:
> undefined reference to `print_cw_asm_operand'
> libbackend.a(i386.o)(.text+0x15f61):../../src/gcc/config/i386/i386.c:18853:
> undefined reference to `cw_force_constraint'
> libbackend.a(i386.o)(.text+0x15fa1):../../src/gcc/config/i386/i386.c:18863:
> undefined reference to `cw_force_constraint'
> libbackend.a(i386.o)(.text+0x15fbc):../../src/gcc/config/i386/i386.c:18864:
> undefined reference to `print_cw_asm_operand'
> libbackend.a(i386.o)(.text+0x15fc9):../../src/gcc/config/i386/i386.c:18866:
> undefined reference to `cw_force_constraint'
> libbackend.a(i386.o)(.text+0x16009):../../src/gcc/config/i386/i386.c:18871:
> undefined reference to `print_cw_asm_operand'
> libbackend.a(i386.o)(.text+0x16092):../../src/gcc/config/i386/i386.c:18892:
> undefined reference to `print_cw_asm_operand'
> libbackend.a(i386.o)(.text+0x160e9):../../src/gcc/config/i386/i386.c:18895:
> undefined reference to `print_cw_asm_operand'
> libbackend.a(i386.o)(.text+0x16219):../../src/gcc/config/i386/i386.c:18774:
> undefined reference to `cw_force_constraint'
> libbackend.a(i386.o)(.text+0x16250):../../src/gcc/config/i386/i386.c:18777:
> undefined reference to `cw_asm_get_register_var'
> libbackend.a(i386.o)(.text+0x1625d):../../src/gcc/config/i386/i386.c:18778:
> undefined reference to `cw_force_constraint'
> collect2: ld returned 1 exit status
> make[1]: *** [f951] Error 1
> make[1]: Leaving directory `/home/mmccrack/gfortran-llvm/obj/gcc'
> make: *** [all-gcc] Error 2
>
>

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list