Am Sun, 12 Jan 2014 20:38:05 +0100
schrieb Marc Joliet <[email protected]>:

> Am Mon, 2 Dec 2013 10:08:01 +0100
> schrieb Stéphane Letz <[email protected]>:
> 
> > I've commited a new "faust-llvm.cpp" file in architecture folder that use 
> > the createDSPFactory/createDSPInstance API.
> > 
> > You can compile it with :
> > 
> > g++ faust-llvm.cpp /usr/local/lib/faust/libfaust.a `llvm-config --ldflags 
> > --libs all` -o faust-llvm
> > 
> > Then something like ./faust-llvm karplus.dsp
> > 
> > Please report if this works.
> > 
> > Stéphane
> 
> I have finally tried faust-llvm with various different DSP files and could not
> reproduce the crashes with it.  I still get the SEGFAULTs in 
> createCDSPFactory()
> from within my Python wrapper, though.
> 
> I'll try to investigate this further when I have more time (*sigh*), but maybe
> this will help verify the FAUST side of things.

I have finally been able to narrow it down.  I only get the crashes when I link
faust-llvm to a shared library version of libfaust (basically, I tried to
generalize the "dynamic" target in Makefile.unix).  At this point I want to
emphasise that it *used to work*.  Also, I want to *profusely* apologise for
not mentioning this significant fact earlier, I simply didn't expect that to
make a difference, let alone cause a SEGV.  I was actually half expecting a bug
in the Python CFFI (but of *course* the source of my problem would turn up
where I least expect it).

Once I learned this, I managed to get my libfaust-based Python wrapper working
again by using libfaust.a, which makes me happy :) .

This is reproducible using faust-llvm, though at least on Linux it needs two
more includes, stdio.h and unistd.h (sorry for not mentioning it earlier).  Here
is the output of two variants of faust-llvm, one linked against libfaust.a and
one linked against libfaust.so:

(please excuse the "sh -c" bits, I use the FISH shell, and could not figure out
how to get the second llvm-config call to be considered *one* argument to g++)

  % sh -c "g++ -g faust-llvm.cpp /usr/lib/faust/libfaust.a -L\$(llvm-config 
--libdir) \$(llvm-config --ldflags --libs all) -o faust-llvm-static"
  % sh -c "g++ -g faust-llvm.cpp -L\$(llvm-config --libdir) -L/usr/lib/faust 
-Wl,-rpath /usr/lib/faust -lfaust \$(llvm-config --ldflags --libs all) -o 
faust-llvm-shared" 
  % ./faust-llvm-static test_synth.dsp
  openVerticalBox label : test_synth
  closeBox
  Render one buffer
  First out = 1.000000 
  Render one buffer
  First out = 1.000000 
  Render one buffer
  First out = 1.000000 
  Render one buffer
  First out = 1.000000 
  Render one buffer
  First out = 1.000000 
  Render one buffer
  First out = 1.000000 
  Render one buffer
  First out = 1.000000 
  Render one buffer
  First out = 1.000000 
  Render one buffer
  First out = 1.000000 
  % ./faust-llvm-shared test_synth.dsp
  fish: Job 1, './faust-llvm-shared test_synth.dsp' durch Signal SIGSEGV 
(Adressbereichsfehler) beendet

GDB shows a backtrace with the same key locations as in my original backtrace:

  Program received signal SIGSEGV, Segmentation fault.
  0x00007ffff7ff9040 in new_mydsp ()
  (gdb) bt
  #0  0x00007ffff7ff9040 in new_mydsp ()
  #1  0x00007ffff6b745b5 in createDSPInstance (this=0x14723c0)
      at generator/llvm_dsp_aux.cpp:252
  #2  createDSPInstance (factory=0x14723c0) at generator/llvm_dsp_aux.cpp:820
  #3  0x00000000005692c5 in main (argc=2, argv=0x7fffffffda38) at 
faust-llvm.cpp:405

(keep in mind, I added two includes, the last line is actually line 403)

I wonder if this happens with libfaust.dylib under OS X?

For completions sake, libfaust.so is created with plain "g++ -shared", since I
couldn't figure out how to use current versions of GNU libtool (IIRC, use
outside of autotools/autoconf/etc. is unsupported, or at least not recommended).
The relevant line from the patched Makefile.unix:

  $(CXX) $(CXXFLAGS) -shared $(objects) -lc -lstdc++ `pkg-config --libs 
libmicrohttpd` -o $@

Now, with this way to test it, I should be able to do a git bisect, unless
somebody can immediately say what's going on.

Greetings
-- 
Marc Joliet
--
"People who think they know everything really annoy those of us who know we
don't" - Bjarne Stroustrup

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to