FreeBSD 10 and manually compile applications without gcc
rsmith at xs4all.nl
Tue Jan 20 18:52:08 UTC 2015
On Mon, Jan 19, 2015 at 01:47:28PM +0000, Matthew Seaman wrote:
> On 2015/01/19 13:29, Odhiambo Washington wrote:
> > Now, suppose I did not install gcc from the ports and I'd like to install
> > an application by hand using native tools for FreeBSD 10.x, how do I do
> > that?
> > I need a lecture on this:-)
> This is exactly why the ports exists: the port maintainer understands
> how to make whatever software it is compile smoothly and generally do
> what you want, so you don't have to.
So true. :-)
But if you want to become a power user it is very useful to study how this
> If you insist on building your own de-novo, then you are going to need
> to crawl up that fairly steep learning curve. I'm afraid I cannot
> deliver a simple lecture on 'do this, and it will work' because, well,
> it's not simple at all.
Every journey begins with a first step. :-)
Running ./configure --help can be helpful. It shows what the possible options
and environment variables are.
> Your first hurdle seems to be getting configure to choose consistent
> settings. configure is expecting 'cc' on FreeBSD 10.x to actually be
> clang -- which is what it usually is. If you want to use gcc instead,
> then you need to tell configure that, which you usually do by setting
> the CC environment variable when you call configure.
Usually, the configure from gnu autoconf expects gcc? I think that the default
usage of clang is a feature of the ports tree. At least I often see a message
like "patching auto** for FreeBSD 10" whizzing by when compiling a port.
In general you have to set some environment variables for configure to use
clang. For another app that I needed to compile outside of the ports tree I
had to do something like this;
env LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include CC=clang \
CXX=clang++ CFLAGS=-O2 ./configure <configure arguments for the app>
You generally have to use ‘gmake’ instead of ‘make’, since
autotools Makefiles require extensions that only exist in gmake.
In the best case the program doesn't require FreeBSD specific patches and the
abovementioned commands work. But since the FreeBSD port of squid *does*
contain FreeBSD specific patches (see in this case
“/usr/ports/www/squid/files/patch-*”), you might need to apply these as well
to get the compile to work.
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 5753 3324 1661 B0FE 8D93 FCED 40F6 D5DC A38A 33E0 (keyID: A38A33E0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 819 bytes
Desc: not available
More information about the freebsd-questions