How to develop Flutter web app on Windows Subsystems for Linux (Debian 10) - google-chrome

I would like to develop Flutter web app on Windows Subsystems for Linux (Debian 10). I followed this instruction. https://flutter.dev/docs/get-started/codelab-web
flutter channel beta
flutter upgrade
flutter config --enable-web
First, I input these commands in my terminal and all of them worked fine.
Second, I tried flutter doctor command and this is the result.
Downloading android-arm-release/linux-x64 tools... 2.1s
Downloading android-arm64-profile/linux-x64 tools... 1.8s
Downloading android-arm64-release/linux-x64 tools... 1.6s
Downloading android-x64-profile/linux-x64 tools... 1.6s
Downloading android-x64-release/linux-x64 tools... 1.5s
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 1.18.0-11.1.pre, on Linux, locale en_US.UTF-8)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] Connected device (1 available)
! Doctor found issues in 3 categories.
I develop web app, so I don't need Android toolchain and Android Studio, but I need Chrome.
I think there are two ways.
install Chrome on WSL => I searched the Internet, but I couldn't find the way to do so.
user Chrome on Windows 10(not WSL) => I searched the Internet (for example:flutter chrome "windows subsystems for linux"), but I couldn't find the way to do so.
Could you give me any advice?

Try setting the environment variable CHROME_EXECUTABLE to the path of the Chrome executable installed on Windows, so Flutter can locate it.

Turns out, you just need to tell flutter where chrome.exe is located on your host windows machine!

One way to do this is to use GUI Apps, which unfortunately requires WSL version 2 and Windows 11. Read More
Making WSL and GUI Apps ready
If you don't already have wsl, run Powershell in Admin mode and run
wsl --install -d Ubuntu
sudo apt update
change the distro as you like
If you have, run these to make sure it's ready
wsl --set-default-version 2
wsl --update
wsl --shutdown
sudo apt update
Installing Google Chrome on WSL
Change directories into the temp folder: cd /tmp
Use wget to download it: sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
Get the current stable version: sudo dpkg -i google-chrome-stable_current_amd64.deb
Fix the package: sudo apt install --fix-broken -y
Configure the package: sudo dpkg -i google-chrome-stable_current_amd64.deb
To launch, enter: google-chrome
You should be good to go
Running flutter doctor should mark web development as ready, and projects should run with this command:
flutter run -d chrome --web-renderer canvaskit

My WSL2(Windows 10 build 18363) did not recognise the environment variable CHROME_EXECUTABLE.
So, I also added the environment variable WSLENV to 'CHROME_EXECUTABLE/p'.
(https://adamtheautomator.com/windows-subsystem-for-linux/#Sharing_Environment_Variables)
Then, it works!

Related

How to install Mysql-server in Ubuntu offline

I need to install Mysql-server in an Ubuntu 18 machine which do not have any internet access. There are plethora of instruction material exist on this this subject but all they require Ubuntu machine to be online.
One such documentation can be available here (quite comprehensive though)
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04
Any help on offline installation of Mysql-server will be highly helpful.
I suggest you follow this guide on how to use apt-offline. https://linoxide.com/debian/install-debian-packages-offline/
As a general guide:
You start by having apt-offline installed on both PCs, this is done by default on the desktop releases, but can easily be installed by just downloading the .deb package for your release from the packages.ubuntu.com website: https://packages.ubuntu.com/bionic/all/apt-offline/download
Then create a signature that can be put onto another PC that'll do the downloading/fetching updates and make a note that we also need mysql-server
apt-offline set offline-servers-state.sig --install-packages mysql-server
You can then use this signature on a PC connected to the internet using the same tool to check for updates and/or download the required files into a zip file
apt-offline get --bundle zip/file/location/bundle.zip offline-servers-state.sig
Once downloaded you can put this .zip back on the offline server to install the packages
apt-offline install zip/file/location/bundle.zip
You can visit https://dev.mysql.com/downloads/mysql/ from a computer that can go online.
Then, select your OS and version
Download DEB Bundle on a computer that can go online. Move the downloaded file internally to your system that cannot hit the Internet.
Your downloaded file will be a .tar. Use command tar -xvf filename.tar (See https://www.cyberciti.biz/faq/tar-extract-linux/ for command).
You will get a new directory. cd that-directory will get you in that directory. You will see a bunch of .deb files.
Install the deb files one by one using sudo apt-get install filename.deb depending on what you want to install. Other commands to install deb files can be found in this discussion https://unix.stackexchange.com/questions/159094/how-to-install-a-deb-file-by-dpkg-i-or-by-apt.

Compile QEMU under Windows 10 (64-bit) for Windows 10 (64-bit)

I managed to compile QEMU (3.0.50) under Windows 10 (64-bit) (basically following these instructions) with these commands:
./configure --enable-gtk --enable-sdl
make
However, when starting qemu-system-x86_64.exe in a console, nothing happens. I expected a window showing up. Shortly after starting the exe, I'm getting back the prompt. Nothing printed out to the console. No necessary DLL is missing. What could be the problem?
Finally I managed to compile and run QEMU under Windows 10 Home 64-bit.
There are a few pitfalls:
Due to a compiler bug in mingw (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86832 and https://www.mail-archive.com/qemu-devel#nongnu.org/msg557409.html), you have to configure QEMU with --disable-stack-protector and (one solution) add the function __stack_chk_fail to a source file.
Configure QEMU with --disable-werror.
Remove Capstone project from makefile.
Here's a complete step-by-step guide for compiling qemu-system-x86_64.exe:
Date: 2018-10-31
OS: Microsoft Windows 10 Home 64-bit
Guide based on: https://wiki.qemu.org/Hosts/W32#Native_builds_with_MSYS2
Download and install msys2 to C:\msys64:
http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20180531.exe
Start C:\msys64\mingw64.exe
Updates (then close window and restart mingw64.exe): pacman -Syu
Updates: pacman -Su
Install basic packets: pacman -S base-devel mingw-w64-x86_64-toolchain git python
Install QEMU specific packets: pacman -S mingw-w64-x86_64-glib2 mingw-w64-x86_64-gtk3 mingw-w64-x86_64-SDL2
Get QEMU sources:
git clone git://git.qemu-project.org/qemu.git
cd qemu
git submodule update --init ui/keycodemapdb
git submodule update --init capstone
git submodule update --init dtc
Insert
void __stack_chk_fail(void);
void __stack_chk_fail(void)
{
}
to qemu\util\oslib-win32.c
e.g. at line 44
Comment out (#) Capstone (line 508) in qemu\Makefile
Build QEMU:
./configure --enable-gtk --enable-sdl --target-list=x86_64-softmmu --disable-werror --disable-stack-protector
make
Run in qemu/x86_64-softmmu
./qemu-system-x86_64 -L ./../pc-bios
Optional (for better performance): Install HAXM according to this guide: https://www.qemu.org/2017/11/22/haxm-usage-windows/ and start QEMU with option -accel hax
I would do know if somebody tried in 2022 i have currently some issues after compiling.
Firt it asks for libzstd.dll, when i go to the project i found by google and dl this dll, i encounter another issue
with x64.dll
with x32.dll (just in case)
i use msys2 minGw x64 on windows 10 pro x64. At the beginning i would compile a patch, but it the same problem with vanilla, i ask myself if it's an environment problem, a missing dll, or if it's always possible to compile directly on windows10, perhaps now it's only possible to compile in cross platform. I'm not habit at all with mingw64 tools.
I looked for the g_spanw... error and found this https://docs.gtk.org/glib/func.spawn_async_with_fds.html
Perhaps i'm wrong but it's only for gnome, isn't it ?

Run Flash Webpage in Headless Chrome on Ubuntu 14.04

I am trying to run my Cucumber tests headlessly with Chrome on Ubuntu 14.04 (EC2 instance so no GUI). So far my setup allows this, as the below screenshot shows:
I have an issue when I come to a page with flash on it:
I have restarted the EC2 instance and killed all chrome processes, still no joy.
To clarify, a test will start and chrome opens the page with flash on it and I get this message. If I then end the test and start it again I get the same problem. I guess this is not actually restarting chrome as it is a new instance each time?
So to run these tests I am using the headless gem here which acts as the interface to xvfb.
I have Google Chrome 57.0.2987.133 and have added libflashplayer.so to /opt/google/chrome/pluginsusing this https://askubuntu.com/questions/14629/how-do-i-enable-the-partner-repository
A few extras things I have tried include:
sudo apt-get install pepperflashplugin-nonfree
sudo update-pepperflashplugin-nonfree --install
Is there a way to get this to work so I can render flash based sites? Do I need to enable the flash plugin each time I open chrome? I'm hoping I've missed something obvious.
Update
I have tried setting the pepperflashpluginpath when creating the Chrome profile but this is still not working:
Capybara.register_driver :chrome do |app|
chrome_binary = '/usr/bin/google-chrome'
Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => { "binary" => chrome_binary, "args" => ["--ppapi-flash-path=/usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so"] })
Capybara::Selenium::Driver.new(app, :browser => :chrome, :desired_capabilities => capabilities)
end
Thanks
There were three key parts in getting this to work.
Install Chromium Browser
sudo apt-get install chromium-browser (at time this installed version 58)
The Chrome binary is now installed at
/usr/bin/chromium-browser
Install Flash plugin
https://askubuntu.com/questions/531672/how-to-install-flash-payer-in-ubuntu-14-04-lts
First go to /etc/apt/sources.list and uncomment the lines
deb http://archive.canonical.com/ubuntu trusty partner
deb-src http://archive.canonical.com/ubuntu trusty partner
Then run
sudo apt-get update
sudo apt-get install adobe-flashplugin
This installs the flash plugin at
/usr/lib/adobe-flashplugin/libflashplayer.so
Install Chrome Driver
Then run
sudo apt-get install chromium-chromedriver
sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/bin/chromedriver
That's pretty much it, these were the steps that got me running this with Cucumber headless.

how to downgrade Chrome on Ubuntu and disable auto-update?

I want to downgrade my chrome on Ubuntu
Because I have problems when selenium runs against Chrome 34.
I have installed chrome 33.
But then every once in a while the auto-updater update the chrome.
How can i disable the auto-upadter on Linux specifically?
I had a similar task recently. This is the script I ran to download previous Chrome version, disable auto update and check the installed version:
sudo wget http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_75.0.3770.142-1_amd64.deb && \
sudo dpkg -i google-chrome-stable_75.0.3770.142-1_amd64.deb && \
sudo apt-mark hold google-chrome-stable && \
google-chrome-stable --version \
you can google to find an archive website. I have mentioned 2 of them here, though there are hundreds of them around.
0- choose the version you want to install by going to an archive website like this:
http://www.ubuntuupdates.org/pm/google-chrome-stable
1- In the Download section download the 64-Bits or 32-Bits package suitable for your OS ( or you can directly Press APT_INSTALL button)
3- Install the package using Ubuntu software center. you may need to remove the existing version first.
4- for disabling auto updates you can go to SystemSettings/ Software & Updates from Ubuntu applications Menu
Doing the same things command line:
I assume your user name is "user" you replace it with your username.
1- Browse the website http://www.slimjet.com/chrome/google-chrome-old-version.php or any other archive website.
2- Download a proper version of google-chrome ( I brought 49.0.2623.75 Linux_64)
3- Save the downloaded file in /home/user/Downloads
4- Open a console and execute the following commands:
user#host:~/workspace $ cd ~/Downloads/
user#host:~/Downloads $
user#host:~/Downloads $ sudo dpkg -i ./chrome64_49.0.2623.75.deb
of course you would replace the file name with the one you downloaded.
You can search for software and updates in your dash bar
You can click on Softwares and updates app which is listed
Go to the other Software tab in the window which is opened
you can uncheck the http://dl.google.com/linux/chrome/deb/stable main
and then you can uninstall the new version of chrome and install the old one.
Hope this helps.

Can't Connect to Pebble Emulator

while I was trying to test my app on Pebble Emulator using Pebble SDK 3.0, I met a connection problem. The Emulator is working normally, but my host machine can't connect to QEMU virtual machine. So, the app wasn't fired up. See followings:
> pebble build
> pebble --debug install --emulator aplite
[INFO ] Starting phone simulator...
[ERROR ] Could not connect to phone at localhost:12342. Ensure that 'Developer Connection' is enabled in the Pebble app.
I don't know how to do further debugging on this issue.
According to the developer docs if you aren't using the native version of Python (eg. you installed Python with Homebrew or you are using Pyenv, etc.) you need to do the following - with your new version of Python active:
> brew remove boost-python
> brew install boost-python --build-from-source
This fixed things for me.
If your emulator is in a system folder that requires sudo access you will have to type:
sudo pebble --debug install --emulator aplite
You can find where your pebble bin folder is located with
which pebble