[Solved] Introjucer Segfaults out-of-the-box

Hello.

 

Clearly, I'm new to JUCE (but not new to C++ or programming in general).

 

I have 3 desktops, 2 laptops, 1 tablet and 1 smartphone. Out of all those, I was only able to get The Introjucer to compile on one: A Linux desktop.

 

The Web-site suggests, that we should let you know, if anything does not work out-of-the-box.

 

Well after compiling the Debug target of The Introjucer, I found that it only briefly seems to show the outline of a window, and then segfaults. Here is the debug output:

 

dirk@Walnut:~/Desktop/My_Programs/juce/extras/Introjucer/Builds/CodeBlocks/bin/Debug$ gdb "./The Introjucer"
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) run
Starting program: /home/dirk/Desktop/My_Programs/juce/extras/Introjucer/Builds/CodeBlocks/bin/Debug/The Introjucer
[Thread debugging using libthread_db enabled]
JUCE v3.0.8
[New Thread 0xb76e76c0 (LWP 19649)]

**********************************************************
Introjucer 3.1.0  ---  Build date: Sep 24 2014
Log started: 24 Sep 2014 9:01:02pm

[New Thread 0xb769fb90 (LWP 19652)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb76e76c0 (LWP 19649)]
0x080595d8 in juce::Atomic<int>::operator++ (this=Cannot access memory at address 0x1
)
    at /home/dirk/Desktop/My_Programs/juce/modules/juce_gui_extra/../juce_gui_basics/../juce_graphics/../juce_core/memory/juce_Atomic.h:327
327                                   : (Type) __sync_add_and_fetch ((int64_t*) &value, 1);(gdb) backtrace
#0  0x080595d8 in juce::Atomic<int>::operator++ (this=Cannot access memory at address 0x1
)
    at /home/dirk/Desktop/My_Programs/juce/modules/juce_gui_extra/../juce_gui_basics/../juce_graphics/../juce_core/memory/juce_Atomic.h:327
#1  0x0808f796 in juce::ReferenceCountedObject::incReferenceCount (this=Cannot access memory at address 0x1
)
    at /home/dirk/Desktop/My_Programs/juce/modules/juce_gui_extra/../juce_gui_basics/../juce_graphics/../juce_core/memory/juce_ReferenceCountedObject.h:76
#2  0x083e5cb0 in juce::ReferenceCountedObjectPtr<juce::Font::SharedFontInternal>::incIfNotNull (
    o=0x3f800000)
    at /home/dirk/Desktop/My_Programs/juce/modules/juce_graphics/../juce_core/memory/juce_ReferenceCountedObject.h:360
#3  0x083f9b25 in juce::ReferenceCountedObjectPtr<juce::Font::SharedFontInternal>::operator= (
    this=0x90d0d84, newObject=0x3f800000)
    at /home/dirk/Desktop/My_Programs/juce/modules/juce_graphics/../juce_core/memory/juce_ReferenceCountedObject.h:296
#4  0x083f9b7a in juce::ReferenceCountedObjectPtr<juce::Font::SharedFontInternal>::operator= (this=Cannot access memory at address 0x1
)
    at /home/dirk/Desktop/My_Programs/juce/modules/juce_graphics/../juce_core/memory/juce_ReferenceCountedObject.h:274
#5  0x08376fb5 in juce::Font::operator= (this=0x90d0d84, other=@0xbff8f0d0)
    at /home/dirk/Desktop/My_Programs/juce/modules/juce_graphics/fonts/juce_Font.cpp:275
#6  0x083f9f35 in juce::RenderingHelpers::StackBasedLowLevelGraphicsContext<juce::RenderingHelpers::SoftwareRendererSavedState>::setFont (this=0x90d0380, newFont=@0xbff8f0d0)
    at /home/dirk/Desktop/My_Programs/juce/modules/juce_graphics/native/juce_RenderingHelpers.h:2668
#7  0x0836f513 in drawGlyphWithFont (g=@0xbff8f6c8, glyph=70, font=@0xbff8f0d0, t=@0x413ecccd)
    at /home/dirk/Desktop/My_Programs/juce/modules/juce_graphics/fonts/juce_GlyphArrangement.cpp:81
---Type <return> to continue, or q <return> to quit---

 

Any ideas?

 

Dirk

 

P.S., FWIW, I can compile the JuceDemo fine from the Makefile, out of which the GUI displays, and most of the demos run. The demos which didn't run, were both the 3D and the 2D OpenGL demos - crashing instead of falling back to anything - and the Web-browser, which simply displays nothing. Thus, in the file named 'juce_opengl.h' , I commented out a line like so:

 

//#define JUCE_OPENGL 1

 

which removed the offending demo-entries when I ran 'make' again. However, doing so and recompiling The Introjucer , produced absolutely no change. It still compiles fine, but then crashes when run.

 

Welcome, BTW

{Works fine for me} - Looks like some font/atomic stuff may be a problem (I'm pretty new to Linux)

Perhaps try this - A search of the Linux forums for any/all apt-get Installs [http://www.juce.com/search/node/apt-get] you may be missing/out of date. [I'm thinking especially include the font/opengl/audio modules]

{Also, if that doesn't help, try this:  Because you can't run Introducer (Where JUCE_UNIT_TESTS=1 is defined e.g. in JuceDemo's Config page in Preprocessor definitions section), a quick grep for JUCE_UNIT_TESTS, and replace JUCE_UNIT_TESTS=1 with JUCE_UNIT_TESTS=0},

export CONFIG="Debug";make clean && make

Just some ideas. Others here may have more handy info

This sounds very odd - there are thousands of other people using this, and I've not seen any reports like this before. You say you had "3 desktops and 2 laptops".. Are those all linux machines?

The crash looks like some kind of strange font problem, but would need more clues. What version of gcc are you using?

Two of my desktops are Linux-machines, but one of them not applicable because it's very old.

On the desktop on which I was able to compile The Introjuicer, a Linux machine, I have gcc version 4.3.2 .

 

My other desktop is a Windows 7, 64-bit machine, with Visual Studio 2005 on it, and did not permit me to compile The Introjucer, claiming

 

\juce\modules\juce_gui_basics\widgets\juce_label.cpp(464) : error C2039: 'editorShown' : is not a member of 'juce::Value::Listener'

One of my laptops is a Windows 8.1 , on which I only have MinGW and Code::Blocks,

and it, too is unable to compile The Introjucer.

Finally, my older laptop, actually a dual-boot, is of a similar Linux build as my one desktop, and actually,

I'd expect that I could compile Introjucer on it if I tried. I just haven't tried it on

that one yet, expecting the same results as on the one desktop.

 

BTW: JUCE_UNIT_TESTS=1 is a part of the Demo, which compiles and essentially, runs fine.

It's the Introjucer that I can't get running, and I have not been able to find this macro there,

within the Code::Blocks project anywhere.

 

Dirk

 

Wow, VS2005.. I don't even have a copy of that any more.

The error it's reporting is due to a compiler bug that they fixed many many years ago - I've committed a workaround for it now because it's easy to do, but I don't officially bother supporting VS2005 any more - you really should get something more modern!

First of all, I thank you for committing the workaround. That Visual Studio 2005 version of The Introjucer, is currently the only version I have running. laugh 

 

I had noticed that there were some #defines in the Code:Block project, which were inconsistent with the Demos Makefile, namely, __MINGW__ was still set to =1 , even though for now I'm working on my Linux machines. And so I replaced that with LINUX=1 .  But, because for the Demos, the setting JUCE_UNIT_TESTS=1 seemed to produce good results, I tried setting that on my C::B project as well, and to my great surprise, for the moment, I got the following compile error:

 

 

||=== The Introjucer, Debug ===|
obj/Debug/modules/juce_core/juce_core.o||In function `juce::Atomic<long long>::compareAndSetBool(long long, long long)':|
 long long)]+0x6c)||undefined reference to `__sync_bool_compare_and_swap_8'|
obj/Debug/modules/juce_core/juce_core.o||In function `juce::Atomic<unsigned long long>::compareAndSetBool(unsigned long long, unsigned long long)':|
 unsigned long long)]+0x70)||undefined reference to `__sync_bool_compare_and_swap_8'|
obj/Debug/modules/juce_core/juce_core.o||In function `juce::Atomic<double>::compareAndSetBool(double, double)':|
 double)]+0x62)||undefined reference to `__sync_bool_compare_and_swap_8'|
obj/Debug/modules/juce_core/juce_core.o||In function `juce::Atomic<long long>::operator+=(long long)':|
(long long)]+0x31)||undefined reference to `__sync_add_and_fetch_8'|
obj/Debug/modules/juce_core/juce_core.o||In function `juce::Atomic<long long>::operator++()':|
::operator++()]+0x27)||undefined reference to `__sync_add_and_fetch_8'|
obj/Debug/modules/juce_core/juce_core.o||In function `juce::Atomic<long long>::operator--()':|
::operator--()]+0x27)||undefined reference to `__sync_add_and_fetch_8'|
obj/Debug/modules/juce_core/juce_core.o||In function `juce::Atomic<long long>::get() const':|
::get() const]+0x27)||undefined reference to `__sync_add_and_fetch_8'|
obj/Debug/modules/juce_core/juce_core.o||In function `juce::Atomic<unsigned long long>::operator+=(unsigned long long)':|
(unsigned long long)]+0x31)||undefined reference to `__sync_add_and_fetch_8'|
obj/Debug/modules/juce_core/juce_core.o||In function `juce::Atomic<long long>::compareAndSetValue(long long, long long)':|
 long long)]+0x6c)||undefined reference to `__sync_val_compare_and_swap_8'|
obj/Debug/modules/juce_core/juce_core.o||In function `juce::Atomic<unsigned long long>::compareAndSetValue(unsigned long long, unsigned long long)':|
 unsigned long long)]+0x70)||undefined reference to `__sync_val_compare_and_swap_8'|
obj/Debug/modules/juce_core/juce_core.o||In function `juce::Atomic<double>::compareAndSetValue(double, double)':|
 double)]+0x62)||undefined reference to `__sync_val_compare_and_swap_8'|
||=== Build finished: 11 errors, 0 warnings ===|

 

 

Can you make out anything out of this compile log?

Dirk

 

The fact that the JuceDemo program was compiling and linking fine, gave me hope.

 

I now have The Introjucer, as well as the JuceDemo browser compiled and running on 3 of my computers, which I count as successful enough for today.

 

Within the Code::Blocks project, I was not allowed to put the JUCE_UNIT_TESTS=1 define, which was causing the new spate of error messages above. I did put LINUX=1 , but suspect that the compiler flags were already detecting that.

 

What I absolutely needed to get rid of under C::B, was -mstackrealign . Once I removed that from the compiler options, everything compiled and ran fine.

 

So I now have the Visual Studio 2005 version, thanks to the workaround that was provided here. And on the original Linux PC, which was giving me problems before, I have a C::B version of The Introjucer. And, on my dual-boot laptop, which I mainly use in Linux mode anyway, I have the same, GCC C::B version up and running. The laptop also displays the OpenGL demos fine - both the 2D and the 3D - because as I already knew, that one has real graphics hardware. The old Linux PC from yesterday, never had any, fw reason I still need to disable OpenGL under Juce - with no discernible consequences for me.

 

Now the only real project which remains for another day, is how I'm going to fulfill the MinGW, C::B build on my newer, Windows 8.1 laptop, which only boots into Windows. As far as I recall, the version of MinGW I have installed there, has issues with its own 'winuser.h' file, because that file uses _ANONYMOUS_STRUCT , which in turn the actual compiler can't parse. And so one little trick which I might try in the future, is to switch in the include directory from the Windows SDK, instead of the internal one, to supply winuser.h ...

 

But then once I get around to trying that, that will also be the last computer for now, in my household, on which I'd want juice up and running. There was always a remaining, older Linux box, which was never a candidate for this.

 

Thank you for your support,

Dirk

 

Glad you got it working, but the codeblocks project was designed to only run on Windows/mingw, and definitely never intended for linux - that's why linux has its own makefile target.