Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: fsck seg fault failure on vmware -i386?

On Fri, 12 Feb 2010, Robert Elz wrote:

>   | - I've compiled libc with DBG=-g in the libc Makefile.
>   |    o This did not produce libc_g.a in /usr/obj/lib/libc
> No, I don't see anything that would ever make an _g.a version of the
> library, I think whoever suggested that might have been mistaken.

All the makefile magic is /usr/share/mk.  If you look at 
/usr/share/mk/bsd.README it describes a lot of tweakable knobs.  For 

MKDEBUGLIB      Build *_g.a debugging libraries, which are compiled
                with -DDEBUG.
                Default: no

MKDYNAMICROOT   If "no", build programs in /bin and /sbin statically,
                don't install certain libraries in /lib, and don't
                install the shared linker into /libexec.
                Default: yes


LDSTATIC        Control program linking; if set blank, link everything
                dynamically.  If set to "-static", link everything 
                If not set, programs link according to their makefile.

> Anyway, I suspect that perhaps the DBG=-g way of compiling with -g
> might have been the wrong way, the library would have been compiled with
> -g (and no -O options), and then all the symbols carefully added, thrown
> away as COPTS doesn't contain -g.   The COPTS+=-g might have worked a lot
> better (though that way doesn't disable optimisation).   But without looking
> at the libc.a that you have I can't be certain,    But I kind of suspect
> that you might need to build again.

DBG is supposed to be used for the compiler optimization flags.  By 
default it's -O2.  If you want a debug build you can set it to DBG=-g.  If 
you want an optimized debug build use DBG="-g -O2".

All these things can be set on the make command line.

I'd recommend:

make DBG="-g -O2" MKDEBUGLIB=yes LDSTATIC=-static

but you may need to play around with other things since the stuff in 
share/mk changes often and sometimes certain combinations of options don't 
work the way you expect.


Home | Main Index | Thread Index | Old Index