Scheduled Maintenance: Over the course of a few days we will be addressing issues with the search backend. General search, newposts, yourposts, and other search driven queries may fail during the update. Details and discussion here: viewtopic.php?t=159736

 

 

 

Building KDE 4 with NetworkManager support

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
andre.neves
Posts: 10
Joined: 2008-02-18 09:26

Building KDE 4 with NetworkManager support

#1 Post by andre.neves »

or: guide to configuration and compilation of NetworkManager source

Are you trying to compile kdebase-workspace-4.0.2 with support for your beloved NetworkManager package, but cmake just does not admit you HAVE the goddamn network-manager-dev package installed?

Code: Select all

-----------------------------------------------------------------------------
-- The following OPTIONAL packages could NOT be located on your system.
-- Consider installing them to enable more features from this software.
+ NetworkManager (any version): NetworkManager is a daemon for user
  controlled networking <http://www.gnome.org/projects/NetworkManager>
-----------------------------------------------------------------------------
Don't feel lonely. I had enough of that, too.

The problem seems to be that, unfortunately, the default debian network-manager packages do not install all that KDE 4 needs. Because of this, we have to manually compile and install the NetworkManager sources in order to have KDE include it. Don't worry, though! It shouldn't be hard, now that I already spent my late night hours deciphering NetworkManager's ridiculously lame and obscure compile-time bugs :).

In summary, what we have to do is this:
1. Compile and install NetworkManager from source
2. Remove cmake's cache (rm CMakeCache.txt) and run cmake again

First of all, download NetworkManager's source here. I used version 0.6.5, which was the latest as of April 1st 2008.

Now, before you start configuring and compiling, I recommend using apt-get to fetch the build dependencies. Might save you some headache.

Code: Select all

apt-get build-dep network-manager
Now extract NM's source archive and hop onto the new directory. Let's configure it.

Configuring NetworkManager

From the new directory, do:

Code: Select all

./configure
If you have any special parameters you'd like to pass, do it.

If you get the following error:

Code: Select all

configure: error: wireless-tools >=28pre9 not installed or not functional
then you need to run the build-dep command I said above. Even if you checked, and you do have wireless-tools installed. Do it. Now.

If everything has gone well, go to the next step.

Compiling NetworkManager

Compiling NetworkManager got really tricky here. Let's see if you get luckier than me 8).

Run

Code: Select all

make
Tip: if you, like me, has a dual-core processor, run

Code: Select all

make -j2
instead. This will spawn two make processes, thus using both your cores fully. If you just used the regular make without parameters, you'd end up with 50% idle CPU time.

Everything went well? No? Wow...

Compiling error #1: libnl too new

The first compile-time error I got was this:

Code: Select all

NetworkManager-0.6.5/src/NetworkManagerSystem.c:229: undefined reference to `nl_handle_alloc_nondefault'
NetworkManager-0.6.5/src/NetworkManagerSystem.c:230: undefined reference to `nl_handle_set_pid'
After some research, I found that those types were not supplied by the newer versions of libnl anymore, so I needed to install an older version. Google told me that 1.0-pre6 was old enough, so I went on and installed those. You can fetch the sources here, as I did, and don't worry: it's really small and should be a breeze to compile. Of course, you can install the newest version again after NetworkManager is installed.

Now that you installed libnl, don't forget to configure NetworkManager's installation again, so it finds the newly-installed old libs :). I also think it's a good idea to clean the current half-build, so this one-liner might be a good idea for you (it starts the make process after configuring):

Code: Select all

make clean && ./configure && make
Compiling error #2: GNOME too new

Code: Select all

nm-vpn-properties.c:59: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
nm-vpn-properties.c:60: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
nm-vpn-properties.c: In function ‘vpn_druid_vpn_validity_changed’:
nm-vpn-properties.c:258: error: ‘druid’ undeclared (first use in this function)
nm-vpn-properties.c:258: error: (Each undeclared identifier is reported only once
nm-vpn-properties.c:258: error: for each function it appears in.)
nm-vpn-properties.c: At top level:
nm-vpn-properties.c:266: error: expected ‘)’ before ‘*’ token

** SNIP ** more unexpected stuff ** SNIP **

nm-vpn-properties.c: In function ‘add_cb’:
nm-vpn-properties.c:423: error: ‘druid’ undeclared (first use in this function)

** SNIP ** even more unexpected stuff (make is so naive) ** SNIP **

make[3]: *** [nm_vpn_properties-nm-vpn-properties.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory `/home/andre/download/NetworkManager-0.6.5/gnome/vpn-properties'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/andre/download/NetworkManager-0.6.5/gnome'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/andre/download/NetworkManager-0.6.5'
make: *** [all] Error 2
Ok... This one was really nasty. As you can see by now, it seems that the guys developing NM don't like to code against current stuff.

This error is due to NetworkManager trying to use deprecated GNOME libraries, even though NM's default makefiles have flags set disabling use of deprecated structures. Go figure.

The flag that is erroneously set is GNOME_DISABLE_DEPRECATED. We just have to remove references to it from the makefiles to fix the compilation.

If you look for the flag's name inside all files in the source directory, for example with

Code: Select all

grep -R GNOME_DISABLE_DEPRECATED *
the result will probably be

Code: Select all

gnome/vpn-properties/Makefile.in:        -DGNOME_DISABLE_DEPRECATED                      \
gnome/vpn-properties/Makefile.am:        -DGNOME_DISABLE_DEPRECATED                      \
libnm-util/Makefile.in: -DGNOME_DISABLE_DEPRECATED              \
libnm-util/Makefile.am: -DGNOME_DISABLE_DEPRECATED              \
utils/Makefile.in:      -DGNOME_DISABLE_DEPRECATED                      \
utils/Makefile.am:      -DGNOME_DISABLE_DEPRECATED                      \
All we have to do to fix the bug is to remove those lines from those files. Don't waste your time messing with the Makefile.am files, though. The only ones that need modification are Makefile.in files (mind the extension!). Have fun with your favorite plain-text editor!

Don't forget to clean the current build and to run configure again after fixing the files, in order to generate new Makefile files.

Code: Select all

make clean && ./configure && make
Installing NetworkManager

If you don't get any more errors, it's time to install the newly-compiled package.

Code: Select all

su -c 'make install'
Of course, you may use sudo if you wish. I just can't get used to it.

Now let's go back to compiling kdebase-workspace!

Configuring kdebase-workspace

Now that you have a complete, made-from-scratch NetworkManager build freshly installed, cmake should be able to recognize it. Just running cmake . again on kdebase-workspace directory won't be enough, though. You have to remove the cache from the previous cmake run.

In kdebase-workspace source directory, do:

Code: Select all

rm CMakeCache.txt
This will do cmake go through all the default include and lib dirs again the next time you run it. Go ahead.

Code: Select all

cmake .
If everything goes well, you should now be rewarded with this.

Code: Select all

-----------------------------------------------------------------------------
-- The following external packages were located on your system.
-- This installation will have the extra features provided by these packages.
+ BlueZ
+ NetworkManager 0.6.5
+ lm-sensors
+ Compositing support
+ Captury framework
+ libusb
+ libxft
Congratulations! All external packages have been found.
-----------------------------------------------------------------------------
Final words

I really like NetworkManager and its simplicity, and I'm glad it has made into KDE's Solid. Also, I endlessly appreciate open-source initiatives, and refrain as best as I can from criticizing them, given the effort and good will from developers in making our lifes easier for the sake of it.

I would just like to tell the maintainers of NetworkManager and its Debian packages that all this headache should not be necessary. I feel that the network-package-dev package should provide Debian users with all the files they need, and, if it does not, there is no apparent good reason for GNOME's NetworkManager to be so hard to compile.

Other than that, thanks, maintainers, for the good work so far, and good luck, users, with your NetworkManager-enabled KDE 4!

User avatar
Jackiebrown
Posts: 1246
Joined: 2007-01-02 04:46
Location: San Antonio, TX

#2 Post by Jackiebrown »

It was looking for libnm-util-dev

Post Reply