Attempting to statically link Juce with C based code -- getting a crash

Hi all -

I have just started looking at Juce as a GUI for my cross-platform language, which is written in C.

I created a simple Juce application with the Introjucer, and modified the link to create a "libjuce.a" file to be linked in with my code.

The manner in which I am trying to use it is to add the libjuce.a in my link chain, and have my code call into Juce functions (and create objects etc) as needed.  The glue code and the link all seem ok, until I try to run my app.

The shell app never gets to its main() (and when I modified things to use the START_JUCE_APPLICATION macro things were no different).

The problem is when I start, I get the following crash, immediately:

#0  0x0000000000486ee8 in juce::AffineTransform::AffineTransform() ()
#1  0x000000000040b2af in _GLOBAL__sub_I__ZN4juce6ColourC2Ev ()
#2  0x000000000061bf0d in __libc_csu_init ()
#3  0x00002aaaabf07e55 in __libc_start_main (main=0x40c4d8 <main(int, char**)>, argc=3, argv=0x7fffffffdd48, init=0x61bec0 <__libc_csu_init>, 
    fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdd38) at libc-start.c:246
#4  0x000000000040bec9 in _start ()

This seems to me like something related to C++ linking issues.  FWIW my link command is:

g++ app.o  -g -m64 -o app -Llib/linux/64 -lc -ldl  -lpthread  -ljuce  -L/usr/X11R6/lib64  -lX11 -lXext -lXinerama -lfreetype -lpthread

This is on 64-bit Linux with g++ 4.8.2

Any help would be most appreciated

Well, I fixed the crash by adding "-shared -fPIC" to the g++ compile of the library.

 

Now I just have to figure out how to get the stuff to display as I was hoping...