This forum has been archived. All content is frozen. Please use KDE Discuss instead.

error : "Not connected to D-Bus server"

Tags: None
(comma "," separated)
User avatar
quux_qorge
Registered Member
Posts
13
Karma
0
OS
Hello,

I've successfully built koffice2.1 on Mac OS X. The apps (krita, kword,..) can be launched, but I get the following error at launch time (in a dialog box):
Could not start process Cannot talk to klauncher: Not connected to D-Bus server.

Image

I can then click "Ok" and the app kinda works, until the errors shows again. I googled that error and apparently I'm not the first one to get it, but I couldn't find how to fix it. As far as I can tell, this is not a OSX-specific error.

I use dbus to start the apps, ie:
Code: Select all
dbus-launch krita

And I do have "klauncher" in my "lib/kde4/libexec" dir ( that I have added to the $PATH env variable, just in case). Don't know if this helps, but my koffice build is not in a standard directory, but in a custom one (also added to $PATH).

If someone knows where to look, I'd be very grateful.

Here is a gdb backtrace (breaking on "KIO::buildErrorString"):
Code: Select all
#0  KIO::buildErrorString () at qstring.h:868
#1  0x0000000101af1ea3 in KIO::Job::errorString () at global.cpp:159
#2  0x0000000101b6c7fd in KIO::NetAccess::slotResult () at netaccess.cpp:513
#3  0x0000000101b6c93f in KIO::NetAccess::qt_metacall () at netaccess.moc:83
#4  0x000000010005bbf8 in QMetaObject::metacall ()
#5  0x000000010005e297 in QMetaObject::activate ()
#6  0x0000000102589faa in KJob::emitResult () at kjob.moc:194
#7  0x0000000101af9c7a in KIO::SimpleJob::slotFinished () at job.cpp:477
#8  0x0000000101afabef in KIO::StatJob::slotFinished () at job.cpp:823
#9  0x0000000101af7a42 in KIO::SimpleJob::slotError () at job.cpp:489
#10 0x0000000101b7acdd in KIO::SchedulerPrivate::createSlave () at scheduler.cpp:725
#11 0x0000000101b7c20c in KIO::SchedulerPrivate::startJobDirect () at scheduler.cpp:612
#12 0x0000000101b7c308 in KIO::SchedulerPrivate::startStep () at qlist.h:90
#13 0x0000000101b7b0fd in KIO::Scheduler::qt_metacall () at scheduler.moc:108
#14 0x000000010005bbf8 in QMetaObject::metacall ()
#15 0x000000010005e297 in QMetaObject::activate ()
#16 0x00000001001405d4 in QTimer::timeout ()
#17 0x000000010010dd18 in QTimer::timerEvent ()
#18 0x0000000100109e3b in QObject::event ()
#19 0x0000000102a5e09a in QApplicationPrivate::notify_helper ()
#20 0x0000000102a5e2b8 in QApplication::notify ()
#21 0x0000000101fa4655 in KApplication::notify () at kapplication.cpp:302
#22 0x000000010005ada8 in QCoreApplication::notifyInternal ()
#23 0x0000000102a5d5e8 in qt_sendSpontaneousEvent ()
#24 0x0000000102a22293 in QEventDispatcherMacPrivate::activateTimer ()
#25 0x00007fff83962a58 in __CFRunLoopRun ()
#26 0x00007fff83960c2f in CFRunLoopRunSpecific ()
#27 0x00007fff86373a4e in RunCurrentEventLoopInMode ()
#28 0x00007fff86373853 in ReceiveNextEventCommon ()
#29 0x00007fff8637370c in BlockUntilNextEventMatchingListInMode ()
#30 0x00007fff83cb11f2 in _DPSNextEvent ()
#31 0x00007fff83cb0b41 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#32 0x00007fff83c76747 in -[NSApplication run] ()
#33 0x0000000102a23302 in QEventDispatcherMac::processEvents ()
#34 0x00000001000fb9fa in QEventLoop::processEvents ()
#35 0x00000001000fbb5e in QEventLoop::exec ()
#36 0x0000000101b6c9fc in KIO::NetAccess::enter_loop () at qglobal.h:2166
#37 0x0000000101b6cb87 in KIO::NetAccess::synchronousRunInternal () at netaccess.cpp:487
#38 0x0000000101b6d296 in KIO::NetAccess::synchronousRun () at netaccess.cpp:277
#39 0x00000001019d53c2 in KFileWidget::KFileWidget () at kfilewidget.cpp:590
#40 0x00000001019e14c9 in KFileWidget::KFileWidget () at kfilewidget.cpp:617
#41 0x0000000100c6c44f in KoExistingDocumentPane::KoExistingDocumentPane () at KoExistingDocumentPane.cpp:38
#42 0x0000000100c6c809 in KoExistingDocumentPane::KoExistingDocumentPane () at KoExistingDocumentPane.cpp:52
#43 0x0000000100c6d3de in KoOpenPane::initExistingFilesPane () at KoOpenPane.cpp:353
#44 0x0000000100c6ca27 in KoOpenPane::KoOpenPane () at KoOpenPane.cpp:144
#45 0x0000000100c6e229 in KoOpenPane::KoOpenPane () at KoOpenPane.cpp:169
#46 0x0000000100c13910 in KoDocument::createOpenPane () at KoDocument.cpp:2315
#47 0x0000000100c13ef9 in KoDocument::showStartUpWidget () at KoDocument.cpp:2266
#48 0x0000000100c0afb3 in KoApplication::start () at KoApplication.cpp:148
#49 0x000000010001f4d7 in kdemain () at main.cc:46
#50 0x000000010000dee9 in main () at krita_dummy.cpp:3
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Is the environment variable $KDEDIR set? If it isn't, set KDEDIR to where the main KDE installation is, and KDEDIRS to $KDEDIR:/path/to/koffice/install

Code: Select all
export KDEDIR=/path/to/kde/install
export KDEDIRS=$KDEDIR:/path/to/koffice/install
kbuildsycoca4 --noincremental


Then use dbus-launch to run Krita.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
quux_qorge
Registered Member
Posts
13
Karma
0
OS
Thank you very much for your quick answer. I've tried different possibilities for KDEDIR(S) and launched kbuildsycoca4 afterwards, but no luck. I even changed my KDESYCOCA and KDEHOME...

Stupid question here: is kdebase required for koffice ? I only have compiled kdelibs, and koffice's cmake didn't complain..


PS: if anyone is interested in koffice on Mac, please contact me. I think I will release a binary once my build is stable
User avatar
zander
KDE Developer
Posts
87
Karma
1
The 'runtime' part of kdebase is required at runtime, the workspace part is not.


Thomas Zander
KWord maintainer
User avatar
quux_qorge
Registered Member
Posts
13
Karma
0
OS
Hello,

Thank you for your help. I'll compile kdebase-runtime and see what happens. I'll post here as soon as I have a result.

PS1: a while ago I posted a patch for kdelibs for Mac on the fink list (tho I didn't use fink to complie my build), but no one has reviewed it yet (it's for the file "kkeyserver_mac.cpp").

PS2: everything in kde is 100% llvm compliant :) I used llvm-gcc rather than gcc, for the challenge ^^
User avatar
quux_qorge
Registered Member
Posts
13
Karma
0
OS
:(( still the same error.. what else can I do ?

I've deleted my kde cache dir, and kbuildsycoca4 re-created it. Now I see the proper pictures in krita rather than just "[ ? ]" icons. So I think my paths are ok..

Maybe it's my dbus "session.conf" file ?

Here is my script that starts krita
Code: Select all
#!/bin/bash
cd "`dirname \"$0\"`"
INSTALL_DIR=/Library/koffice

export PATH="${INSTALL_DIR}/bin:${INSTALL_DIR}/lib/kde4/libexec:${PATH}"
# OS X paths :
export DYLD_LIBRARY_PATH=/System/Library/Frameworks/ApplicationServices.framework/Versions/A/\
Frameworks/ImageIO.framework/Versions/A/Resources:$INSTALL_DIR/lib:/System/Library/\
Frameworks/OpenGL.framework/Versions/A/Libraries:/usr/lib/:/usr/X11/lib
export DYLD_FRAMEWORK_PATH="${INSTALL_DIR}/lib":/System/Library/Frameworks
export DYLD_ROOT_PATH="${INSTALL_DIR}"

export DBUS_TEST_HOMEDIR=/tmp/dbus_test_homedir
export KDEHOME=$HOME/Library/Preferences/KDE
export KDESYCOCA=$KDEHOME/foobar
export KDEDIR=$INSTALL_DIR
export KDEDIRS=$KDEDIR:$INSTALL_DIR/bin
$INSTALL_DIR/bin/kbuildsycoca4 --noincremental

cd $INSTALL_DIR/bin/krita.app/Contents/MacOS
"${INSTALL_DIR}/bin/dbus-launch" --config-file="${INSTALL_DIR}/share/dbus-1/session.conf" ./krita $*

killall dbus-daemon
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Try this....

Code: Select all
#!/bin/bash
cd "`dirname \"$0\"`"
INSTALL_DIR=/Library/koffice

export PATH="${INSTALL_DIR}/bin:${INSTALL_DIR}/lib/kde4/libexec:${PATH}"
# OS X paths :
export DYLD_LIBRARY_PATH=/System/Library/Frameworks/ApplicationServices.framework/Versions/A/\
Frameworks/ImageIO.framework/Versions/A/Resources:$INSTALL_DIR/lib:/System/Library/\
Frameworks/OpenGL.framework/Versions/A/Libraries:/usr/lib/:/usr/X11/lib
export DYLD_FRAMEWORK_PATH="${INSTALL_DIR}/lib":/System/Library/Frameworks
export DYLD_ROOT_PATH="${INSTALL_DIR}"

export KDEHOME=$HOME/Library/Preferences/KDE
export KDEDIR=$INSTALL_DIR
export KDEDIRS=$KDEDIR:$INSTALL_DIR/bin

# D-Bus autolaunch is broken, so we launch it now....
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
    eval `dbus-launch --sh-syntax --exit-with-session --config-file="${INSTALL_DIR}/share/dbus-1/session.conf"`
fi

# Get KDEInit running, which will help manage the session
kdeinit4 &

# Wait a few moments for it...
sleep 10s

# Lets launch Krita
$INSTALL_DIR/bin/krita.app/Contents/MacOS/krita $*


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
quux_qorge
Registered Member
Posts
13
Karma
0
OS
Thanks again for your help. I think this could be it... kdeinit4 outputs some errors, but once I can fix that I hope the message box won't show again.

Code: Select all
$./krita_start
<unknown program name>(2379)/ getBundle: getBundle( "/Library/koffice/lib/kde4/libexec/klauncher" ,  false ) called
<unknown program name>(2379)/ getBundle: getBundle(): returning  "/Library/koffice/lib/kde4/libexec/klauncher.app/Contents/MacOS/klauncher"
kdeinit4: preparing to launch /Library/koffice/lib/kde4/libexec/klauncher.app/Contents/MacOS/klauncher
kdeinit4: (klauncher /Library/koffice/lib/kde4/libexec/klauncher.app/Contents/MacOS/klauncher) Pipe closed unexpectedlykdeinit4: Pipe closed unexpectedly: No such file or directory
<unknown program name>(2379)/ getBundle: getBundle( "/Library/koffice/lib/kde4/libexec/kded4" ,  false ) called
<unknown program name>(2379)/ getBundle: getBundle(): returning  "/Library/koffice/lib/kde4/libexec/kded4.app/Contents/MacOS/kded4"
kdeinit4: preparing to launch /Library/koffice/lib/kde4/libexec/kded4.app/Contents/MacOS/kded4
kdeinit4: (kded4 /Library/koffice/lib/kde4/libexec/kded4.app/Contents/MacOS/kded4) Pipe closed unexpectedlykdeinit4: Pipe closed unexpectedly: No such file or directory
kdeinit4: Communication error with launcher. Exiting!


Two things here:
- kded4 and klauncher are inside bundles, which is a bit crazy but getBundle() apparently can find the executable anyways
- I get a "No such file or directory" error, but the executables inside the brackets actually exist (.../MacOS/kded and klauncher)

Maybe a little gdb will help. I'll keep on updating this post
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
INSTALL_DIR=/Library/koffice

Where do you have your main KDE installation? If that is not /Library/koffice you need to make a few changes....

$KDEDIR should be to the root of your main KDE installation
$KDEDIRS should be as follows: $KDEDIR:/Library/koffice

If $KDEDIR is /Library/koffice then $KDEDIRS needs only be set to $KDEDIR

For $PATH, including libexec is not needed. KDE applications will locate and launch applications from here without problems if $KDEDIR is correctly set up.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
quux_qorge
Registered Member
Posts
13
Karma
0
OS
Ok, thank you.

The CMAKE_INSTALL_PREFIX is "/Library/koffice" and the BUNDLE_INSTALL_DIR is "/Library/koffice/bin". I've tried to change the kdedir(s) to "bin" and to other things, but I always have the same error. I think I can find what the problem is by adding some printf to the code and with the help of gdb.

I'll make some more tests... next year ;D
User avatar
quux_qorge
Registered Member
Posts
13
Karma
0
OS
Ok I cannot resist, I'd really like to see koffice working on Mac. I have a few spare minutes, so here is what I have found so far.

- in kinit.cpp, the function launch() is trying to find a shared library. But on Mac, dynamic libs end with the extension ".dylib", not ".so" ! Therefor it cannot find the lib.
- I've sym-linked the .dylibs to files of the same name but with a ".so" extension. Now kinit can find the lib, but it still has the same "not found" errors.
- the line 499 "d.fork = fork();" fails and the "case" goes to "default"
- running kdeinit4 with --nofork doesn't help
- right now I'm recompiling kdelibs with a patch that makes it find libs with the "dylib" extension and I'll see what happens

EDIT1: this may be linked to the fact the Mac OS 10.6 doesn't allow fork() without exec() for some reason...

EDIT2: Confirmed ! This is indeed because Mac OS 10.6 doesn't allow fork() without exec(). I suspect this is not gonna be easy to fix this. I suppose I have to call execl() somewhere

Final Edit: not much more I can do right now. As far as I can tell, start_klauncher() is called in the child process but then OSX makes it crash as soon as the process makes calls to the file manager.

Final final edit: ok sorry for the flood. But the problem has already been reported here:
https://bugs.kde.org/show_bug.cgi?id=209903
workaround here:
http://trac.macports.org/attachment/tic ... rash.patch

not yet tested, but if someone can review it, it would be great to officially add this patch to kdelibs
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
The issue of hardcoding of *.so is definitely a bug in KDEInit. Patches to fix that will more than likely be welcome.

I would recommend contacting the KDE Mac team, and working with them to have it submitted to KDE Trunk. Note that due to the critical nature of KDEInit ( many applications depend upon it simply to launch, which is what all the kdeinit_*.so libraries are for ) this will need to be reviewed on kde-core-devel.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
quux_qorge
Registered Member
Posts
13
Karma
0
OS
Hi, and happy new year !

The issue of hardcoding of *.so is definitely a bug in KDEInit. Patches to fix that will more than likely be welcome.

I would recommend contacting the KDE Mac team, and working with them to have it submitted to KDE Trunk.
Ok no problem. I'll see if there is someone on the Mac team I can contact.


I used the mentioned patch to fix the "fork" issue. Now kdeinit seems to work as intended. But I still can't get dbus to work.
Code: Select all
<unknown program name>(88820)/ launch: kdeinit4: launch() setting argv:  /Library/koffice/lib/kde4/libexec/klauncher
klauncher(88820) kdemain: No DBUS session-bus found. Check if you have started the DBUS server.
kdeinit4: Communication error with launcher. Exiting!


The script is:
Code: Select all
(snip)
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
    eval `dbus-launch --sh-syntax --exit-with-session --config-file="${INSTALL_DIR}/share/dbus-1/session.conf"`
fi
# testing kdeinit4 without launching krita
${INSTALL_DIR}/bin/kdeinit4.app/Contents/MacOS/kdeinit4

and dbus is indeed running in the background.

Google says that this is something that could happen, but only if I am root (which I am not).
That's where I'm stuck right now... something with dbus. I'll see if I can make a simple Qt-dbus program work
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Check to see if dbus-launch is setting the variable $DBUS_SESSION_BUS_ADDRESS

Code: Select all
echo $DBUS_SESSION_BUS_ADDRESS


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
quux_qorge
Registered Member
Posts
13
Karma
0
OS
Yes
Code: Select all
(snip)
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
   eval `dbus-launch --sh-syntax --exit-with-session --config-file="${INSTALL_DIR}/share/dbus-1/session.conf"`
   echo "Dbus env: $DBUS_SESSION_BUS_ADDRESS : $DBUS_SESSION_BUS_PID"
fi


the output:
Code: Select all
Dbus env: unix:path=/tmp/dbus_temp,guid=0f2ea904c0debc63dfd707d84b3e745f : 94067


That's the path I set in the config file. I don't see any reference to DBUS_SESSION_BUS_ADDRESS in klauncher (only in kkernel_mac.cpp and process.cpp)


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan