#74 rt segfaults when BRLCAD_ROOT is not set

Raytrace (49)

It should print an error only and not print an error
and segfault:

Shader "platic"... Unable to locate where BRL-CAD 7.8.2
is installed while searching:
BRLCAD_ROOT environment variable
BRLCAD_ROOT compile-time path [/usr/brlcad]
run-time path identification [UNKNOWN]
current directory

This version of BRL-CAD was compiled to be installed at:

You may specify where to locate BRL-CAD by setting the
environment variable. For example:

for csh/tcsh users:
setenv BRLCAD_ROOT /path/to/brlcad
for sh/bash users:
BRLCAD_ROOT=/path/to/brlcad ; export BRLCAD_ROOT

Unable to find '/lib/libplatic.so' within the BRL-CAD
software installation.
This copy of BRL-CAD may not be properly installed.

utils/rt_script: line 47: 15280 Segmentation fault
(core dumped) rt $rtopts $view -o $interm $input $object

(gdb) bt full
#0 0x0aa2f19a in L1 () from /usr/lib/libc.so.39.0
No symbol table info available.
#1 0xcfbf5700 in ?? ()
No symbol table info available.
#2 0x01954efa in load_dynamic_shader
(material=0x84b7f150 "platic", mlen=6) at material.c:209
shader_mfuncs = (struct mfuncs *) 0x0
libname =
"libplatic.so\000reat/ronja/trunk/shaders.so", '\0'
<repeats 240 times>, "hY¿Ï]Ëü\000\000\2009\207Ðóû
'\0' <repeats 120 times>, "(Z¿Ï]Ëü\000ð\020L|Ðóû
'\0' <repeats 64 times>,
libpath =
'\0' <repeats 12 times>,
"\200\036L|ÍÄ\a\000@@L|\231\000\000\000\213K\b\000\000\020ú\205ð\037ú\205$Ì *0S¿Ï\000\000\000\000\000\000\000\000\r\214¥\nb0 *\001\000\000\000¤Â\237*\001\000\000\000\227\221\224ß\002\000\000\000@AL|ixü\000Äàû
t\\é\204\000\000\000\000Ðóû \000\000\000\000Ðóû
ÈS¿Ïö¾ü\000Ðóû \000\2009\207èS"...
cwd = 0x8a91d400 "/home/clock/creat/ronja/trunk"
old_rdebug = 0
sh_name =
'\0' <repeats 11 times>
#3 0x0195518e in mlib_setup (headp=0x3c003f84,
rp=0x87398200, rtip=0x81a65000) at material.c:289
mfp = (const struct mfuncs *) 0x0
mfp_new = (struct mfuncs *) 0x0
ret = -2119806748
param = {vls_magic = -1993131077, vls_str =
0x0, vls_offset = 0, vls_len = 0, vls_max = 0}
material = 0x84b7f150 "platic"
mlen = 6
#4 0x1c00abc1 in view_setup (rtip=0x81a65000) at
regp = (struct region *) 0x87398200
#5 0x1c0032aa in do_prep (rtip=0x81a65000) at do.c:523
times = {vls_magic = 0, vls_str = 0x82232d1c
"4-#\202\004-#\202\004PÝ\211", vls_offset =
-2046774996, vls_len = -809542596, vls_max = 89310700}
#6 0x1c0033fb in do_frame (framenumber=0) at do.c:576
times = {vls_magic = 0, vls_str = 0x0,
vls_offset = 0, vls_len = 1072693248, vls_max = 0}
framename = '\0' <repeats 22 times>,
"ð?\000\000\000\000\000 pÀ", '\0' <repeats 30 times>,
'\0' <repeats 16 times>,
rtip = (struct rt_i *) 0x81a65000
utime = 0
nutime = 0
wallclock = 1
npix = -2119806976
i = -809542296
lim = 2097439744
work = {-1.0411722243927633e-300,
8.226092275548744e-174, 1.1877654275392954e-19}
temp = {-1.4200482149854805e+76,
5.2604064271895675e-283, 1.1877654275392954e-19}
quat = {5.2607417470177227e-283,
1.1608252122378222, 8.7974106320667404e-314,
#7 0x1c0056bf in main (argc=10, argv=0xcfbf6530) at
frame_retval = 197683320
rtip = (struct rt_i *) 0x81a65000
title_file = 0xcfbf66f4 "3d/parallel.g"
title_obj = 0xcfbf6702 "parallel"
idbuf = "Untitled BRL-CAD Database", '\0'
<repeats 998 times>
times = {vls_magic = -1993131077, vls_str =
0x0, vls_offset = 0, vls_len = 0, vls_max = 0}
i = 4


  • Cliff Yapp

    Cliff Yapp - 2008-06-30

    Logged In: YES
    Originator: NO

    What install setup did you use to provoke this error? Were you installed in another directory than /usr/brlcad?

  • Sean Morrison

    Sean Morrison - 2008-06-30

    Logged In: YES
    Originator: NO

    While rt should certainly not crash, it's worth noting that the problem stems from an invalid shader "platic" that should instead say "plastic". The raytracer goes searching for a dynamic loadable "platic" shader library, promptly complains that it can't find one (suggesting that setting BRLCAD_ROOT might help find it), and then crashes for some reason.

    Cliff, this bug is quite out of date, but I'm pretty sure the code hasn't changed much. The reason I'd left it open was as a reminder to not have the dynamic loader be so verbosely annoying when it can't find a shader. It should report the bogus shader and do what it used to do (which was fall back to default plastic).

  • Loui Chang

    Loui Chang - 2008-07-24

    Logged In: YES
    Originator: NO

    I think it should just exit with an error if a bad shader is specified.

    The command could be part of an erroneous script that asks for "metl"
    when it really meant "metal", but the script would still continue
    along making all renders look plastic which wouldn't be fun.

    Another scenario might be where the script is fine but the shader wasn't
    installed properly.

    Why waste processor time eh?

  • Sean Morrison

    Sean Morrison - 2008-07-30

    Logged In: YES
    Originator: NO


    I pretty much agree with what you said. In fact, our previous behavior was to default all unknown shaders to plastic. The problem seen above was entirely unintentional after changes were made to support dynamic shader loading. The blather about BRLCAD_ROOT is the dynamic shader loader (noisily) trying to find and load a shader that doesn't exist. There's an entry in the BUGS file for this issue that has been there for a long while. Obviously not what we want to do.


  • Sean Morrison

    Sean Morrison - 2008-07-30
    • milestone: 387260 --> serious bug / workaround
    • priority: 5 --> 7
    • status: open --> open-accepted

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks