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

Error on "gvsbuild build pygobject" #1081

Open
codeXiaoMing opened this issue Sep 20, 2023 · 13 comments
Open

Error on "gvsbuild build pygobject" #1081

codeXiaoMing opened this issue Sep 20, 2023 · 13 comments

Comments

@codeXiaoMing
Copy link

When running "gvsbuild build --enable-gi --py-wheel gobject-introspection gtk4 libadwaita gtksourceview5 pygobject pycairo adwaita-icon-theme hicolor-icon-theme" the following error occurs:

https://pastebin.com/9GJ3Y57T

My development environment:
windows10
choco 2.2.2
git 2.42.0
graphviz 9.0.0
msys2 20230718.0.0
visualstudio2022buildtools 117.7.4
visualstudio2022-workload-vctools 1.0.0
visualstudio-installer 2.0.03
python 3.11.5
pipx 1.2.0
gvsbuild 2023.9.0
poetry 1.6.1

@danyeaw
Copy link
Member

danyeaw commented Sep 21, 2023

Hi @codeXiaoMing, this looks like the same issue as in #877. Is your language set to Chinese as well?

@codeXiaoMing
Copy link
Author

Yes, my language is set to Chinese

@danyeaw
Copy link
Member

danyeaw commented Sep 21, 2023

Would it be possible to set your language to English to help isolate this to some type of unicode error?

@codeXiaoMing
Copy link
Author

I have tried using VMware to create an English version of Windows and successfully configured the development environment. But I don't think this is a good choice, I will try this method https://www.cnblogs.com/Steven-HU/p/14547749.html

@danyeaw
Copy link
Member

danyeaw commented Sep 21, 2023

Was that method to change the system locale?

@codeXiaoMing
Copy link
Author

yes, It also mentions that there are several other ways to solve this problem:

  1. Modify the project file or source file, and disable the C4819 warning
  2. Modify the file content to avoid using illegal characters
  3. Save the file in Unicode format again

@danyeaw
Copy link
Member

danyeaw commented Sep 24, 2023

Hey @codeXiaoMing, I don't think this is specific to Gvsbuild, GLib (which was the code that PyGObject was building against when the error occurred) has some guidance which is to set the non-unicode language to English:
https://gitlab.gnome.org/GNOME/glib/-/blob/main/docs/win32-build.md#c4819-build-errors

It does give a 2nd option to use the /UTF-8 flag with MSVC, but it doesn't sound like that is always effective.

@codeXiaoMing
Copy link
Author

@danyeaw you are right. The method you mentioned is what I mentioned earlier. I have successfully installed pygobject using this method

@codeXiaoMing
Copy link
Author

I have already configured the environment according to the official installation process and successfully ran gaphors using “poetry run gaphor”, but an error occurred during the second run

PS D:\project\MBSE-tool-develop\gaphor-main> poetry run gaphor
No translations were found for language zh_CN: [Errno 2] No translation file found for domain: 'gaphor'
Traceback (most recent call last):
File "", line 1, in
File "D:\project\MBSE-tool-develop\gaphor-main\gaphor\main.py", line 21, in main
commands: dict[str, argparse.ArgumentParser] = initialize("gaphor.argparsers")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\project\MBSE-tool-develop\gaphor-main\gaphor\entrypoint.py", line 13, in initialize
return init_entry_points(load_entry_points(scope, services), **known_services)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\project\MBSE-tool-develop\gaphor-main\gaphor\entrypoint.py", line 29, in load_entry_points
cls = ep.load()
^^^^^^^^^
File "D:\python\Lib\importlib\metadata_init_.py", line 202, in load
module = import_module(match.group('module'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\python\Lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1126, in _find_and_load_unlocked
File "", line 241, in _call_with_frames_removed
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in find_and_load_unlocked
File "", line 690, in load_unlocked
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "D:\project\MBSE-tool-develop\gaphor-main\gaphor\plugins\diagramexport_init
.py", line 8, in
from gaphor.diagram.export import (
File "D:\project\MBSE-tool-develop\gaphor-main\gaphor\diagram_init
.py", line 5, in
import gi
File "D:\project\MBSE-tool-develop\gaphor-main.venv\Lib\site-packages\gi_init.py", line 47, in
from . import _gi
ImportError: DLL load failed while importing _gi

@danyeaw
Copy link
Member

danyeaw commented Sep 24, 2023

It looks like it can't find PyGObject to import any longer. Do you still have your environmental variables set?

$env:Path = "C:\gtk-build\gtk\x64\release\bin;" + $env:Path
$env:LIB = "C:\gtk-build\gtk\x64\release\lib;" + $env:LIB
$env:INCLUDE = "C:\gtk-build\gtk\x64\release\include;C:\gtk-build\gtk\x64\release\include\cairo;C:\gtk-build\gtk\x64\release\include\glib-2.0;C:\gtk-build\gtk\x64\release\include\gobject-introspection-1.0;C:\gtk-build\gtk\x64\release\lib\glib-2.0\include;" + $env:INCLUDE

For the C4819 errors, do you think we should add that to the Gvsbuild README? Are you interested in making a pull request?

@codeXiaoMing
Copy link
Author

After resetting these environment variables, there was no problem. thank you. I think it is necessary to add the C4819 errors to Gvsbuild README. My recent plan is to develop some customized content based on gaphor, and then I can organize the process for solving the C4819 error and make a pull request

@codeXiaoMing
Copy link
Author

I encountered an error while attempting to package when running this command:poetry run poe win-installer

D:\project\MBSE-tool-develop\gaphor-2.20.0>poetry run poe win-installer
Poe => win-installer
Cleaning files
Building Installer
Traceback (most recent call last):
File "", line 1, in
File "D:\project\MBSE-tool-develop\gaphor-2.20.0_packaging\windows\build-win-installer.py", line 107, in main
build_installer(icon, nsi, gaphor_files, installer)
File "D:\project\MBSE-tool-develop\gaphor-2.20.0_packaging\windows\build-win-installer.py", line 28, in build_installer
subprocess.run(
File "D:\python\Lib\subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\python\Lib\subprocess.py", line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "D:\python\Lib\subprocess.py", line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

@danyeaw
Copy link
Member

danyeaw commented Sep 24, 2023

@codeXiaoMing Ok, I'll leave this open until we update the docs.

Let's move Gaphor support to that project 👍

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

No branches or pull requests

2 participants