From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18485 invoked by alias); 30 Dec 2011 19:41:25 -0000 Received: (qmail 18475 invoked by uid 22791); 30 Dec 2011 19:41:23 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Dec 2011 19:41:08 +0000 From: "ramon.garcia.freesw at gmx dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/51720] New: Build issue. stage1 ldflags not correctly used Date: Fri, 30 Dec 2011 21:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ramon.garcia.freesw at gmx dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-12/txt/msg02846.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51720 Bug #: 51720 Summary: Build issue. stage1 ldflags not correctly used Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassigned@gcc.gnu.org ReportedBy: ramon.garcia.freesw@gmx.com In order to build GCC with shared libraries libcloog and libppl, that have been previously installed in /opt/gcc-4.6/lib, one executes configure with the following options ../gcc-4.6.2/configure --prefix=/opt/gcc-4.6 --with-ppl=/opt/gcc-4.6 --with-cloog=/opt/gcc-4.6 --enable-gold --enable-languages=c,c++,ada,fortran,go -with-stage1-ldflags="-Wl,-rpath=/opt/gcc-4.6/lib -static-libgcc -static-libstdc++" --with-boot-ldflags="-Wl,-rpath=/opt/gcc-4.6/lib -static-libgcc -static-libstdc++" But the compiler built in the stage1 phase does not find libppl and libcloog: > ./gcc/cc1 ./gcc/cc1: error while loading shared libraries: libcloog.so.0: cannot open shared object file: No such file or directory becuase the stage1 ldflags are not correctly passed The issue comes from the top level Makefile. The invocation of the stage1 build correctly passes stage1 ldflags as part of the HOST_EXPORTS. But in the submake invocation, it also passes $(BASE_FLAGS_TO_PASS), that sets LDFLAGS to empty, and has higher priority. .PHONY: all-stage1-gcc maybe-all-stage1-gcc .PHONY: clean-stage1-gcc maybe-clean-stage1-gcc maybe-all-stage1-gcc: maybe-clean-stage1-gcc: maybe-all-stage1-gcc: all-stage1-gcc all-stage1: all-stage1-gcc TARGET-stage1-gcc = $(TARGET-gcc) all-stage1-gcc: configure-stage1-gcc @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE1_TFLAGS)"; \ $(HOST_EXPORTS) \ cd $(HOST_SUBDIR)/gcc && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGE1_CFLAGS)" \ CXXFLAGS="$(STAGE1_CXXFLAGS)" \ LIBCFLAGS="$(LIBCFLAGS)" \ CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) \ TFLAGS="$(STAGE1_TFLAGS)" \ $(TARGET-stage1-gcc) Suggestions: a) include LDFLAGS="$(STAGE1_LDFLAGS)" in this invocation b) remove LDFLAGS from BASE_FLAGS_TO_PASS, and include it everywhere it may be needed. So LDFLAGS setting from HOST_EXPORTS will take priority