Problem compiling older code on newer OS/Versions

Hi,

First time posting on here so please forgive me if I miss some requirements or accidental break some rules while posting.

I have a background in programming way back when but that was C rather than C++. Recently I've been trying to get an opensource app to run on 14.04 ubuntu 64bit when the dev's current revision is on 12.04 32bit. On his site people have mentioned they have managed to get it to compile & run on later versions of the OS and 64bit but I've had no joys with trying to follow in their footsteps or get help.

The issue is that the app requires berkelium which is an offshoot of chronium but is no longer maintained. I basically jumped through a lot of hoops and eventually got it to compile on 12.04 64bit so tried 13.10 & 14.04 but got the same errors.

1
2
3
base/message_pump_glib_x.cc: In member function ‘virtual bool base::MessagePumpGlibX::RunOnce(GMainContext*, bool)’:
base/message_pump_glib_x.cc:194:44: error: assignment of member ‘_GSourceFuncs::dispatch’ in read-only object
         gdksource_->source_funcs->dispatch = gdkdispatcher_;


Found these references to this type of error...

http://stackoverflow.com/questions/3775414/assignment-of-data-member-in-read-only-structure-class-in-stl-set
http://syncor.blogspot.co.nz/2011/05/c-error-assignment-of-data-member-in.html

So I suspect it's the version of gcc or glib which have changed their rules or something which means the code got through the compiler but now it's hitting an error and stopping. Considering the amount of files in berkelium alone plus all the libraries it calls I'm finding it hard to work out how to get around the issue.

FYI the app I'm trying to get to work is xibo and here's the information the dev has on compiling berkelium. http://xibo.org.uk/manual/index.php?toc=developer&p=admin/pyclient_libbrowsernode_build

Any help/advice would be greatly appreciated.
If the container is a set, you can't update the object thru an iterator. You need copy the item out, delete it from the container, modify in and re-insert it.

I only say that because you post a reference to set on stackoverflow (which I haven't bothered to read).

So, it the container a set? If you're not sure, can you please post the relevant declartions.
Last edited on
This is where I might need some help...as I said I'm trying to fix someone else's code and it's quite large. Over 15000 .h files and over 7000 .cc files...not including the standard includes.

This is the .h for the file that's complaining (and where gdksource seems to come from)

[code]// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_MESSAGE_PUMP_GLIB_X_H
#define BASE_MESSAGE_PUMP_GLIB_X_H

#include "base/message_pump.h"
#include "base/message_pump_glib.h"

#include <bitset>
#include <set>

#include <glib.h>
#include <gtk/gtk.h>
#include <X11/X.h>

namespace base {

class MessagePumpGlibX : public MessagePumpForUI {
public:
MessagePumpGlibX();
virtual ~MessagePumpGlibX();

// Indicates whether a GDK event was injected by chrome (when |true|) or if it
// was captured and being processed by GDK (when |false|).
bool IsDispatchingEvent(void) { return dispatching_event_; }

#if defined(HAVE_XINPUT2)
// Setup an X Window for XInput2 events.
void SetupXInput2ForXWindow(Window xid);
#endif

// Overridden from MessagePumpForUI:
virtual bool RunOnce(GMainContext* context, bool block);

private:
static void EventDispatcherX(GdkEvent* event, gpointer data);

// Update the lookup table and flag the events that should be captured and
// processed so that GDK doesn't get to them.
void InitializeEventsToCapture(void);

#if defined(HAVE_XINPUT2)
// Initialize X2 input.
void InitializeXInput2(void);

// The opcode used for checking events.
int xiopcode_;

// The list of master pointer devices. We maintain this list so that it is not
// necessary to query X for the list of devices for each GdkWindow created.
std::set<int> masters_;

// The list of slave (physical) pointer devices.
// TODO(sad): This is currently unused, and may be removed eventually.
std::set<int> slaves_;
#endif

// The event source for GDK events.
GSource* gdksource_;

// The default GDK event dispatcher. This is stored so that it can be restored
// when necessary during nested event dispatching.
gboolean (*gdkdispatcher_)(GSource*, GSourceFunc, void*);

// Indicates whether a GDK event was injected by chrome (when |true|) or if it
// was captured and being processed by GDK (when |false|).
bool dispatching_event_;

#if ! GTK_CHECK_VERSION(2,18,0)
// GDK_EVENT_LAST was introduced in GTK+ 2.18.0. For earlier versions, we pick a
// large enough value (the value of GDK_EVENT_LAST in 2.18.0) so that it works
[// for all versions.
#define GDK_EVENT_LAST 37
#endif

// We do not want to process all the events ourselves. So we use a lookup
// table to quickly check if a particular event should be handled by us or if
// it should be passed on to the default GDK handler.
std::bitset<LASTEvent> capture_x_events_;
std::bitset<GDK_EVENT_LAST> capture_gdk_events_;

DISALLOW_COPY_AND_ASSIGN(MessagePumpGlibX);
};

} // namespace base

#endif // BASE_MESSAGE_PUMP_GLIB_X_H
/code]

So I might need some direction of where to be looking for the set for the container...
Can you post the definition of GSource, I need to see the definition of source_funcs
Going back to the code that failed, can you show the declaration of gdksource_.
So source_funcs & Gsource are as norm said from gmain.h : http://pastebin.com/yFzeHGE7

The only reference throughout the code or my /usr/includes are in the build/chromium/src/base/message_pump_glib_x.h which is the one i posted above and the build/chromium/src/base/message_pump_glib_x.cc which is here : http://pastebin.com/yfBy0RSN

You don't have a definition of gdksource_ in that code, only the use that generates the error.
Ok, I'll try a visual compiler or a debugger to see if I can get more information as grep across my system obviously didn't bring the right results...sorry. Will update soon (hopefully)
livly wrote:
On his site people have mentioned they have managed to get it to compile & run on later versions of the OS and 64bit
Please provide a link.
Hi Norm,

Here's the answers page where it's mentioned although the main person in the conversation seems to switch between saying it's 32bit & x86, either way if it's a problem with the newer version of glib surely that issue would be there for both. Plus I just noticed that someone has replied at the bottom with a guide about how to compile it on 14.04 64bit plus a download for the pre-compiled version. I haven't had a chance to check the validity of it yet though.

https://answers.launchpad.net/xibo/+question/247570

Also, in my search I came across this too which while Fedora, it's 18 which has glib new enough to hit the same problem. I tried contacting both in the past with no response.

http://blog.asdfa.net/building-chromium-or-berkelium-in-fedora-18/

I'll check out this how to and binary but in the meantime I've got eclipse & doxygen on my dev system examining the code trying to find the gdksource so I'm still going down multiple roads until I surrender completely or find a working solution.

Must admit, it's been good to get the rust off the old cogs even if it was C I learnt with all those years ago.

Thanks again for your responses & advice.
One way to find definitions of things is to run the preprocessor.

You:
1. take the command line used to run the compiler, replace g++ (or however the compiler was referenced) with cpp.
2. remove the -c option
3. redirect the output to a file.

This file will contain the preprocessed output that the compiler sees, with full definitions. You can search that.
Hi Andy,

You've probably already discovered this, but the guide in the post that you mentioned has a message_pump_glib_x.cc patch that comments out the lines causing your error:
1
2
3
4
5
6
7
8
9
10
11
12
13
. . .
@@ -190,8 +190,8 @@
       // TODO(sad): A couple of extra events can still sneak in during this.
       // Those should be sent back to the X queue from the dispatcher
       // EventDispatcherX.
-      if (gdksource_)
-        gdksource_->source_funcs->dispatch = gdkdispatcher_;
+      //if (gdksource_)
+      //  gdksource_->source_funcs->dispatch = gdkdispatcher_;
       g_main_context_iteration(context, FALSE);
     }
   }
. . .


Just brain storming a bit here, if the guide doesn't happen to work.

Looking at the chromium sources, message_pump_glib_x.cc has been removed.
https://code.google.com/p/chromium/codesearch#search/&q=message_pump_glib_x.cc&sq=package:chromium&type=cs

That left me wondering if Berkelium will work with a more recent version of chromium. The Berkelium script build-chromium.sh does have a switch to specify the chromium version to download ( ./installbuild-chromium.sh --help ).

Regards,
Norm

Edit: mistyped script name
Last edited on
Hi Norm,

I've been working while trying to get this fixed (with a little sleep thrown in) so I'm only just sitting down to have a proper look at that guide & patches. At least that does sound promising that one of the patches looks at the area that's been giving me grief. I must admit I didn't see that switch in the build script and I did wonder the same (if a newer version might bolt in). I'll work through it now and see what I can see, hopefully it puts this one to bed. Wish me luck! haha

Thanks again for your responses, I'll let you know if it all works.

Cheers,
Andy
So...good news...it compiles and runs!

Not quite as the guide said but mainly because the patch fixed the issue I was trying to solve.

Thanks again for your help and I've learnt & remembered some great things :)
Hi liviy,
I'm trying to build berkelium for ubuntu 13.10 but it is very complicated
One of the problems that I want to build it for ARM 7 (odroid U3)
I followed the following link for days , but with no luck
www.cnx-software.com/2011/10/15/cross-compiling-berkelium-and-chromium-os-for-arm/
I also tried https://www.libavg.de/site/projects/libavg/wiki/UbuntuSourceInstall
but no luck.

I looked at the odroid forums and they suggested that a normal ubuntu build will do and no need for cross compilation , which what I understand you managed to achieve a few days ago.

I need your support to build berkelium for ubuntu 13.10. Can you please provide a link or script that I can use to do that?
Thanks
Please don't hijack a thread. It's must easier for everyone if you start a new thread.
Topic archived. No new replies allowed.