From owner-freebsd-questions@FreeBSD.ORG Mon Feb 27 18:19:02 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12CBC106566B for ; Mon, 27 Feb 2012 18:19:02 +0000 (UTC) (envelope-from artifexor@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id C79178FC24 for ; Mon, 27 Feb 2012 18:19:01 +0000 (UTC) Received: by obbwc7 with SMTP id wc7so785965obb.13 for ; Mon, 27 Feb 2012 10:19:01 -0800 (PST) Received-SPF: pass (google.com: domain of artifexor@gmail.com designates 10.60.5.231 as permitted sender) client-ip=10.60.5.231; Authentication-Results: mr.google.com; spf=pass (google.com: domain of artifexor@gmail.com designates 10.60.5.231 as permitted sender) smtp.mail=artifexor@gmail.com; dkim=pass header.i=artifexor@gmail.com Received: from mr.google.com ([10.60.5.231]) by 10.60.5.231 with SMTP id v7mr2628436oev.50.1330366741183 (num_hops = 1); Mon, 27 Feb 2012 10:19:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SainG0breKD+wStPycw8PtryDE/GxMRC8c3E49KFDJI=; b=PmbdgmlBTG8W9IEbu7Yq6aU+aHttyP/PPO5QhnjCQP8KQJDYXW+EGz7+awxf0BS+Vq GLkKDAKh+5mD45+xTt/9g5h2BiFWSIrQ112SH5uaVuoBIfKji1zUPrPh3q8KazS8GIKd Rc0yi4SIpO9cHSjMIPnfr/EAOKRJ0AppFyIUo= MIME-Version: 1.0 Received: by 10.60.5.231 with SMTP id v7mr2327997oev.50.1330366741117; Mon, 27 Feb 2012 10:19:01 -0800 (PST) Received: by 10.60.15.161 with HTTP; Mon, 27 Feb 2012 10:19:00 -0800 (PST) In-Reply-To: <201202260003.q1Q035OW083472@fire.js.berklix.net> References: <201202260003.q1Q035OW083472@fire.js.berklix.net> Date: Mon, 27 Feb 2012 19:19:00 +0100 Message-ID: From: Artifex Maximus To: "Julian H. Stacey" Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-questions@freebsd.org Subject: Re: clang vs gcc linking problem X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Feb 2012 18:19:02 -0000 On Sun, Feb 26, 2012 at 1:03 AM, Julian H. Stacey wrote: > Artifex Maximus wrote: > > Hello! > > > > Absolutely not a flame war but would like to switch to clang in a > > project. Project uses ncurses. gcc works well but the executable fails > > when compiled other than -O0. Then I think I should change to clang > > which will becomes the default compiler in FreeBSD. With clang at > > linking time I got the following error: > > > > /usr/local/bin/ld: display/libsub_display.a(canvas.o): undefined > > reference to symbol 'keypad' > > /usr/local/bin/ld: note: 'keypad' is defined in DSO > > /usr/local/lib/libtinfow.so.6.0 so try adding it to the linker command > > line > > /usr/local/lib/libtinfow.so.6.0: could not read symbols: Invalid > operation > > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > > *** Error code 1 > > > > With exactly the same flags gcc links successful. Any idea where is > > the problem and what is the solution? > > > > Thanks, > > There have been quite a number of discussions on Gcc & Clang > of various lists since efforts to transition started, > I don't see a specific list here, > http://lists.freebsd.org/mailman/listinfo > but this may interest > http://wiki.freebsd.org/BuildingFreeBSDWithClang > Thanks. I did not found any related information on link but finally found a solution. I have to add -ltinfo to LDFLAGS. I still do not know why gcc works without and why clang needs that. Bye, a