Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check system for user installed Linux dependencies #1180

Merged
merged 5 commits into from
Mar 15, 2022

Conversation

leaanthony
Copy link
Member

@leaanthony leaanthony commented Feb 23, 2022

Attempts to discover the dependencies if not installed via the package manager.
The library discovery code is untested!

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 23, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7d0d51e
Status: ✅  Deploy successful!
Preview URL: https://02acd615.wails-website.pages.dev

View logs

@pebbe
Copy link

pebbe commented Feb 24, 2022

Better, but still not correct...

Dependency	Package Name		Status		Version
----------	------------		------		-------
*docker		docker.io		Installed	20.10.5+dfsg1
gcc		build-essential		Installed	10.2.1
libgtk-3	libgtk-3-dev		Available	3.24.24-4
libwebkit	libwebkit2gtk-4.0-dev	Available	2.34.6-1~deb11u1
npm		npm			Installed	8.5.0
pkg-config	pkg-config		Installed	0.29.2

However, after unset LANG I get:

Dependency	Package Name		Status		Version
----------	------------		------		-------
*docker		docker.io		Installed	20.10.5+dfsg1-1+deb11u1
gcc		build-essential		Installed	12.9
libgtk-3	libgtk-3-dev		Installed	3.24.24-4
libwebkit	libwebkit2gtk-4.0-dev	Installed	2.34.6-1~deb11u1
npm		npm			Installed	8.5.0
pkg-config	pkg-config		Installed	0.29.2-1

Here is the output for version v2.0.0-beta.31 after unset LANG:

Dependency	Package Name		Status		Version
----------	------------		------		-------
*docker		docker.io		Installed	20.10.5+dfsg1-1+deb11u1
gcc		build-essential		Installed	12.9
libgtk-3	libgtk-3-dev		Installed	3.24.24-4
libwebkit	libwebkit2gtk-4.0-dev	Installed	2.34.6-1~deb11u1
npm		npm			Available	7.5.2+ds-2
pkg-config	pkg-config		Installed	0.29.2-1

I have installed all mention packages through the package manager, except npm, which is too old.
So the fix is a partial fix.

@leaanthony
Copy link
Member Author

Why would LANG change things? All I'm doing for the libraries is running pkg-config and checking if it finds the cflags for the given library

@pebbe
Copy link

pebbe commented Feb 24, 2022

~ apt list build-essential
Bezig met oplijsten... Klaar
build-essential/stable,now 12.9 amd64 [geïnstalleerd]
build-essential/stable 12.9 i386

~ unset LANG

~ apt list build-essential
Listing... Done
build-essential/stable,now 12.9 amd64 [installed]
build-essential/stable 12.9 i386

@leaanthony
Copy link
Member Author

Nice catch @pebbe - I think we can fix this by setting LANG before shelling. Thanks for taking time to test 👍

@leaanthony
Copy link
Member Author

@pebbe - I've added a change that will attempt to set LANG for the call. I'm unable to test this locally. Is there a more robust way to detect packages are installed?

@pebbe
Copy link

pebbe commented Feb 26, 2022

Perhaps this?

dpkg-query -W -f '${status}\t${package}\t${version}\n' docker* build-* libgtk* libwebkit* npm pkg-config

checker := checkerFunctions[dep.Name]
if checker != nil {
checkLocallyInstalled(checker, dep)
continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is continue really needed here?

also the if on line 48 what protects us against?

var stdo, stde bytes.Buffer
cmd.Stdout = &stdo
cmd.Stderr = &stde
cmd.Env = append(os.Environ(), "LANG=en_US.utf8")
Copy link
Contributor

@bh90210 bh90210 Feb 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am afraid that this fix wont cut it

$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=fr_FR.UTF-8
$ wails doctor
Wails CLI v2.0.0-beta.test


Scanning system - Please wait (this may take a long time)...Done.

System
------
OS:                     Ubuntu
Version:                20.04
ID:                     ubuntu
Go Version:             go1.17.1
Platform:               linux
Architecture:           amd64
Package Manager:        apt

Dependency      Package Name            Status          Version
----------      ------------            ------          -------
*docker         docker.io               Installed       20.10.12
gcc             build-essential         Installed       9.3.0
libgtk-3        libgtk-3-dev            Available       3.24.20-0ubuntu1
libwebkit       libwebkit2gtk-4.0-dev   Available       2.34.4-0ubuntu0.20.04.1
npm             npm                     Installed       8.3.1
pkg-config      pkg-config              Installed       0.29.1

* - Optional Dependency

Diagnosis
---------
Your system has missing dependencies!

Required package(s) installation details: 
  - libgtk-3: sudo apt install libgtk-3-dev
  - libwebkit: sudo apt install libwebkit2gtk-4.0-dev

I am looking into it brb

var stdo, stde bytes.Buffer
cmd.Stdout = &stdo
cmd.Stderr = &stde
cmd.Env = append(os.Environ(), "LANG=en_US.utf8")
Copy link
Contributor

@bh90210 bh90210 Feb 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change line 69 to

cmd.Env = append(os.Environ(), "LC_ALL=en_US.utf8")
$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=fr_FR.UTF-8
$ wails doctor
Wails CLI v2.0.0-beta.test


Scanning system - Please wait (this may take a long time)...Done.

System
------
OS:                     Ubuntu
Version:                20.04
ID:                     ubuntu
Go Version:             go1.17.1
Platform:               linux
Architecture:           amd64
Package Manager:        apt

Dependency      Package Name            Status          Version
----------      ------------            ------          -------
*docker         docker.io               Installed       20.10.12
gcc             build-essential         Installed       12.8ubuntu1.1
libgtk-3        libgtk-3-dev            Installed       3.24.20-0ubuntu1
libwebkit       libwebkit2gtk-4.0-dev   Installed       2.34.4-0ubuntu0.20.04.1
npm             npm                     Installed       8.3.1
pkg-config      pkg-config              Installed       0.29.1-0ubuntu4

* - Optional Dependency

Diagnosis
---------
Your system is ready for Wails development!

https://stackoverflow.com/questions/43953328/how-to-set-locale-in-the-current-terminals-session

@bh90210
Copy link
Contributor

bh90210 commented Feb 26, 2022

#1179

@leaanthony
Copy link
Member Author

Do we think this can be merged?

@leaanthony
Copy link
Member Author

Merging this as it appears to be better than what we have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants