Solved Some of my setting in .tcshrc break "make buildworld"?

I find out that some of my setting in .tcshrc disturb make buildworld so its crashed with an unspecific error message.
In some logs I created with:
date > _done.log
make buildworld > buildworld.log && echo "done" >> _done.log && date >> _done.log &
I see that in a very long command line of ar -crD libc_pic.a ................ are mixed parts of other commands. This has happens minimum in twice builds and I count, that 14 times the command line of "ar" was cut with some other strings.

Without a ~/.tcshrc file the make buildworld ends without any error.
I have tested some settings in ~/.tcshrc and the result was fine, but I cannot do this for every line because every build takes approximately 4 hours.

Some settings in ~/.tcshrc I tested without any error; but these are at most alias and language settings.

This are the rest of settings in my ~/.tcshrc I graped form a book or form some tips elsewhere.
Have anyone a idea what setting is there possibly wrong so make buildworld can not build?

set autolist                 # ..
set filec                    # ..
set autoexpand               # ..
set addsuffix                # ..

set   EDITOR       ee
set   PAGER       most

set history  = 300
set histfile = "$HOME/.history"
set savehist = ( 1000 merge )
alias h  'history 300'
alias hr 'history -r 300'   #recursive

set LSCOLORS = "Exfxcxdxbxegedabagacad"

# Color settings for the GNU ls command
# Black       00;30     Dark Gray     01;30
# Blue        00;34     Light Blue    01;34
# Green       00;32     Light Green   01;32
# Cyan        00;36     Light Cyan    01;36
# Red         00;31     Light Red     01;31
# Purple      00;35     Light Purple  01;35
# Brown       00;33     Yellow        01;33
# Light Gray  00;37     White         01;37
setenv LS_COLORS 'no=00:fi=00:di=01;34:ln=01;35:pi=01;34:so=01;34:bd=01;34:cd=01;34:or=01;35:mi=01;35:ex=01;32:*.tar=01;31:*.gz=01;31:*.tgz=01;31:*.arj=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.bz2=01;31:*.rpm=01;31:*.sit=01;31:*.sitx=01;31:*.jar=01;31:*.sea=01;31:*.rar=01;31:*.zoo=01;31:*.uu=01;31:*.uue=01;31:*.yenc=01;31:*.hqx=01;31:*.lha=01;31:*.cab=01;31:*.7z=01;31:*.arc=01;31:*.jpg=01;33:*.jpeg=01;33:*.png=01;33:*.gif=01;33:*.bmp=01;33:*.tif=01;33:*.tiff=01;33:*.psd=01;33:*.pdd=01;33:*.eps=01;33:*.tga=01;33:*.pgm=01;33:*.psp=01;33:*.pic=01;33:*.ps2=01;33:*.dcs=01;33:*.iff=01;33:*.pct=01;33:*.pcx=01;33:*.pxr=01;33:*.sct=01;33:*.stn=01;33:*.xbm=01;33:*.xpm=01;33:*.mpg=01;35:*.mpeg=01;35:*.mp2=01;35:*.avi=01;35:*.mov=01;35:*.qt=01;35:*.divx=01;35:*.asf=01;35:*.wmv=01;35:*.wm=01;35:*.wma=01;35:*.cda=01;35:*.ogg=01;35:*.mp3=01;35:*.m4a=01;35:*.m4p=01;35:*.mp4=01;35:*.wav=01;35:*.au=01;35:*.mid=01;35:*.midi=01;35:*.aif=01;35:*.aiff=01;35:*.ra=01;35:*.ram=01;35:*.rm=01;35:*.rv=01;35:*.aac=01;35:*.rmi=01;35'

#setenv PATH ".:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin:${PATH}:${HOME}/bin"
# Problem wiht rkhunter wehn ".:/" in PATH -> ok then without ".:/"
setenv PATH "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin:${PATH}:${HOME}/bin"

setenv LD_LIBRARY_PATH ".:/usr/local/lib:/usr/local/info/lib:/usr/lib:/lib:/usr/local/X11/lib:/"

#for sysutils/tmux (tmux is a terminal multiplexer)
setenv TMUX_TMPDIR /var/run/tmux/

setenv MAKEOBJDIRPREFIX /usr/obj

# A righteous umask
umask 22

cd ~ #change to home directory
Last edited by a moderator:
setenv LD_LIBRARY_PATH ".:/usr/local/lib:/usr/local/info/lib:/usr/lib:/lib:/usr/local/X11/lib:/"
I bet it's this one. Why is . in there? Why even set LD_LIBRARY_PATH at all?

When I set LD_LIBRARY_PATH like this then make -j8 buildworld dies with ./ unsupported file layout here. The possible reason: Some build tool requires and tries to load the incomplete version from the build instead of trying to use /lib/ from the system like it should.
I believe you are right. I have tested ~/.tcshrc now step by step and make buildworld has again fail with this four lines:
setenv MAKEOBJDIRPREFIX /usr/obj
setenv TMUX_TMPDIR /var/run/tmux/
setenv PATH "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:${HOME}/bin"
setenv LD_LIBRARY_PATH ".:/usr/local/lib:/usr/local/info/lib:/usr/lib:/lib:/usr/local/X11/lib:/"

Why even set LD_LIBRARY_PATH at all?
It is there since a long time so I can not remember the real reason. But I remember that I had have some problems at a time to build something from the ports or it was an external source. the compiling searches for some libs and could not find it. I found a tip via internet to set this env. variable LD_LIBRARY_PATH and with it I could fixed it. Since then it is in my .tcshrc. Maybe that is in regular situations wrong. The ".:/" I do because I see this in the PATH variable. I thing now I haven't it worked out really right and do a mistake by myself.

I do not understand and like to ask: You wrote:
Some build tool requires and tries to load the incomplete version from the build instead of trying to use /lib/ from the system like it should.
Why does this search for in the build? Also with LD_LIBRARY_PATH - the libs path points to libraries outside of the build? Or did the ".:/" gives the wrong place?

Thanks again
Because LD_LIBRARY_PATH was set to look in the current working directory first.
this is the affirmative answer that is was a mistake by myself.

In between I have now learned a bit more about ldconfig() and how the FreeBSD system search for lib's and how I could expand the search path, better, in /etc/rc.conf. The environment variable LD_LIBRARY_PATH is more for an unprivileged user (not root) to set his own things; maybe for programming something as regular user, how I have read.

In /etc/defaults/rc.conf
ldconfig_paths="/usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg"
           # shared library search paths
           # Book Absolute BSD: "The ldconfig_paths variable lists common locations for libraries."
           # Local directories with ldconfig configuration files.
           # Book Absolute BSD: "Ports and packages use the ldconfig_local_dirs variable to get their shared libraries into the search list..."
from Book "The Complete Guide to FreeBSD (2nd Edition).pdf" (sadly there is no new version):
Isn’t /usr/local/lib specifically for libraries installed by ports and packages? Why
not just put all your shared libraries into that directory? Most ports do exactly that,
but sometimes having a separate directory makes maintenance simpler. For example,
I have Python 2.4 installed on my laptop, and /usr/local/lib/python24 includes
587 files! Dumping all those into /usr/local/lib would overwhelm my non-Python
libraries and make it harder to find the files installed by ports with only one or two
shared libraries.
To get your directory of shared libraries into the search list, either add it to the
ldconfig_paths in /etc/rc.conf, or create a file listing your directory in /usr/local/
libdata/ldconfig. Either works. Once you add the directory, the libraries in that
directory are immediately available.
I believe at some years I had used LD_LIBRARY_PATH do this above and this was a mistake. Also I took the form of the path settings from the PATH environment variable what has include the "./:" and was has bring now the undesirable error with make buildworld. Why I have not recognized this earlier? On my old virtual server I used only update and upgrade for the userland, because of the long time it takes - and only compile the kernel. I has got now a new more powerful virtual server and liked to try (and to test how long it takes) to compile the sources - and have now run into trouble.
Thank you all who has help me :)