02 October 2010

Using Flash Builder 4 on Ubuntu

Flash Builder 4 splash screen on my Ubuntu

So, Adobe has discontinued its Linux version of Flex Builder. That’s sad news for us. Anyway, it doesn’t change much since Linux users already have alternatives long before, e.g. FDT, IDEA. Besides, I have been able to run Flash Builder 4 on my Ubuntu (via Wine) for a while to take advantage of its mxml coding hinting and the unique design view. Let me share some of my experiences of using Flash Builer on Ubuntu so far.

Installation

Some users (here and here) said that they could install Flash Builder 4 (FB4) with Wine. However, that is dated back to the beta version of FB4. I have tried many times with different winetricks to install the released version of FB4 but didn’t succeed. So I have no choice but install it on my Windows virtual machine and copy the installed files to Ubuntu’s wineprefix.

This process is similar to what was described in my previous blog post about making Flash CS5 (and Photoshop CS5) running on Ubuntu, except the winetricks part should be as following:

~$ winetricks msxml3 vcrun2008 usp10 comctl32 ie6

FYI, to my findings, usp10 is for the source editor to work correctly (especially with unicode texts); comctl32 will corrects some win controls and the code hinting popup;and ie6 lets the tooltip display ASdoc help correctly.

design view
(Proof of concept: Flash Builder running on default Ubuntu 10.4 desktop)

Start up

Very often, you will face this error box when starting FB.
memory error
Starting it from command line you will find this message:
Error occurred during initialization of VM
Could not reserve enough space for object heap

Don’t worry, try running the application again. You’ll finally have it started (usually after 2 - 3 attempts).

Passing above blocking error, another error message box will appear (all the time, just like with Flash CS5) but just close it and the initialization carry on. You will also notice a long delay before the Splash screen appear.

Code hinting popup issue

When you type, the code hinting popup may appear but doesn’t respond and you cannot input until the popup is closed. It is because Ubuntu’s windows manager is interfering. To resolve, for now, run the wine config (Application > Wine > Configure Wine OR enter this command in terminal: winecfg) > open tab Graphics > uncheck ‘Allow the window manager to control the windows’.

source view

Now the source editor will work as expected. However, there is some downside: the option Allow the window manager to decorate the windows will not be effective anymore. Besides you will not be able to minimize Flash Builder to GNOME panel. It only minimizes to a small icon floating on the desktop. And there appear to be some glitches with text input focus.

Compile and debug

No extra Java Runtime is needed to compile with FB4. The FB4 has a bundled JRE & Flex SDK that will help you check compile-time errors and compile the project as you type.

For the test run, you can install Flash Player activeX debugger for IE6 in Wine to test the application. However, I have discovered a better way: running it directly on your Linux-native browser and still able to debug. How cool is that? Here’s how:

  1. Open gedit and enter the following text:
       #!/bin/sh
       firefox -url "`wine winepath -u "$1"`"

    What this shell script does is to: open the native Firefox browser with the URL which has been converted from Windows path to Linux path by using ‘wine winepath’ command.
    If you prefer Chromium browser, use this command instead:
       chromium-browser "`wine winepath -u "$1"`"
  2. Name the file as “lnx_browser” and save it to an easy access folder. (Here I choose /home/username/lnx_browser). Remember to allow it execute as program.
  3. In FB, navigate to Window > Preferences > General > Web Browser.
  4. Select “Use external web browser”
  5. Click New, input new browser settings as following:
    Name: Linux Browser
    Location: /home/username/lnx_browser (Must be Linux path, do not use Z:\home…)
    Parameters: %URL%
  6. OK and then select Linux Browser as your chosen external browser.

new linux browser

After setting up external browser, go ahead and run/debug your application. FB4 will show a warning message about not finding Flash Player. Just ignore and click yes. Your application will run on Firefox Linux!

debugging

For testing AIR applications, I just let FB4 use the Windows adl.exe debug loader (no native solution yet). It is fine to test functionality of simple windows. When it uses system tray or something complicated, you can write ANT task of shell script to run the app with native adl.

Isolate FB4 wineprefix

With said configurations and winetricks tweaking, it is very likely that they may affect other installed applications in Wine. I have come across one noticeable case: after setting up for FB4, Photoshop CS5 fails to start due to a conflict with the additional comctl32 library. So, my advice is to isolate FB in a separate wineprefix (default is .wine).

To create a  separate wineprefix use this command (assume you want it to be .winefb):

~$ env WINEPREFIX="/home/username/.winefb" winecfg

That command is actually to open wine config window, since wineprefix doesn’t exist, Wine will create a new one in that folder.

After that, prepend env WINEPREFIX="/home/username/.winefb" before every wine command, for example:

  • Winetricks:
    ~$ env WINEPREFIX="/home/username/.winefb" winetricks msxml3 vcrun2008 usp10 comctl32 ie6
  • Start wine config:
    ~$ env WINEPREFIX="/home/username/.winefb" winecfg
  • Start up FB:
    ~$ env WINEPREFIX="/home/username/.winefb" wine "C:\Program Files\Adobe\Adobe Flash Builder 4\FlashBuilder.exe"

Summary

Here’s my summary in the style of Wine’s AppDB report for your reference:

What works:

Almost all functions

  • Source view
  • Design view
  • Launching / debugging (with above tweaking)
  • Export release builds
  • New project/class wizard
  • All panels: Package Explorer, Outline, Components, Problems, Console, ASDoc, Network monitor, Properties, Styles…

What does not work:

  • Create new folder in New / Import Project wizard

What was not tested:

  • Profiler
  • Unit testing (but I guess it will work)
  • Data/Services

[Vietnamese tag: sử dụng Flash Builder 4 trên Ubuntu, hướng dẫn cài đặt, khắc phục lỗi code hint, biên dịch và debug]

12 comments:

  1. There's an already much better approach: http://code.google.com/p/fb4linux/

    Too bad Flash Player 10.1 is bugged and will detach debugger after 5-20 seconds...

    ReplyDelete
  2. @ LiraNuna: FB4Linux is actually a Wine bridge to run FB4 capabilities within Eclipse. Besides, I'm concerned about the legality of redistributing FB4 binary.
    About your FP10.1 issue, I don't experience it with my approach. (I'm using FP 10.1.53.64 Debugger 32-bit on Firefox Linux)

    ReplyDelete
  3. hi i followed your instruction but realized i couldn't open my photoshop as you mentioned, how can i reverse the system to install fbuilder in separate winefb, thanks in advance

    ReplyDelete
  4. I ran into the same problem with yours and found no way to reverse the system, even when I tried to change the libraries settings in Wine config. The only way is to reinstall Photoshop. (You can keep the wineprefix where you install FB as is. Just rename it and create a fresh wineprefix to install Photoshop)

    ReplyDelete
  5. Thanks for the instruction. Unfortunately, it doesn't work for me. I installed Flash builder and Flash CS5 and the extra dlls with winetricks and it keeps on giving me this error:

    fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0)
    fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.VC90.CRT" (9.0.21022.8)

    I suspect something is wrong with the vcrun2008 but couldn't find it. I followed the steps precisely as above but without success.. I tried wine1.3.6 and 1.3.11. I'm running an ubuntu 10.04 64bit. Any ideas?

    ReplyDelete
  6. You should try to install them on a fresh wine prefix (rename or delete folder ~/.wine) to see if they run as expected. If it is not a fresh wine prefix, old patches and winetricks may affect newly installed programs.
    Related to mentioned error message, please try latest version of Wine (currently 1.3.12) and omit "comctl32" from the winetricks command.
    Besides, I'm using 32-bit Ubuntu so I don't know about 64-bit. It is said that installing and using Windows softwares under 64-bit Ubuntu have more issues.

    ReplyDelete
  7. Thank you so much Thanh! It totally worked! I used wine 1.3.11 (1.3.12 is not yet available for my ubuntu). Both Flash CS5 & Builder are working perfectly. Using 64 bit is not a problem at all. I suspect that the problem was the microsoft office that i had installed earlier. Keeping them in separate prefixes solves the problem. Now I have all my workflow in Ubuntu and I don't need windows at all.

    Thanks again :-)

    ReplyDelete
  8. Thanks Thanh Tran for detailed guide,

    I am able to run FB4 successfully on Kubuntu 10.04 64 bit.
    In design mode right click seems to be not working. I have not tested
    extensively but all views and design mode is being shown correctly.
    I could run a test project but in between a wine error window popsup
    but continues OK. But any how I could able to run the installer as you
    have confirmed in past then I bumped at your blog and in flat 3 hrs
    whole thing has been finished (including testing and installation).

    One question. Can I share same workspace between windows install
    and wine install ? I plan to use Windows for initial heavy design and development
    and then shift to wine install in testing and modification work. My projects
    are Flex+blazeds+java and at present I am using VMware+XP for flex and
    Kubuntu+tomcat+eclipse for java. The flex workspace is on Linux file system
    with drive map using samba. so sharing with wine flex will not be a problem
    but it should not currupt the workspace.

    Anyways thank you very much and keep it up its a great work.

    let us know any updates on this.

    ReplyDelete
  9. As I know, the workspace contains settings and project info for an Eclipse installation. If your Eclipse (here is Flash Builder) installation is consistent, your projects should appear and work the same in both native windows FB and wine FB. Not sure about this. Let's experiment and see how it works out.

    ReplyDelete
  10. hi, i am using ubuntu 11.04 and windows 7 as dual boot.
    i tried all the steps but i am not able to launch the flash builder 4.5 on ubuntu 11.04.

    I encounter the message The Program Flash builder.exe has encountered a serious problem and needs to close but after clicking the close button every thing vanishes after few seconds. What is the fix for this?

    ReplyDelete
  11. this post with respect to the earlier post 
    How to run Flash CS5 on Ubuntu (with Wine)

    and attaching both work like awesome thnks for the post .... keep posting.....

    ReplyDelete