This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: undefined reference to C++ constructs in libppl when linking cc1-dummy.exe


Hi,

On Tue, Aug 31, 2010 at 5:27 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> Hi,
>
> On Tue, Aug 31, 2010 at 4:39 PM, Doug Crawford <dcraw101@yahoo.com> wrote:
>> I am using crossstool-ng 1.8.1 built and hosted on cygwin and targeting powerpc
>> linux uclibc.? It successfully builds libbackend.a then tries to link
>> cc1-dummy.exe but that step generates a lot of errors related to undefined
>> references to exception handlers and other C++ standard library stuff in
>> libppl_c.a.
> Sounds like a known, recurrent, issue. See
> http://sourceware.org/ml/crossgcc/2010-07/msg00055.html and
> follow-ups. The patch will not work. The problem is that
> $(final_LDFLAGS) ends up before -lppl, whereas it should be placed
> after to resolve undefined symbol brought in by -lppl.
>
do'h... I'm obviously wrong.

>> If libppl_c.a contains c++ constructs shouldn't the link too be
>> i686_build_pc_cygwin_g++?
> No -g++ should not be used for the link, gcc is written (so far) in C
> and is only using the C interface to Cloog/PPL. The link fails only
> because we're using static companion libraries. You can enable shared
> companion libraries, with the C wrapper, it "may" work.
>
Actually, that might not be all that simple...

GCC 4.5 try to be clever:
gcc/Makefile.in:

# Libraries to use on the host.
HOST_LIBS = @HOST_LIBS@
[...]
ENABLE_BUILD_WITH_CXX = @ENABLE_BUILD_WITH_CXX@
ifneq ($(ENABLE_BUILD_WITH_CXX),yes)
COMPILER = $(CC)
COMPILER_FLAGS = $(CFLAGS)
LINKER = $(CC)
LINKER_FLAGS = $(CFLAGS)
else
COMPILER = $(CXX)
COMPILER_FLAGS = $(CXXFLAGS)
# If HOST_LIBS is set, then the user is controlling the libraries to
# link against.  In that case, link with $(CC) so that the -lstdc++
# library is not introduced.  If HOST_LIBS is not set, link with
# $(CXX) to pick up -lstdc++.
ifeq ($(HOST_LIBS),)
LINKER = $(CXX)
LINKER_FLAGS = $(CXXFLAGS)
else
LINKER = $(CC)
LINKER_FLAGS = $(CFLAGS)
endif
endif

[...]

BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
        $(ZLIB) $(LIBELFLIBS)

[...]

cc1-dummy$(exeext): $(C_OBJS) dummy-checksum.o $(BACKEND) $(LIBDEPS)
        $(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) \
          dummy-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)


Not GCC 4.4:

BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS)

[...]

cc1-dummy$(exeext): $(C_OBJS) dummy-checksum.o $(BACKEND) $(LIBDEPS)
    $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) dummy-checksum.o \
    $(BACKEND) $(LIBS) $(BACKENDLIBS)

but the problem remains open. If my tree is not too broken, I'll give
it a try tonight; it's been a long time I didn't touch gcc 4.4 :)

A.

>> I have included the relevant error from
>> the log.? The complete log is here: http://pastebin.com/Ugsy55a5
>> ? ? ? ?1. i686-build_pc-cygwin-gcc ?-pipe -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE ?-W
>> -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
>> -Wold-style-definition -Wc++-compat -Wmissing-format-attribute -pedantic
>> -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings ? -DHAVE_CONFIG_H
>> -lstdc++ -lm -Wl,--stack,8388608 -o cc1-dummy.exe c-lang.o stub-objc.o attribs.o
>> c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o c-aux-info.o
>> c-common.o c-opts.o c-format.o c-semantics.o c-ppoutput.o c-cppbuiltin.o
>> c-objc-common.o c-dump.o c-pch.o c-parser.o rs6000-c.o c-gimplify.o
>> tree-mudflap.o c-pretty-print.o c-omp.o dummy-checksum.o ? ? ? ? ? main.o
>> ?libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a
>> ../libcpp/libcpp.a ?-liconv ../libiberty/libiberty.a
>> ../libdecnumber/libdecnumber.a
>> -L/opt/x-tools/targets/powerpc-860-linux-uclibc/build/static/lib -lcloog
>> -L/opt/x-tools/targets/powerpc-860-linux-uclibc/build/static/lib -lppl_c -lppl
>> -lgmpxx ?-L/opt/x-tools/targets/powerpc-860-linux-uclibc/build/static/lib
>> -L/opt/x-tools/targets/powerpc-860-linux-uclibc/build/static/lib -lmpfr -lgmp
>> ? ? ? ?2. [ALL ?]
>> ?/opt/x-tools/targets/powerpc-860-linux-uclibc/build/static/lib/libppl_c.a(ppl_c_BD_Shape_mpz_class.o):ppl_c_BD_Shape_mpz_class.cc:(.text+0xf6):
>> ?undefined reference to `___cxa_begin_catch'
>> ? ? ? ?3. [ALL ?]
>> ?/opt/x-tools/targets/powerpc-860-linux-uclibc/build/static/lib/libppl_c.a(ppl_c_BD_Shape_mpz_class.o):ppl_c_BD_Shape_mpz_class.cc:(.text+0x10f):
>> ?undefined reference to `___cxa_end_catch'
>>
>>
>>
>>
>> --
>> For unsubscribe information see http://sourceware.org/lists.html#faq
>>
>>
>

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]