Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Feb 2012 19:19:00 +0100
From:      Artifex Maximus <artifexor@gmail.com>
To:        "Julian H. Stacey" <jhs@berklix.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: clang vs gcc linking problem
Message-ID:  <CAPkuXvEZwcaG4_9ceTnsZiVR9o6yWruymG22b=Mqwiz5Qotzeg@mail.gmail.com>
In-Reply-To: <201202260003.q1Q035OW083472@fire.js.berklix.net>
References:  <CAPkuXvFc7q03DYE1TJi8UP3EJiY8YxdpDPkhJZHkDEKwfw2MKg@mail.gmail.com> <201202260003.q1Q035OW083472@fire.js.berklix.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Feb 26, 2012 at 1:03 AM, Julian H. Stacey <jhs@berklix.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPkuXvEZwcaG4_9ceTnsZiVR9o6yWruymG22b=Mqwiz5Qotzeg>