Mar 31, 2009
Jan 3, 2009
Kubuntu 8.10: First impressions
My laptop has been "upgraded" since Feisty, I think. Feisty Beta actually. It's gone from Feisty -> Gutsy -> Hardy. And while it's sweet that one can upgrade the operating system without having to reinstall everything, cruft has built up. Suspend quit working after the Gutsy -> Hardy upgrade. The way stuff like X works has completely changed: my old /etc/X11/xorg.conf was full of options I'd discovered by trial and error in order to get KDE4's desktop effects to work. There were lines that I'd carefully commented out in a failed attempt to keep X from spewing errors about imaginary Wacom tablets. Imagine my surprise when I learned that nowadays, xorg.conf is practically blank - all the monitors, input devices, etc. are hotplugged. English translation: All that confusing stuff I had to do to get stuff working in the past? That's done by magic now. I don't need that stuff. (And more than likely, keeping those config files makes things worse, because those options might override the ones chosen by the magic.)
At some point I might have to learn where the new magical X settings come from, if for some reason the magical settings it chooses don't suit me. But frankly, I have less patience for that stuff than I used to. I just want it to work by default.
But the point is: "upgrading" wasn't giving me all the benefits of a fresh new install. So for Intrepid, I said screw this, I'm reinstalling. I want a brand new, out-of-the-box system. Luckily, I had been clever enough in the past to put my /home directory on a separate partition, so it wasn't a big issue. I just made a full backup, and then reinstalled over the partition that had root. I actually went through and hand picked what config files in my home dir to keep, and which to toss out in favor of whatever new default config files are provided nowadays. I kept .mozilla and .opera, so I wouldn't lose my bookmarks and history. I kept .mozilla-thunderbird so I'd keep my email settings. I merged my old .bash_rc with the new .bash_rc, and so on. Finally, I deleted the home dir in the root partition, added a line to the new /etc/fstab to mount my home partition in /home, rebooted, and lived happily ever after.
Haha, yeah right like anything computer-related is "happily ever after". But it was pretty close. Here are some of my comments and feedback on Kubuntu Intrepid.
Sound works out-of-the-box. Yeah! However, I had to change the Master Channel in KMix from PCM to Front. On PCM, the multimedia buttons brought up the on-screen volume display, but didn't actually change the volume.
I went to change the wallpaper - only one wallpaper is installed by default? Come on. That's just lame. And then to confuse things worse, there are TWO packages of wallpapers: kdewallpapers and kdebase-workspace-wallpapers. The ones in kdewallpapers were aweful (Repeating tile patterns? That's so Windows 95.) so I just kept kdebase-workspace-wallpapers. Next time, install that package by default please!
I like that I can just install kubuntu-restriced-extras and get .mp3 playback and friends. Kubuntu might have even prompted that when I tried to play an .mp3 the first time, I forget. Still have to add medibuntu for some stuff, but that's really easy.
But no, I have a list of quibbles and complaints. Some are due to specific KDE4->KDE3 functionality losses, some are stupid defaults, but most are just because of laziness or lack of time on the developers' part probably. Here we go:
At some point I might have to learn where the new magical X settings come from, if for some reason the magical settings it chooses don't suit me. But frankly, I have less patience for that stuff than I used to. I just want it to work by default.
But the point is: "upgrading" wasn't giving me all the benefits of a fresh new install. So for Intrepid, I said screw this, I'm reinstalling. I want a brand new, out-of-the-box system. Luckily, I had been clever enough in the past to put my /home directory on a separate partition, so it wasn't a big issue. I just made a full backup, and then reinstalled over the partition that had root. I actually went through and hand picked what config files in my home dir to keep, and which to toss out in favor of whatever new default config files are provided nowadays. I kept .mozilla and .opera, so I wouldn't lose my bookmarks and history. I kept .mozilla-thunderbird so I'd keep my email settings. I merged my old .bash_rc with the new .bash_rc, and so on. Finally, I deleted the home dir in the root partition, added a line to the new /etc/fstab to mount my home partition in /home, rebooted, and lived happily ever after.
Haha, yeah right like anything computer-related is "happily ever after". But it was pretty close. Here are some of my comments and feedback on Kubuntu Intrepid.
Sound works out-of-the-box. Yeah! However, I had to change the Master Channel in KMix from PCM to Front. On PCM, the multimedia buttons brought up the on-screen volume display, but didn't actually change the volume.
I went to change the wallpaper - only one wallpaper is installed by default? Come on. That's just lame. And then to confuse things worse, there are TWO packages of wallpapers: kdewallpapers and kdebase-workspace-wallpapers. The ones in kdewallpapers were aweful (Repeating tile patterns? That's so Windows 95.) so I just kept kdebase-workspace-wallpapers. Next time, install that package by default please!
I like that I can just install kubuntu-restriced-extras and get .mp3 playback and friends. Kubuntu might have even prompted that when I tried to play an .mp3 the first time, I forget. Still have to add medibuntu for some stuff, but that's really easy.
But no, I have a list of quibbles and complaints. Some are due to specific KDE4->KDE3 functionality losses, some are stupid defaults, but most are just because of laziness or lack of time on the developers' part probably. Here we go:
- The installer. When I hit "Forward", the focus isn't set to the first text box on that page - I must move the mouse and select the first text box myself. An anoyance that got in the way of my type-type-tab-type-type hit "Forward" type-type-tab-type-type mentality. Seriously, it's probably just one line of code to set the focus; I expected more from the Kubuntu devs who put so much emphasis on usability.
- When I created a Google Talk account in Kopete, it set the default server to gmail.com. I was baffeled as to why it didn't work until I went to the Google Talk page and saw it says clearly to use the server talk.google.com. Also, "Use SSL" was unchecked by default when for Google Talk it should be checked by default. Seriously, if they're going to add a separate item for Google Talk instead of including it as a Jabber account, put in the right defaults for goodness sake!
- The knetworkmanager UI has regressed. I use to love clicking the knetworkmanager icon, seeing the available wireless networks and their signal strength in the dropdown, and clicking one to switch to that network immediately. I now have to click multiple times to even see what wireless networks are available! That's worse than in XP. I know Celeste did a usability report on it, so maybe the "good" knetworkmanager was a version modified specifically for Kubuntu and now Kubuntu 8.10 has the vanilla KDE version. I must say, I hope the vanilla KDE knetworkmanager people accept Celeste's advice and implement the usability changes.
- Searching in krunner. No offense, I LOVE THE NEW KRUNNER! I use it all the time. But seriously, some keywords need to be added to apps or smarter indexing used. Typing the word "Internet" returns no hits. Searching for "printer" brings up the HPLIP Toolbox but not system-config-printer-kde. On a general note, how are users going to know to hit F2? Should that be mentioned in the K-menu perhaps?
- The clock was in 24hr mode be default, and no menu option for the clock widget takes you to the time/date settings. Don't be a lazy developer; add a link to the date and time settings from all clock widgets. It's little things like that that need polishing. Maybe that's fixed in 4.2 already, I guess I'll find out later this month.
- There's no printer settings in System Settings. This is a KDE4->KDE3 regression, so I'll give Kubuntu some slack. There is a printer setup utility K-menu > Applications > System, so it's not a total loss. It's not as nice as the old utility, but hopefully that'll be worked out soon. However, I wonder how hard it would have been to put a link in System Settings to the printer utility, or re-use the KDE3 printer module in System Settings. Same applies to the User Manager - it's in the K-menu but not in System Settings which makes it harder to find.
- I have a sneaking suspicion that parts of Special Window Settings may not work. Rules for Keep Above and Show on All Desktops seems to work, but I'm having trouble getting geometry rules to be applied to FF windows based on the window title. Might just be me though... and I hadn't tried that in KDE3 before so I have nothing to compare it with.
- Another Kwin questions: Why is "Desktop navigation wraps around" under Focus, and "Active Desktop Borders" under "Advanced"? They seem tightly related to me. Well, all the Kwin settings need to be organized and explained a little better - I submitted the idea of being able to move your mouse across virtual desktops as a KDE4 feature request, only to later learn it's been in KDE3 for ages, if I had only guessed that's what Active Desktop Borders meant.
- The MythTV frontend package tried to call kdesu to add the user to the mythtv group, but Kubuntu apparently now uses kdesudo. That needs to be fixed. Hm, I may actually file a bug report for that one. (Aw, it's already been fixed.) You really got to be on top of things to file a virgin bug report for KDE these days. I made that mistake just the other day.
- I haven't figured out how to take advantage of strigi. In my old install, I could type "strigi:/" in the addressbar of Konqueror, but that protocol appears to be unsupported now. I installed strigi-client, but in addition to being terribly slow, it has only served to inform me that Strigi has indexed 0 files, despite being enabled in System Settings. Hmph.
- Dolphin is mysteriously slow. Like... I don't know it behaves like it's running on Windows sometimes. Three second delays between when I right click and a menu pops up, that sort of thing. Konqueror seems fine. I'm throwing the Dolphin devs the benefit of the doubt here guessing the speed thing is due to something beyond their control, or that they have implemented large speed improvements in time for KDE 4.2.
Dec 22, 2008
Compiling Qt apps in Windows with MinGW
I love Qt. I haven't actually used it much, as I haven't written many programs, but I've seen enough stuff written about it in developer blogs to have a fanboyish appreciation for the cross-platform toolkit. But aside from installing KDE for Windows back in it's beta days, I hadn't had the opportunity to use the "cross platform" bit until yesterday. I needed to compile screenie for a Windows environment. I knew what I was getting into, having compiled C and C# programs in the past. (I'm a big fan of interpreted languages; compiling always seems to waste hours of development time and involve enormously frustrating obscure compiler and linker errors.) But I loved learning about the process, and particularly discovering that I was capable of overcoming all my compiler errors with my current knowledge and Google. I got to understand Qt (and Windows executables, for that matter) on a more intimate level, solidify in my mind what .dll's are, and what dynamic and static linking are. After multiple attempts, I ended up with a standalone executable that ran perfectly on XP and Vista. It's an amazing feeling, knowing you started with hundreds, maybe thousands of text files - barely contained chaos! - and ended with a single file - pure simplicity. Plus, I may be the first person to compile screenie for Win32, making my work useful to others. Hopefully the author will make it available on screenie's website.
And now for the boring stuff if you're reading this for the human interest aspect; or the interesting part if you're reading this for the "How To" aspect. After reading several articles about cross-compiling Qt, I decided not to attempt that, and just did the whole process in Windows XP.
How to compile a C++ Qt4 application for Windows
Obviously, these directions are specific to compiling screenie. If you're using this as a guide for compiling something else, use your imagination as needed to adjust the steps.
Where applicable, I specify the generic download page for each application, as well as the specific binary version I used.
Since the source for screenie is a Git repository, I figured we need git. Update 2008-12-26: There is a Download button on the screenie Github page to download the source as a zip file. Extract it to C:\screenie and jump to step 5.
By default Qt installs itself for compiling with dynamically linked libraries. This means you have to copy the compiled executable, as well as a bunch of .dll's to each computer you install it on. It's not really a problem: just put them all in a zip file, unzip it on the Desktop, and it runs nicely. But if you're like me, and want a single executable with no dependencies, scroll down to the statically linked bit.
Dynamically linked (.dll dependencies, distribute as .zip file)
Following the advice on the Trolltech website, I used Dependency Walker to find what .dll's the executable requires. I copied those .dll's to the release directory. In screenie's case, Dependency Walker listed QtCore4.dll, QtGui4.dll, msvcrt.dll, and kernel.dll. Kernel.dll is already installed on every windows system so no need to distribute it. Msvcrt.dll is the Microsoft C Runtime Library - probably installed on people's computers, but I included a copy anyway, along with QtCore4.dll and QtGui4.dll. I had to include one more .dll that Dependency Walker did not find, a copy of c:\MinGW\mingwm10.dll. (See note in static compiling.) Also, any plugins used need to be copied to the release folder. In this case, screenie needs the image plugins to read JPEG or GIF files, so copy the contents of c:\Qt\4.4.3\plugins\imageformats to c:\screenie\release\imageformats. You can delete the .dll's whose names end in the letter "d"; they are debug versions and take up a lot of space, and are not used if you compile for release. Copy the release folder to the Desktop, give it a better name (like "screenie"), zip it, and voila! Copy it to another computer and hopefully it will run.
Statically linked (no dependencies, single file to distribute)
To my dismay, compiling statically was not simple. To begin, we must recompile Qt itself.
When Qt is statically linked, it cannot dynamically load plugins. (Turns out it's an artificial restriction that's easily overwritten.) But we want those image plugins statically compiled into our final executable. To make that happen you have to do the following voodoo. Luckily it's straight from the Trolltech documentation.
(There are plugins for some other image formats, like .tiff and .ico but I didn't think most people would need more than .jpeg, .png, and .gif. PNG support is built into Qt so it doesn't have a plugin.) These lines of code are necessary to compile it statically, but I don't know yet if those lines cause trouble if you try to compile the code dynamically.
(The CONFIG one is a guess... I actually got it from a page on compiling custom plugins, but figured we want all things static, so why not throw it in? Not gonna make them less static.) Voodoo done.
But no! You're a perfectionist. You want more. The screenie.exe file is about 10 MB. Let's see if we can shrink that! I got these tips from http://www.qtforum.org/post/85635/static-compiling.html#post85635
I had to manually unzip it to C:\Program Files and add it's directory to Window's Path environment variable.
And now for the boring stuff if you're reading this for the human interest aspect; or the interesting part if you're reading this for the "How To" aspect. After reading several articles about cross-compiling Qt, I decided not to attempt that, and just did the whole process in Windows XP.
How to compile a C++ Qt4 application for Windows
Obviously, these directions are specific to compiling screenie. If you're using this as a guide for compiling something else, use your imagination as needed to adjust the steps.
Where applicable, I specify the generic download page for each application, as well as the specific binary version I used.
1. Download and install Qt4 with MinGWI used version: ftp://ftp.trolltech.com/qt/source/qt-win-opensource-4.4.3-mingw.exe
(http://trolltech.com/downloads/opensource/appdev/windows-cpp)
Since the source for screenie is a Git repository, I figured we need git. Update 2008-12-26: There is a Download button on the screenie Github page to download the source as a zip file. Extract it to C:\screenie and jump to step 5.
2. Download and install msysgitI used version: http://msysgit.googlecode.com/files/Git-1.6.0.2-preview20080923.exe
(http://code.google.com/p/msysgit/downloads/list)
3. Run Git Bash and execute git clone git://github.com/ariya/screenie.git
4. Copy the downloaded source directory to c:\screenie
5. Open the Qt 4.4.3 Command Prompt from the start menu.It's like a normal command prompt, except with some environment variables and bash scripts set. (For instance, it appears to alias make to mingw32-make, which saves typing.) It is assumed you are using the Qt Command Prompt for all the steps below involving a prompt.
By default Qt installs itself for compiling with dynamically linked libraries. This means you have to copy the compiled executable, as well as a bunch of .dll's to each computer you install it on. It's not really a problem: just put them all in a zip file, unzip it on the Desktop, and it runs nicely. But if you're like me, and want a single executable with no dependencies, scroll down to the statically linked bit.
Dynamically linked (.dll dependencies, distribute as .zip file)
6. cd C:\screenie
7. Issue qmake -spec "C:\Qt\4.4.3\mkspecs\win32-g++"For some reason, qmake seemed confused out-of-the-box, and I had to fix several things in the makefile. I used the Find and Replace feature in Crimson Editor (my favorite Windows text editor.)
8. In Makefile.Release replace:The same substitutions would be needed to fix Makefile.Debug, except instead of QtGui4 and QtCore4 it's the debug versions QtGui4d and QtCore4d. But you don't need to build the debug version anyway.
"iwmake\build_mingw_opensource" with "Qt\4.4.3"
(There were 8 instances)
"QtGui" with "QtGui4"
"QtCore" with "QtCore4"
(Both in the LIBS line)
9. Issue make.The compiled executable appears in C:\screenie\release. Test the program and see if it works. For me, Screenie worked on Windows! Yea!
Following the advice on the Trolltech website, I used Dependency Walker to find what .dll's the executable requires. I copied those .dll's to the release directory. In screenie's case, Dependency Walker listed QtCore4.dll, QtGui4.dll, msvcrt.dll, and kernel.dll. Kernel.dll is already installed on every windows system so no need to distribute it. Msvcrt.dll is the Microsoft C Runtime Library - probably installed on people's computers, but I included a copy anyway, along with QtCore4.dll and QtGui4.dll. I had to include one more .dll that Dependency Walker did not find, a copy of c:\MinGW\mingwm10.dll. (See note in static compiling.) Also, any plugins used need to be copied to the release folder. In this case, screenie needs the image plugins to read JPEG or GIF files, so copy the contents of c:\Qt\4.4.3\plugins\imageformats to c:\screenie\release\imageformats. You can delete the .dll's whose names end in the letter "d"; they are debug versions and take up a lot of space, and are not used if you compile for release. Copy the release folder to the Desktop, give it a better name (like "screenie"), zip it, and voila! Copy it to another computer and hopefully it will run.
Statically linked (no dependencies, single file to distribute)
To my dismay, compiling statically was not simple. To begin, we must recompile Qt itself.
6. Using the Qt 4.4.3 Command Prompt from the start menu...This takes a long time. I read later to do a distclean before rebuilding... but I didn't and it built OK. However, I wonder if this is why later qmake decided to link to the old .dll's ending in 4.
cd C:\Qt\4.4.3
configure -static
7. make sub-srcThis takes a really long time. (By this point it was past 3:00 am, so I left it running while I slept.)
When Qt is statically linked, it cannot dynamically load plugins. (Turns out it's an artificial restriction that's easily overwritten.) But we want those image plugins statically compiled into our final executable. To make that happen you have to do the following voodoo. Luckily it's straight from the Trolltech documentation.
8. Add Q_IMPORT_PLUGIN() statements for each plugin to the c++ code.I added the lines:
Q_IMPORT_PLUGIN(qjpeg)to screenie.cpp
Q_IMPORT_PLUGIN(qgif)
(There are plugins for some other image formats, like .tiff and .ico but I didn't think most people would need more than .jpeg, .png, and .gif. PNG support is built into Qt so it doesn't have a plugin.) These lines of code are necessary to compile it statically, but I don't know yet if those lines cause trouble if you try to compile the code dynamically.
9. Add a QTPLUGIN line to the .pro fileI added the lines
QTPLUGIN += qjpeg qgifto screenie.pro
CONFIG += static
(The CONFIG one is a guess... I actually got it from a page on compiling custom plugins, but figured we want all things static, so why not throw it in? Not gonna make them less static.) Voodoo done.
10. cd C:\screenieThis time, it seems to not have the iwmake\build_mingw_opensource problem, but it does need for the 4 from the library names to be deleted. When compiling statically, the library names used do not have the 4 in them. I'd love to know why Trolltech thought that was necessary. (Funny how the 4's weren't there when I needed them, and now are there when I don't want them!)
make clean
qmake -config release
11. In Makefile.Release, in the LIBS line, replace -lqjpeg4 and -lqgif4 with -lqjpeg and -lqgif.Delete mthreads because it's an unneeded dependency on mingw10.dll which isn't compiled statically. Apparently Qt doesn't use it, so I don't know why qmake adds it by default. If you don't delete -mthreads, you get an error saying mingw10.dll can't be found when you run it on other computers.
12. Delete all instances of -mthreads in Makefile.Release
13. Now back in C:\screenie issue makeYou should now have a statically compiled executable c:\screenie\release\screenie.exe. See if it works! If everything went according to plan, you can run that file on any Windows XP / Vista computer and use Ariya Hidayat's awesome screenie!
cd release
But no! You're a perfectionist. You want more. The screenie.exe file is about 10 MB. Let's see if we can shrink that! I got these tips from http://www.qtforum.org/post/85635/static-compiling.html#post85635
14. From the release folder, issue strip screenie.exeThis is a command from Qt that removes unnecessary parts of Qt from statically compiled files. Sadly, this didn't reduce the file size much, if any. (Perhaps Qt does that behavior by default now.) But there's another thing you can do to reduce file size.
15. Download and install the Ultimate Packer for eXecutables (http://upx.sourceforge.net/)I used version: http://upx.sourceforge.net/download/upx303w.zip
I had to manually unzip it to C:\Program Files and add it's directory to Window's Path environment variable.
16. Open cmd and cd to c:\screenie\releaseNow it is only 3.58 MB. Sweet!
Issue upx screenie.exe
Subscribe to:
Posts (Atom)

