From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward501o.mail.yandex.net (forward501o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::611]) by sourceware.org (Postfix) with ESMTPS id 9DA74385481A for ; Tue, 3 Nov 2020 14:01:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9DA74385481A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ivanov.email Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vlad@ivanov.email Received: from mxback8o.mail.yandex.net (mxback8o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::22]) by forward501o.mail.yandex.net (Yandex) with ESMTP id 658BE1E806DF for ; Tue, 3 Nov 2020 17:01:43 +0300 (MSK) Received: from localhost (localhost [::1]) by mxback8o.mail.yandex.net (mxback/Yandex) with ESMTP id fpfttYGdar-1gDufT7Z; Tue, 03 Nov 2020 17:01:42 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ivanov.email; s=mail; t=1604412102; bh=32JN6Ck6VuEcomWpgrb0WF3cunuADTSLpHPdlGJu01k=; h=References:Date:Message-Id:Subject:In-Reply-To:To:From; b=PSwEzIGVKk6QX0J61yqhWiDy2t7beD0YFjN9wpVEcUygjyga/hhWjAwPH6KgyPBFb id7dg7ACSlZYszzUsxsug2mN/JVIWOAbl59parBg0YwPhMaasYvtu0OSAANWUemcOB P9+NK/uBrh2VAYwhkpweLIzpuNKyFd3VlhNOOgUU= Authentication-Results: mxback8o.mail.yandex.net; dkim=pass header.i=@ivanov.email Received: by iva1-3b1c0a1a240c.qloud-c.yandex.net with HTTP; Tue, 03 Nov 2020 17:01:42 +0300 From: Vlad Ivanov To: "newlib@sourceware.org" In-Reply-To: <2582251604400981@mail.yandex.ru> References: <2582251604400981@mail.yandex.ru> Subject: Re: Configuring newlib for cross-compilation with clang MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Tue, 03 Nov 2020 17:01:42 +0300 Message-Id: <19355181604411963@mail.yandex.ru> Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 14:01:48 -0000 For anyone stumbling upon this, the problem was caused by wrong options. Instead of CC and CFLAGS, one must use CC_FOR_TARGET and CFLAGS_FOR_TARGET. One thing I noticed is that newlib is largely gcc-centric, and while it seems it can be built with clang for some targets, that is not the case with powerpc. 03.11.2020, 14:08, "Vlad Ivanov" : > Hello, > > I'm trying to build newlib for a PowerPC embedded target to assemble a complete > toolchain with clang. I need to use clang as a cross compiler; clang and llvm > are the only tools available. The resulting toolchain targets bare metal > environment. > > Here's the command I'm using: > > ../newlib-cygwin/configure \ >     --prefix=/opt/newlib-powerpc/install \ >     --disable-libstdcxx \ >     --disable-shared \ >     --enable-static \ >     --disable-multilib \ >     --target=powerpc-none-eabi \ >     --disable-newlib-supplied-syscalls \ >     --enable-newlib-nano-malloc \ >     --enable-target-optspace \ >     --disable-newlib-multithread \ >     --disable-newlib-io-float \ >     --enable-lite-exit \ >      CC='/usr/bin/clang' >      CFLAGS='--target=powerpc-none-eabi' > > I see an error early during configuration: > > checking for C compiler default output file name... > configure: error: in `/opt/newlib-powerpc/build': > configure: error: C compiler cannot create executables > See `config.log' for more details. > > Now, this error occurs because the configure script tries to compile an > executable and it's expecting to see something like a.out. But for an > embedded target, to link an executable, one needs a linker scripts to define > the memory layout, since there's no OS loading the binary. So any tests > that create executables will fail. > > Is it possible to tell newlib to not compile any executables? Or should I > use something like a dummy linker script? > > Best Regards, > > Vlad