# The libvgl demo broken with clang?



## ondra_knezour (Feb 5, 2014)

It looks to me that libvgl() demo is broken with clang. Now I have running 11-CURRENT snapshot with newcons in VirtualBox and after 
	
	



```
cd /usr/share/examples/libvgl && make && ./demo
```
 I got only segfault. LLDB not yet built, so I am without debugger in time of writing. If I recall right I had same experience with 10-RC[something] which disappeared after some port pulled in GCC as depenency.

May I ask people running FreeBSD 10 and above to try build demo as shown above with clang or GCC whatever is their default? I can't setup several virtual machines now to test it and given amount of time I can spare in following days it may take weeks for me to just try such easy task.


----------



## sossego (Feb 6, 2014)

```
root@conhecer:/usr/share/examples/libvgl # make
Warning: Object directory not changed from original /usr/share/examples/libvgl
cc -O2 -pipe  -std=gnu99 -Qunused-arguments -fstack-protector  -c demo.c
cc -O2 -pipe  -std=gnu99 -Qunused-arguments -fstack-protector   -o demo demo.o -lvgl
root@conhecer:/usr/share/examples/libvgl # ls
Makefile        demo            demo.c          demo.o
root@conhecer:/usr/share/examples/libvgl # ls demo
demo
root@conhecer:/usr/share/examples/libvgl # ./demo
Segmentation fault (core dumped)
root@conhecer:/usr/share/examples/libvgl # ./demo
Segmentation fault (core dumped)
root@conhecer:/usr/share/examples/libvgl #
```

Hold on a sec...




```
oot@conhecer:/usr/share/examples/libvgl # gdb demo demo.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...(no debugging symbols found)...
Core was generated by `demo'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libvgl.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libvgl.so.6
Reading symbols from /lib/libc.so.7...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols found)...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x080488f6 in main ()
(gdb) bt.
#0  0x080488f6 in main ()
(gdb)
```



That may help


----------



## ondra_knezour (Feb 15, 2014)

Mine is more descriptive because of the debug symbols compiled in, but beyond my actual knowledge. Help anyone?


```
cd /usr/share/examples/libvgl && lldb demo
Current executable set to 'demo' (x86_64).
run
Process 896 launched: '/usr/share/examples/libvgl/demo' (x86_64)
Process 896 stopped
* thread #1: tid = 100326, 0x0000000000400bbe demo`main(argc=1, argv=0x0007fffffffdbd8) + 78 at demo.c:55,
stop reason = invalid address (fault address: 0x4)
frame #0: 0x0000000000400bbe demo`main(argc=1, argv=0x0007fffffffdbd8) + 78 at demo.c:55
    52
    53   // VGLDisplay is a ptr to a struct Bitmap defined and initialized by
    54   // libvgl. The Bitmap points directly to screen memory etc.
->  55   xsize=VGLDisplay->Xsize;
    56   ysize=VGLDisplay->Ysize;
    57
    58   // alloc a new bitmap
```

All this on 11-CURRENT snapshot from the january 27th with NEWCONS(VT) running in VirtualBox.


----------

