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

perl.exe: MSVCR120.dll: cannot open shared object file: No such file or directory #970

Open
DavidLibault opened this issue Jun 13, 2023 · 7 comments

Comments

@DavidLibault
Copy link

Hi all,

I installed gvsbuild on a fresh windows 11 Pro (version 22H2) following the gvsbuild readme.
GTK4 built, (although I don't understand why gtk4-demo.exe did not build automatically...).

To have gstreamer on the system, I did :

> gvsbuild build gstreamer
> gvsbuild build gst-plugins-base
> gvsbuild build gst-plugins-good

but the gst-plugins-good build fails as libvpx refuses to build :

(tar) Exporting libvpx
Building project libvpx (1.13.0)
(Stripping trailing CRs from patch; use --binary to disable.)
patching file build/make/gen_msvs_vcxproj.sh
Hunk #1 succeeded at 296 (offset -4 lines).
(Stripping trailing CRs from patch; use --binary to disable.)
patching file libs.mk
C:/gtk-build/tools/perl-5.20.0/x64/bin/perl.exe: error while loading shared libraries: MSVCR120.dll: cannot open shared object file: No such file or directory
Perl is required to build

Configuration failed. This could reflect a misconfiguration of your
toolchains, improper options selected, or another problem. If you
don't see any useful error messages above, the next step is to look
at the configure error log file (config.log) to determine what
configure was trying to do when it died.
Traceback (most recent call last):
  File "C:\Users\DavidLibault\.local\pipx\venvs\gvsbuild\Lib\site-packages\gvsbuild\utils\builder.py", line 525, in build
    if self.__build_one(p):
       ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\DavidLibault\.local\pipx\venvs\gvsbuild\Lib\site-packages\gvsbuild\utils\builder.py", line 661, in __build_one
    skip_deps = proj.build()
                ^^^^^^^^^^^^
  File "C:\Users\DavidLibault\.local\pipx\venvs\gvsbuild\Lib\site-packages\gvsbuild\projects\libvpx.py", line 57, in build
    self.exec_vs(
  File "C:\Users\DavidLibault\.local\pipx\venvs\gvsbuild\Lib\site-packages\gvsbuild\utils\base_project.py", line 195, in exec_vs
    self.builder.exec_vs(
  File "C:\Users\DavidLibault\.local\pipx\venvs\gvsbuild\Lib\site-packages\gvsbuild\utils\builder.py", line 935, in exec_vs
    self.__execute(
  File "C:\Users\DavidLibault\.local\pipx\venvs\gvsbuild\Lib\site-packages\gvsbuild\utils\builder.py", line 1039, in __execute
    subprocess.check_call(args, cwd=working_dir, env=env, shell=True)
  File "C:\Python311\Lib\subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'C:\tools\msys64\usr\bin\bash ./configure --target=x86_64-win64-vs17 --prefix=/C/gtk-build/gtk/x64/release --enable-pic --as=nasm --disable-unit-tests --size-limit=16384x16384 --enable-postproc --enable-multi-res-encoding --enable-temporal-denoising --enable-vp9-temporal-denoising --enable-vp9-postproc --disable-tools --disable-examples --disable-docs ' returned non-zero exit status 1.
Error: libvpx build failed

perl was built by gvsbuild, and the executable is located at :

C:\gtk-build\tools\perl-5.20.0\x64\bin\

For information, launching a gvsbuild build of perl gives :

> gvsbuild build perl
Build type is Configuration.debug_optimized
Cleaning up the build environment
Checking msys tool
Using C:\tools\msys64 for msys installation
Checking Msvc tool

Visual Studio installation(s) found:
    Visual Studio Community 2022 @ C:\Program Files\Microsoft Visual Studio\2022\Community
    Visual Studio Build Tools 2022 @ C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools

Using Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
Downloading packages
Building project perl (5.20.0)

Project(s) built:
    perl                      (0.000 s)

but when I try it with :

> C:\gtk-build\tools\perl-5.20.0\x64\bin\perl -e 'print "Hello World\n"'

The command returns without printing anything on the console (perl --help doesn't return anything either). So it looks like the perl package install on gvsbuild silently failed.

@tjwilli58
Copy link
Contributor

tjwilli58 commented Jun 13, 2023

Not sure, but maybe this would help? (Reinstall Microsoft Visual C++ 2013 Redistributable package)

https://answers.microsoft.com/en-us/windows/forum/all/msvcr120dll-is-missing-or-error/aafe820f-4dbb-4043-aba2-e4ac2dcf69c1

Download from here

@danyeaw
Copy link
Member

danyeaw commented Jun 17, 2023

@DavidLibault Thanks for submitting the issue!
I am not able to reproduce this, Perl is building fine for me, and running your hello world test prints Hello World for me as well.

Maybe the build of Perl was interrupted in the middle, and now it is skipping to rebuild it because it is already installed. Have you tried rebuilding things with the --from-scratch option?

@DavidLibault
Copy link
Author

I did :

> gvsbuild build --from-scratch perl

and got :

Build type is Configuration.debug_optimized
Cleanup build directories
Removing working/building dir (C:\gtk-build\build\x64\release)
Removing destination dir (C:\gtk-build\gtk\x64\release)
Removing git expand dir (C:\gtk-build\src\git-exp)
Removing tools dir (C:\gtk-build\tools)
Cleaning up the build environment
Checking msys tool
Using C:\tools\msys64 for msys installation
Checking Msvc tool

Visual Studio installation(s) found:
    Visual Studio Community 2022 @ C:\Program Files\Microsoft Visual
Studio\2022\Community
    Visual Studio Build Tools 2022 @ C:\Program Files (x86)\Microsoft Visual
Studio\2022\BuildTools

Using Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
Downloading packages
Traceback (most recent call last):
  File "C:\Users\DavidLibault\.local\pipx\venvs\gvsbuild\Lib\site-packages\gvsbuild\utils\builder.py", line 525, in build
    if self.__build_one(p):
       ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\DavidLibault\.local\pipx\venvs\gvsbuild\Lib\site-packages\gvsbuild\utils\builder.py", line 618, in __build_one
    proj.prepare_build_dir()
  File "C:\Users\DavidLibault\.local\pipx\venvs\gvsbuild\Lib\site-packages\gvsbuild\utils\base_project.py", line 467, in prepare_build_dir
    if self.update_build_dir():
       ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\DavidLibault\.local\pipx\venvs\gvsbuild\Lib\site-packages\gvsbuild\utils\base_tool.py", line 55, in update_build_dir
    self.unpack()
  File "C:\Users\DavidLibault\.local\pipx\venvs\gvsbuild\Lib\site-packages\gvsbuild\tools.py", line 200, in unpack
    self.mark_deps = extract_exec(
                     ^^^^^^^^^^^^^
  File "C:\Users\DavidLibault\.local\pipx\venvs\gvsbuild\Lib\site-packages\gvsbuild\utils\base_expanders.py", line 144, in extract_exec
    tar.extractall(
  File "C:\Python311\Lib\tarfile.py", line 2257, in extractall
    self._extract_one(tarinfo, path, set_attrs=not tarinfo.isdir(),
  File "C:\Python311\Lib\tarfile.py", line 2324, in _extract_one
    self._handle_fatal_error(e)
  File "C:\Python311\Lib\tarfile.py", line 2320, in _extract_one
    self._extract_member(tarinfo, os.path.join(path, tarinfo.name),
  File "C:\Python311\Lib\tarfile.py", line 2403, in _extract_member
    self.makefile(tarinfo, targetpath)
  File "C:\Python311\Lib\tarfile.py", line 2448, in makefile
    with bltn_open(targetpath, "wb") as target:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'C:\\gtk-build\\tools\\perl-5.20.0\\x64\\lib\\AnyDBM_File.pm'
Error: perl build failed

The 'AnyDBM_File.pm' has the following access permissions :

 > ls 'C:\gtk-build\tools\perl-5.20.0\x64\lib\AnyDBM_File.pm\AnyDBM_File.pm

    Répertoire : C:\gtk-build\tools\perl-5.20.0\x64\lib

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-ar---        31/01/2014     21:55           2618 AnyDBM_File.pm

So I understand gvsbuild is trying to open AnyDBM_File.pm with write permissions although the file has been installed with read only permissions...

Having installed perl modules with read only permissions looks right to me, what would gvsbuild want to modify a perl module for ?

@danyeaw
Copy link
Member

danyeaw commented Jun 24, 2023

@DavidLibault have you tried removing the C:\gtk-build\tools directory entirely prior to building? Gvsbuild is trying to extract the tar ball, and for some reason it can't do so.

@DavidLibault
Copy link
Author

@danyeaw : yes, deleting the perl directory in C:\gtk-build\tools did allow perl to install. Thanks. Maybe the --from-scratch option should also clean the tools directory...

But perl was still not working.

When launching perl from the command line (Windows PowerShell), the executable silently failed to run. But when gvsbuild tried to launch perl it was giving the MSVCR120.dll missing error (see my first post).

@tjwilli58 : you were right, installing the "Microsoft Visual C++ 2013 Redistributable package" fixes the problem.

As I am not using Visual C++ 2013 (outdated), the dll was not on my build system. I don't know how this issue should be properly addressed... Probably by building perl from sources instead of doing the (uncomplete) binary install...

@danyeaw
Copy link
Member

danyeaw commented Jul 4, 2023

@DavidLibault Our Perl install is using Strawberry Perl for Windows which is the standard way to install Perl. A few options:

  1. As you pointed out, we could build Perl from source. This would slow down builds for everyone and Perl uses autotools, so it would probably rebuild it each time (not smart like Meson or CMake)
  2. We could remove Perl from gvsbuild, and tell users to install Strawberry Perl ahead of time using choco install strawberryperl or through the installer
  3. We could update the readme to recommend installing Microsoft Visual C++ 2013 with choco install vcredist-all

@danyeaw danyeaw changed the title libvpx build fails when buiding gst-plugins-good for gstreamer because of the perl package perl.exe: MSVCR120.dll: cannot open shared object file: No such file or directory Jun 22, 2024
@danyeaw
Copy link
Member

danyeaw commented Jun 22, 2024

Installing Visual Studio 2013 Redestributable fixes the original issue. https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2013-vc-120--no-longer-supported

We could temporarily add this to the README and then work on getting a newer version of Perl supported.

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

3 participants