Installation problems | Problèmes à l'installation
fabounet, Friday 15 February 2013 à 23:33
|
|
Subscription date : 30 November 2007
Messages : 17118
|
great, so do you mean that with this patch all plug-ins will compile fine on BSD ? |
Subscription date : 25 January 2013
Messages : 26
|
fabounet : great, so do you mean that with this patch all plug-ins will compile fine on BSD ?
Yes, now I'm able to compile every plugins.
Thanks a lot
Max Power
P.s.
Let me know if you create a new tarball |
fabounet, Tuesday 19 February 2013 à 22:28
|
|
Subscription date : 30 November 2007
Messages : 17118
|
thank you too for your help
tarballs are available for each new release, so the one for 3.2 will come soon, probably at the end of the month  |
Max Power, Wednesday 20 February 2013 à 08:38
|
|
fabounet, Wednesday 20 February 2013 à 16:29
|
|
Subscription date : 30 November 2007
Messages : 17118
|
It basically does a kind of "pkill cairo-dock" to terminate any third-party applets (that would have been launched by a previous dock, it's particularly useful in case the dock has crashed and respawn)
The System-Monitor applet also uses /proc/<id>/stat, Netspeed uses /proc/net/dev, and PowerManager uses /proc/acpi/battery. Does any of these applets work ? |
Subscription date : 25 January 2013
Messages : 26
|
fabounet : It basically does a kind of "pkill cairo-dock" to terminate any third-party applets (that would have been launched by a previous dock, it's particularly useful in case the dock has crashed and respawn)
The System-Monitor applet also uses /proc/<id>/stat, Netspeed uses /proc/net/dev, and PowerManager uses /proc/acpi/battery. Does any of these applets work ?
No one of them work for me. I'll try to search for the BSD's way to retrieve these informations. |
Subscription date : 25 January 2013
Messages : 26
|
I wrote this for dbus,
...
#ifdef __FreeBSD__
#include <kvm.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#include <limits.h>
#endif
...
void cd_dbus_clean_up_processes (gboolean bAll)
{
kvm_t *kd; //pointer for KVM library
char errbuf[_POSIX2_LINE_MAX]; //error message
int nentries; //number of processes
int p; //current process
struct kinfo_proc *kp;
kd = kvm_openfiles(NULL,"/dev/null",NULL,O_RDONLY,errbuf);
if(kd == 0){
cd_warning ("Dbus : %s",errbuf);
return;
}
kp = kvm_getprocs(kd,KERN_PROC_PROC,0,&nentries);
for(p=0; p<nentries;p++){
//SEARCHING...
if (strcmp (kp[p].ki_comm, myData.cProgName) != 0) // not our program name.
continue;
//..SEEK...
if (bAll || kp[p].ki_ppid==1) // old process, if parent exprired ppid is set to 1
{
//...AND DESTROY
cd_message ("this applet (%s %d) is linked to an old gldi process (%d), kill it.", kp[p].ki_comm, kp[p].ki_pid, kp[p].ki_ppid);
kill (kp[p].ki_pid, SIGKILL); // SIGTERM sometimes lets the process alive.
}
}
kvm_close(kd);
}
...
and add kvm to Dbus/src/CMakeLists.txt
target_link_libraries (${PACKAGE_DBUS}
${DBUSMENU_LIBRARIES}
${DBUSMENU_GTK_LIBRARIES}
${PACKAGE_LIBRARIES}
kvm)
...
target_link_libraries (${PACKAGE_DBUS}
${PACKAGE_LIBRARIES}
kvm)
How can test if my code works fine?
Max Power
P.S.
I, also, forgot to past a patch for Sound-Effects/src/applet-sound.c .
#ifndef __FreeBSD__
#include <endian.h>
#include <byteswap.h>
#else
#include <sys/endian.h>
#endif |
fabounet, Saturday 23 February 2013 à 18:07
|
|
Subscription date : 30 November 2007
Messages : 17118
|
ok for the Sound-Effect, thank you
for the patch:
if (strcmp (kp[p].ki_comm, myData.cProgName) != 0)
I'm not sure this is what we want; we want all the programs that have 'myData.cProgName' as their second to last argument
Indeed, third-party applets are launched with a command line like: 'applet.bin arg1 arg2 arg3 ... cairo-dock pid'
is 'libkvm' a library that is usual on BSD ? |
Subscription date : 25 January 2013
Messages : 26
|
fabounet :
is 'libkvm' a library that is usual on BSD ?
I think so, it's also used for some userland programs such as ps |
Subscription date : 25 January 2013
Messages : 26
|
fabounet : we want all the programs that have 'myData.cProgName' as their second to last argument
Indeed, third-party applets are launched with a command line like: 'applet.bin arg1 arg2 arg3 ... cairo-dock pid'
I wrote this:
void cd_dbus_clean_up_processes (gboolean bAll)
{
kvm_t *kd; //pointer for KVM library
char errbuf[_POSIX2_LINE_MAX]; //error message
int nentries; //number of processes
int p; //current process
struct kinfo_proc *kp;
kd = kvm_openfiles(NULL,"/dev/null",NULL,O_RDONLY,errbuf);
if(kd == 0){
cd_warning ("Dbus : %s",errbuf);
return;
}
kp = kvm_getprocs(kd,KERN_PROC_PROC,0,&nentries);
for(p=0; p<nentries;p++){
//SEARCHING...
char** pidargv = kvm_getargv(kd,&kp[p],0);
if(pidargv==NULL){
continue;//not able to get args
}
int pidargc;
for(pidargc=0;pidargv[pidargc];pidargc++);//get the max argc number
if(pidargc<3) //not enough parameters
continue;
if(strcmp (pidargv[pidargc-2], myData.cProgName) != 0) // not our program name.
continue;
//..SEEK...
if (bAll || kp[p].ki_ppid==1) // old process, if parent exprired ppid is set to 1
{
//...AND DESTROY
cd_message ("this applet (%s %d) is linked to an old gldi process (%d), kill it.", kp[p].ki_comm, kp[p].ki_pid, kp[p].ki_ppid);
kill (kp[p].ki_pid, SIGKILL); // SIGTERM sometimes lets the process alive.
}
}
kvm_close(kd);
}
For every processes that have the last second equals to "myData.cProgName", check if the ppid is expired, so i kill that process. Seems ok?
How can I test it?
TNX
Max Power |
fabounet, Tuesday 26 February 2013 à 22:38
|
|
Subscription date : 30 November 2007
Messages : 17118
|
well, an easy way to test this is to enable some third-part applet in the dock, then kill the dock, check that the applets are still running, then relaunch the dock and check that the old applets have terminated and new ones have been started. |
Max Power, Wednesday 27 February 2013 à 19:53
|
|
Subscription date : 25 January 2013
Messages : 26
|
Seems to work!
marco@misato:/home/marco % killall -9 cairo-dock
marco@misato:/home/marco % ps ux
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
....
**marco 7777 0.0 0.4 217220 35688 1 S 7:48PM 0:00.19 python ./Gmail 2 /org/cairodock/CairoDock/Gmail /home/marco/.config/cairo-dock/current_theme/plug-ins/Gmail/Gmail.conf /home/marco/.config/cairo-dock cairo-dock 7771 (python2.7)**
marco 7782 0.0 0.0 14188 1772 1 R+ 7:48PM 0:00.00 ps ux
[1] + Killed cairo-dock
marco@misato:/home/marco % cairo-dock &
[1] 7783
marco@misato:/home/marco %
============================================================================
Cairo-Dock version : 3.1.99.rc1
Compiled date : Feb 11 2013 23:59:49
Built with GTK : 2.24
Running with OpenGL: 1
============================================================================
warning : (/home/marco/temp/cairo-dock-plug-ins/gvfs-integration/cairo-dock-gio-vfs.c:cairo_dock_gio_vfs_init:55)
VFS Deamon NOT found on DBus !
cairo_dock_create_surface_from_image_simple: assertion `cImageFile != NULL' failed
SET default image: /usr/local/share/cairo-dock/plug-ins/logout/icon.svg
./YoutubeDl: not found
cairo_dock_create_surface_from_image_simple: assertion `cImageFile != NULL' failed
SET default image: /usr/local/share/cairo-dock/plug-ins/GMenu/icon.svg
./Google: not found
g_object_unref: assertion `G_IS_OBJECT (object)' failed
marco@misato:/home/marco % ps ux
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
marco 7783 2.6 1.0 466604 77052 1 S 7:48PM 0:00.90 cairo-dock
marco 1442 0.6 3.0 1011900 243264 0 S 6:30PM 0:17.44 chrome: --type=zygote (chrome)
marco 1374 0.0 0.0 14300 2404 ?? Ss 6:22PM 0:00.03 /usr/local/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
marco 1382 0.0 0.0 22676 3304 ?? S 6:22PM 0:00.34 /usr/local/libexec/gam_server
marco 1324 0.0 0.0 17532 3292 v0 I 6:21PM 0:00.01 -csh (csh)
marco 1343 0.0 0.0 14504 2116 v0 I+ 6:22PM 0:00.00 /bin/sh /usr/local/bin/startx
marco 1361 0.0 0.0 23664 2352 v0 I+ 6:22PM 0:00.00 xinit /home/marco/.xinitrc -- /usr/local/bin/X :0 -auth /home/marco/.serverauth.1343
marco 1365 0.0 0.0 14504 2100 v0 I 6:22PM 0:00.00 /bin/sh /usr/local/bin/start-compiz
marco 1367 0.0 0.5 156840 38636 v0 I 6:22PM 0:17.82 compiz --replace --sm-disable --ignore-desktop-hints ccp
marco 1368 0.0 0.2 135396 14152 v0 S 6:22PM 0:00.92 emerald --replace
marco 1369 0.0 0.3 145516 21096 v0 I 6:22PM 0:03.91 roxterm
marco 1373 0.0 0.0 30104 3176 v0 I 6:22PM 0:00.00 dbus-launch --autolaunch c2733bd7664761f071636e1d00000690 --binary-syntax --close-stderr
marco 1376 0.0 0.0 17532 3864 0 Is+ 6:22PM 0:00.05 /bin/csh
marco 1383 0.0 1.7 453732 135300 0 I 6:22PM 0:25.67 chrome: (chrome)
marco 1384 0.0 0.3 243120 23284 0 I 6:22PM 0:00.15 chrome: (chrome)
marco 1385 0.0 0.3 260952 27988 0 I 6:22PM 0:00.09 chrome: --type=zygote (chrome)
marco 1387 0.0 1.2 883368 96936 0 S 6:23PM 0:01.40 chrome: --type=zygote (chrome)
marco 1389 0.0 1.0 302112 79368 0 S 6:23PM 0:00.63 chrome: --type=gpu-process --channel=1383.2.2111665737 --gpu-vendor-id=0x0000 --gpu-device-id=0x0000 --gpu-driver-vendor --gpu-driver-version (chrome)
marco 1390 0.0 0.8 854568 64740 0 I 6:23PM 0:00.27 chrome: --type=zygote (chrome)
marco 1391 0.0 0.9 867948 75744 0 S 6:23PM 0:03.69 chrome: --type=zygote (chrome)
marco 1393 0.0 1.2 875576 94752 0 I 6:23PM 0:05.71 chrome: --type=zygote (chrome)
marco 1578 0.0 0.0 17532 3744 1 Ss 7:40PM 0:00.04 /bin/csh
**marco 7789 0.0 0.4 217220 35680 1 S 7:48PM 0:00.18 python ./Gmail 2 /org/cairodock/CairoDock/Gmail /home/marco/.config/cairo-dock/current_theme/plug-ins/Gmail/Gmail.conf /home/marco/.config/cairo-dock cairo-dock 7783 (python2.7)** |
fabounet, Thursday 28 February 2013 à 01:25
|
|
Subscription date : 30 November 2007
Messages : 17118
|
seems nice indeed, good job ! |
Subscription date : 25 January 2013
Messages : 26
|
fabounet : seems nice indeed, good job !
Tnx.
This is the netspeed patch
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <glib/gi18n.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <ifaddrs.h>
#include <net/if.h>
#include <net/if_types.h>
#include <net/if_dl.h>
#include "applet-struct.h"
#include "applet-notifications.h"
#include "applet-netspeed.h"
#include "cairo-dock.h"
...
static gboolean _cd_is_a_good_interface (struct ifaddrs *ifa, CairoDockModuleInstance *myApplet)
{
/* some code adapted from http://www.lemoda.net/freebsd/net-interfaces/index.html */
struct sockaddr_dl *sdl = (struct sockaddr_dl *) ifa->ifa_addr;
if (sdl->sdl_type != IFT_ETHER)
return 0;//skip all non ether interfaces such as loopback, usb etc...
if (myConfig.cInterface != NULL) // we monitor all interfaces except 'lo'
{
if (strncmp (ifa->ifa_name, myConfig.cInterface, myConfig.iStringLen) != 0)//check if the interface name is equals to myConfig.cInterface
return 0;
}
return 1;
}
void cd_netspeed_get_data (CairoDockModuleInstance *myApplet)
{
g_timer_stop (myData.pClock);
double fTimeElapsed = g_timer_elapsed (myData.pClock, NULL);
g_timer_start (myData.pClock);
g_return_if_fail (fTimeElapsed > 0.1 || !myData.bInitialized);
myData.bAcquisitionOK = FALSE;
struct ifaddrs *ifap, *ifa;
if (getifaddrs(&ifap) != 0){
cd_warning("NetSpeed : getifaddrs");
return;
}
u_long iReceivedBytes = 0, iTransmittedBytes = 0;
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {//for all interfaces
if(_cd_is_a_good_interface (ifa, myApplet) != 0){//check if the corrent interface is ok
myData.bAcquisitionOK = TRUE;
struct if_data *data = (struct if_data*) ifa->ifa_data;//get data
iReceivedBytes += data->ifi_ibytes;
iTransmittedBytes += data->ifi_obytes;
}
}
if (myData.bInitialized) // first iteration, we can compute the speed
{
myData.iDownloadSpeed = (iReceivedBytes - myData.iReceivedBytes) / fTimeElapsed;
myData.iUploadSpeed = (iTransmittedBytes - myData.iTransmittedBytes) / fTimeElapsed;
}
myData.iReceivedBytes = iReceivedBytes;
myData.iTransmittedBytes = iTransmittedBytes;
if (! myData.bInitialized)
myData.bInitialized = TRUE;
freeifaddrs(ifap);
}
I used u_long instead of long long int, may be a problem? |
Subscription date : 30 November 2007
Messages : 17118
|
great, thank you !
the code seems correct, although I can't test unfortunately, so you have to play both roles: the dev and the beta-tester
however using long long is required, as you can have values greater that 4GB, on 32bits this will fail.
also, ifa->ifa_addr might be NULL if no address is assigned to the interface |
Subscription date : 25 January 2013
Messages : 26
|
Howdy,
fabounet : great, thank you !
the code seems correct, although I can't test unfortunately, so you have to play both roles: the dev and the beta-tester
however using long long is required, as you can have values greater that 4GB, on 32bits this will fail.
also, ifa->ifa_addr might be NULL if no address is assigned to the interface
Ok, I correct the code
void cd_netspeed_get_data (CairoDockModuleInstance *myApplet)
{
g_timer_stop (myData.pClock);
double fTimeElapsed = g_timer_elapsed (myData.pClock, NULL);
g_timer_start (myData.pClock);
g_return_if_fail (fTimeElapsed > 0.1 || !myData.bInitialized);
myData.bAcquisitionOK = FALSE;
struct ifaddrs *ifap, *ifa;
if (getifaddrs(&ifap) != 0){
cd_warning("NetSpeed : getifaddrs");
return;
}
long long int iReceivedBytes = 0, iTransmittedBytes = 0;
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {//for all interfaces
if(_cd_is_a_good_interface (ifa, myApplet) != 0){//check if the corrent interface is ok
myData.bAcquisitionOK = TRUE;
struct if_data *data = (struct if_data*) ifa->ifa_data;//get data
if(data!=NULL){
iReceivedBytes += (long long int)data->ifi_ibytes;
iTransmittedBytes += (long long int)data->ifi_obytes;
}
}
}
if (myData.bInitialized) // first iteration, we can compute the speed
{
myData.iDownloadSpeed = (iReceivedBytes - myData.iReceivedBytes) / fTimeElapsed;
myData.iUploadSpeed = (iTransmittedBytes - myData.iTransmittedBytes) / fTimeElapsed;
}
myData.iReceivedBytes = iReceivedBytes;
myData.iTransmittedBytes = iTransmittedBytes;
if (! myData.bInitialized)
myData.bInitialized = TRUE;
freeifaddrs(ifap);
}
I'm also trying to port SystemMonitor applet, but I don't understand those lines in applet-top.c
if (pipe <= 0) // pas de pot le process s'est termine depuis qu'on a ouvert le repertoire.
{
g_hash_table_remove (pSharedMemory->pProcessTable, &iPid);
continue ;
}
It means that procfs don't remove the pid dir when the process is terminated?
Tnx
Max Power |
Subscription date : 30 November 2007
Messages : 17118
|
ok, we list all running processes from /proc/<id>, and store them in a hash-table
now if a process quits meanwhile (its proc file doesn't exist any more), we remove it from the hash table |
Subscription date : 30 November 2007
Messages : 17118
|
I've merged your code into the trunk, could you please check if everything is ok ?
Thank you ! |
Subscription date : 25 January 2013
Messages : 26
|
fabounet : I've merged your code into the trunk, could you please check if everything is ok ?
Thank you !
Hi fabounet,
I compiled the last BZR version, It works very well with a couple of patches:
for the core
diff -r cairo-dock-core/CMakeLists.txt orig/cairo-dock-core/CMakeLists.txt
88c88
< set (install-pc-path "${CMAKE_INSTALL_PREFIX}/libdata/pkgconfig")
---
> set (install-pc-path "${libdir}/pkgconfig") # it can be different (for example ${CMAKE_INSTALL_PREFIX}/libdata/pkgconfig on BSD)
115a116
>
145,146c146,147
< #check_library_exists (dl dlopen "" HAVE_LIBDL)
< if (NOT HAVE_DLFCN_H)
---
> check_library_exists (dl dlopen "" HAVE_LIBDL)
> if (NOT HAVE_LIBDL OR NOT HAVE_DLFCN_H)
Only in cairo-dock-core/: build
diff -r cairo-dock-core/src/CMakeLists.txt orig/cairo-dock-core/src/CMakeLists.txt
48,49c48
< icon-factory
< intl)
---
> icon-factory)
Only in cairo-dock-core/src: config.h
diff -r cairo-dock-core/src/gldit/CMakeLists.txt orig/cairo-dock-core/src/gldit/CMakeLists.txt
110c110,111
< implementations)
---
> implementations
> dl)
diff -r cairo-dock-core/src/gldit/cairo-dock-config.c orig/cairo-dock-core/src/gldit/cairo-dock-config.c
31,33d30
< #ifdef __FreeBSD__
< #include <unistd.h>
< #else
35c32
< #endif
---
>
Only in cairo-dock-core/src/gldit: gldi-config.h
I added libintl in src/CMakelists.txt because it gaves me this error:
Linking C executable cairo-dock
/usr/local/bin/ld: CMakeFiles/cairo-dock.dir/cairo-dock.c.o: undefined reference to symbol 'libintl_gettext'
/usr/local/bin/ld: note: 'libintl_gettext' is defined in DSO /usr/local/lib/libintl.so.9 so try adding it to the linker command line
/usr/local/lib/libintl.so.9: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
gmake[2]: *** [src/cairo-dock] Error 1
gmake[1]: *** [src/CMakeFiles/cairo-dock.dir/all] Error 2
gmake: *** [all] Error 2
There is a way to define install-pc-path via command line? I tried with -Dinstall-pc-path=/path/to/install without success.
For the plugins:
Only in cairo-dock-plug-ins/: build
diff -r cairo-dock-plug-ins/netspeed/src/applet-netspeed.c orig/cairo-dock-plug-ins/netspeed/src/applet-netspeed.c
128c128
< if (myConfig.cInterface != NULL && strcmp (ifa->ifa_name, myConfig.cInterface) != 0) // we monitor a given interface
---
> if (myConfig.cInterface != NULL && strcmp (ifa->ifa_name, myConfig.cInterface) != 0)) // we monitor a given interface
diff -r cairo-dock-plug-ins/tomboy/src/applet-backend-tomboy.c orig/cairo-dock-plug-ins/tomboy/src/applet-backend-tomboy.c
31c31
< extern struct tm *localtime_r (const time_t *timer, struct tm *tp);
---
> extern struct tm *localtime_r (time_t *timer, struct tm *tp);
diff -r cairo-dock-plug-ins/tomboy/src/applet-notes.c orig/cairo-dock-plug-ins/tomboy/src/applet-notes.c
35c35
< extern struct tm *localtime_r (const time_t *timer, struct tm *tp);
---
> extern struct tm *localtime_r (time_t *timer, struct tm *tp);
applet-netspeed.c has an extra bracket at line 128 ; in FreeBSD, localtime_r has a const time_t* as param instead of time_t*, may be a problem?
Thanks of your great work
Max Power |
Subscription date : 30 November 2007
Messages : 17118
|
Hi !
ok for the plug-ins, I'll correct
I tried with -Dinstall-pc-path=/path/to/install without success.
it should work, try to delete the cache first: rm -f CMakeCache.txt
what is the #include <unistd.h> for in cairo-dock-config.c ? I see it defines 'encrypt' but it's also defined in crypt.h (I don't explain why).
why not linking with 'ld' ? since the dock uses dlopen, where does it come from if it's not from libld ?
how can we check that libintl is present on the system ? |
Installation problems | Problèmes à l'installation
|