libc.a Undefined references.

Hi all. I'm trying to build a completely static userland, and most things work fine simply having
Code:
LDFLAGS=-static
in /etc/src.conf.

However some builds fail with undefined references to environ and __getprogname.

Usually this is fixed by adding some library to your linker flags, but I'm not sure which library should have this, I thought it was defined in libc. Out of about 700 packages or so I've been building statically, this is the error I get about 95% of the time, if something fails. Most packages are fine, and a few programs have bugs (I guess) that are only exposed when linked statically.

Thanks I advance, and congratulations to the freebsd FreeBSD developers getting KMS for my new Intel card to work fairly well, in a pretty short time :e
 
kolbycrouch said:
Out of about 700 packages or so I've been building statically, this is the error I get about 95% of the time, if something fails. Most packages are fine, and a few programs have bugs (I guess) that are only exposed when linked statically.
Settings in src.conf only apply to the kernel and userland tools of the base OS. They do nothing for ports.

The src.conf file contains settings that will apply to every build involving the FreeBSD source tree; see build(7).
From src.conf(5)

As for the option, you really should apply it like this:
Code:
LDFLAGS+=-static
This will add the option. In your case it will replace all the options with -static.
 
Undefined references

I get undefined references to environ and __progname from libc.a when linking certain programs statically. What I'm wanting to know, is if there is anyway to force libc to build with those symbols defined, or is there any way I can use objdump to define it?
 
Back
Top