Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) WtQt CreatorUbuntu cc1plus: internal compiler error: Segmentation fault

 

Compile error.

 

 

 

 

 

 

Full error message

 

In member function 'boost::signals::connection Wt::EventSignal<E>::connect(T*, void (V::*)()) [with T = HelloApplication, V = HelloApplication, E = Wt::WMouseEvent]':
cc1plus: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.
make: *** [main.o] Error 1

 

 

 

 

 

Operating system(s) or programming environment(s)

 

IDE(s):

Project type:

Compiler(s):

Libraries used:

 

 

 

 

 

Project file

 

A default-created project file.

 

#-------------------------------------------------
#
# Project created by QtCreator 2010-11-18T12:10:20
#
#-------------------------------------------------
QT       += core
QT       -= gui
TARGET = CppHelloWtQtCreatorUbuntu
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

 

 

 

 

 

Build log

 

Running build steps for project CppHelloWtQtCreatorUbuntu...
Configuration unchanged, skipping qmake step.
Starting: "/usr/bin/make" -w
make: Entering directory `/home/richel/qtsdk-2010.04/bin/Projects/Website/CppHelloWtQtCreatorUbuntu-build-desktop'
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../CppHelloWtQtCreatorUbuntu -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I../CppHelloWtQtCreatorUbuntu -I. -o main.o ../CppHelloWtQtCreatorUbuntu/main.cpp
In member function 'boost::signals::connection Wt::EventSignal<E>::connect(T*, void (V::*)()) [with T = HelloApplication, V = HelloApplication, E = Wt::WMouseEvent]':
cc1plus: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.
make: *** [main.o] Error 1
make: Leaving directory `/home/richel/qtsdk-2010.04/bin/Projects/Website/CppHelloWtQtCreatorUbuntu-build-desktop'
The process "/usr/bin/make" exited with code %2.
Error while building project CppHelloWtQtCreatorUbuntu (target: Desktop)
When executing build step 'Make'

 

 

 

 

 

Source code

 

This source was copied literally from the Wt website (http://www.webtoolkit.eu/wt#/src/hello).

 

/*
* Copyright (C) 2008 Emweb bvba, Heverlee, Belgium.
*
* See the LICENSE file for terms of use.
*/

#include <Wt/WApplication>
#include <Wt/WBreak>
#include <Wt/WContainerWidget>
#include <Wt/WLineEdit>
#include <Wt/WPushButton>
#include <Wt/WText>

#include <boost/version.hpp>

using namespace Wt;

/*
* A simple hello world application class which demonstrates how to react
* to events, read input, and give feed-back.
*/
class HelloApplication : public WApplication
{
public:
  HelloApplication(const WEnvironment& env);

private:
  WLineEdit *nameEdit_;
  WText *greeting_;

  void greet();
};

/*
* The env argument contains information about the new session, and
* the initial request. It must be passed to the WApplication
* constructor so it is typically also an argument for your custom
* application constructor.
*/
HelloApplication::HelloApplication(const WEnvironment& env)
  : WApplication(env)
{
  setTitle("Hello world");                               // application title

  root()->addWidget(new WText("Your name, please ? "));  // show some text
  nameEdit_ = new WLineEdit(root());                     // allow text input
  nameEdit_->setFocus();                                 // give focus

  WPushButton *b = new WPushButton("Greet me.", root()); // create a button
  b->setMargin(5, Left);                                 // add 5 pixels margin

  root()->addWidget(new WBreak());                       // insert a line break

  greeting_ = new WText(root());                         // empty text

  /*
   * Connect signals with slots
   *
   * - simple Wt-way
   */
  b->clicked().connect(this, &HelloApplication::greet);

  /*
   * - using an arbitrary function object (binding values with boost::bind())
   */
  nameEdit_->enterPressed().connect
    (boost::bind(&HelloApplication::greet, this));
}

void HelloApplication::greet()
{
  /*
   * Update the text, using text input into the nameEdit_ field.
   */
  greeting_->setText("Hello there, " + nameEdit_->text());
}

WApplication *createApplication(const WEnvironment& env)
{
  /*
   * You could read information from the environment to decide whether
   * the user has permission to start a new application
   */
  return new HelloApplication(env);
}

int main(int argc, char **argv)
{
  /*
   * Your main method may set up some shared resources, but should then
   * start the server application (FastCGI or httpd) that starts listening
   * for requests, and handles all of the application life cycles.
   *
   * The last argument to WRun specifies the function that will instantiate
   * new application objects. That function is executed when a new user surfs
   * to the Wt application, and after the library has negotiated browser
   * support. The function should return a newly instantiated application
   * object.
   */
  return WRun(argc, argv, &createApplication);
}

 

 

 

 

 

Process

 

From http://redmine.emweb.be/boards/2/topics/1057 :

 

Richel,

There is/was a bug in ubuntu's patches to gcc causing the compiler to crash on Wt:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.4/+bug/647597

Unfortunately, the latest Wt release does not compile well on Ubuntu.

You have two options:
If you use the git version of Wt, this buggy compiler will be detected and a work-around is used.
Upgrade your compiler
BR,
Wim.

 

 

 

 

 

Solution/workaround

 

Add the following lines to the project file:

 

LIBS += -L/usr/lib -lwt -lwthttp
QMAKE_CXXFLAGS += -DNDEBUG

 

This results in the following complete project file:

 

#-------------------------------------------------
#
# Project created by QtCreator 2010-11-18T12:10:20
#
#-------------------------------------------------
QT       += core
QT       -= gui
TARGET = CppHelloWtQtCreatorUbuntu
LIBS += -L/usr/lib -lwt -lwthttp
QMAKE_CXXFLAGS += -DNDEBUG
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

 

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict