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

[package] gfortran/10.2: cannot execute ‘f951’: execvp: No such file or directory #14120

Open
samuel-emrys opened this issue Nov 9, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@samuel-emrys
Copy link
Contributor

Description

After the changes in #12613, I'm still not able to use the binary gfortran package to compile any code. It fails with:

gfortran: fatal error: cannot execute ‘f951’: execvp: No such file or directory

Relates to #4696

Package and Environment Details

  • Package Name/Version: gfortran/10.2
  • Operating System+version: Arch Linux
  • Compiler+version: Clang 14
  • Docker image: N/A
  • Conan version: conan 1.53.0
  • Python version: Python 3.10.0

Conan profile

[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=clang
compiler.libcxx=libstdc++11
compiler.version=14
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
CC=/usr/bin/clang
CXX=/usr/bin/clang++
[conf]
tools.build:skip_test=False

Steps to reproduce

I modified the test package with the following to better use and test the executable produced by the gfortran package:

diff --git a/recipes/gfortran/all/conanfile.py b/recipes/gfortran/all/conanfile.py
index 209997c47..897d199be 100644
--- a/recipes/gfortran/all/conanfile.py
+++ b/recipes/gfortran/all/conanfile.py
@@ -77,3 +77,6 @@ class GFortranConan(ConanFile):
         self.cpp_info.includedirs = []
         self.env_info.PATH.append(bin_path)
         self.cpp_info.libs = ["gfortran"]
+        compiler = os.path.join(bin_path, "gfortran")
+        self.output.info(f"Exporting FC={compiler}")
+        self.buildenv_info.define("FC", compiler)

diff --git a/recipes/gfortran/all/test_package/conanfile.py b/recipes/gfortran/all/test_package/conanfile.py
index 9d3aaf213..1cfbb70a4 100644
--- a/recipes/gfortran/all/test_package/conanfile.py
+++ b/recipes/gfortran/all/test_package/conanfile.py
@@ -1,14 +1,70 @@
+import os
+import shutil
 from conan import ConanFile
-from conan.tools.build import can_run
+from conan.tools.build import cross_building
+from conan.tools.env import VirtualBuildEnv, VirtualRunEnv

 class TestPackageConan(ConanFile):
-    settings = "os", "arch", "compiler", "build_type"
-    generators = "VirtualBuildEnv"
+    settings = "os", "compiler", "build_type", "arch"
     test_type = "explicit"

+    @property
+    def _input_file(self):
+        return os.path.join(self.source_folder, "hello.f90")
+
+    @property
+    def _output_file(self):
+        return os.path.join(self.build_folder, "hello_f90")
+
     def build_requirements(self):
         self.tool_requires(self.tested_reference_str)

+    def generate(self):
+        buildenv = VirtualBuildEnv(self)
+        buildenv.generate()
+
+        runenv = VirtualRunEnv(self)
+        runenv.generate()
+
+    def build(self):
+        self.run("echo PATH: $PATH")
+        self.output.info(f"Testing build using gfortran")
+        # Confirm compiler is propagated to env
+        self.run("echo FC: $FC", env="conanbuild")
+        self.run("$FC --version", env="conanbuild")
+        self.run("$FC -dumpversion", env="conanbuild")
+
+        # Confirm files can be compiled
+        self.run(
+            f"$FC {self._input_file} -o {self._output_file}",
+            env="conanbuild",
+        )
+        self.output.info(f"Successfully built {self._output_file}")
+
+
     def test(self):
-        if can_run(self):
-            self.run("gfortran --version", env="conanrun")
+        def chmod_plus_x(name):
+            if os.name == "posix":
+                os.chmod(name, os.stat(name).st_mode | 0o111)
+
+        self.output.info(f"Testing application built using gfortran")
+        if not cross_building(self):
+            chmod_plus_x(f"{self._output_file}")
+
+            if self.settings.os == "Linux":
+                if shutil.which("readelf"):
+                    self.run(f"readelf -l {self._output_file}", env="conanrun")
+                else:
+                    self.output.info(
+                        "readelf is not on the PATH. Skipping readelf test."
+                    )
+
+            if self.settings.os == "Macos":
+                if shutil.which("otool"):
+                    self.run(f"otool -L {self._output_file}", env="conanrun")
+                else:
+                    self.output.info(
+                        "otool is not on the PATH. Skipping otool test."
+                    )
+
+            self.run(f"{self._output_file}", env="conanrun")

diff --git a/recipes/gfortran/all/test_package/hello.f90 b/recipes/gfortran/all/test_package/hello.f90
new file mode 100644
index 000000000..ff78fe234
--- /dev/null
+++ b/recipes/gfortran/all/test_package/hello.f90
@@ -0,0 +1,4 @@
+program hello
+  implicit none
+  write(*,*) 'gfortran: Hello, World!'
+end program hello
cd conan-center-index/recipes/gfortran/all
conan create . 10.2@ --build=missing -k

Logs

Click to expand log
conan create . 10.2@ --build=missing -k
Exporting package recipe
gfortran/10.2 exports: File 'conandata.yml' found. Exporting it...
gfortran/10.2 exports: Copied 1 '.yml' file: conandata.yml
gfortran/10.2: The stored package has not changed
gfortran/10.2: Using the exported files summary hash as the recipe revision: 8ba3feb8a6a4695315c6c38b679c630c
gfortran/10.2: Exported revision: 8ba3feb8a6a4695315c6c38b679c630c
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=clang
compiler.libcxx=libstdc++11
compiler.version=14
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
CC=/usr/bin/clang
CXX=/usr/bin/clang++
[conf]
tools.build:skip_test=False

gfortran/10.2: Forced build from source
gfortran/10.2 (test package): Installing package
Requirements
    gfortran/10.2 from 'olympus-conan-center' - Cache
Packages
    gfortran/10.2:4db1be536558d833e52e862fd84d64d75c2b3656 - Build

Installing (downloading, building) binaries...
gfortran/10.2: Building your package in /home/user/.conan/data/gfortran/10.2/_/_/build/4db1be536558d833e52e862fd84d64d75c2b3656
gfortran/10.2: Generator txt created conanbuildinfo.txt
gfortran/10.2: Aggregating env generators
gfortran/10.2: Calling build()
Downloading gcc-10.2.0.tar.xz completed [69720.23k]                                      gfortran/10.2: n/10.2:
gfortran/10.2:
gfortran/10.2: Package '4db1be536558d833e52e862fd84d64d75c2b3656' built
gfortran/10.2: Build folder /home/user/.conan/data/gfortran/10.2/_/_/build/4db1be536558d833e52e862fd84d64d75c2b3656
gfortran/10.2: Generated conaninfo.txt
gfortran/10.2: Generated conanbuildinfo.txt
gfortran/10.2: Generating the package
gfortran/10.2: Package folder /home/user/.conan/data/gfortran/10.2/_/_/package/4db1be536558d833e52e862fd84d64d75c2b3656
gfortran/10.2: Calling package()
gfortran/10.2: Copied 1 file: LICENSE
gfortran/10.2: Copied 1 file: gfortran
gfortran/10.2: Copied 1 '.a' file: libgfortran.a
gfortran/10.2 package(): Packaged 1 '.a' file: libgfortran.a
gfortran/10.2 package(): Packaged 2 files: LICENSE, gfortran
gfortran/10.2: Package '4db1be536558d833e52e862fd84d64d75c2b3656' created
gfortran/10.2: Created package revision 2ee11d7271e714d1a0ed2016b21e29b2
gfortran/10.2: Appending PATH environment variable: /home/user/.conan/data/gfortran/10.2/_/_/package/4db1be536558d833e52e862fd84d64d75c2b3656/bin
gfortran/10.2: Exporting FC=/home/user/.conan/data/gfortran/10.2/_/_/package/4db1be536558d833e52e862fd84d64d75c2b3656/bin/gfortran
gfortran/10.2 (test package): Generator txt created conanbuildinfo.txt
gfortran/10.2 (test package): Calling generate()
gfortran/10.2 (test package): Aggregating env generators
gfortran/10.2 (test package): Generated conaninfo.txt
gfortran/10.2 (test package): Generated graphinfo
Using lockfile: '/home/user/projects/conan-center-index/recipes/gfortran/all/test_package/build/c4c7a5053aa755720ec6a4032683d902e16b40af/conan.lock'
Using cached profile from lockfile
gfortran/10.2 (test package): Calling build()
PATH: /home/user/.conan/data/gfortran/10.2/_/_/package/4db1be536558d833e52e862fd84d64d75c2b3656/bin:/home/user/projects/conan-center-index/recipes/lapack/all/venv/bin:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/:/home/user/.pyenv/shims:/home/user/.pyenv/bin:/Users/user/.local/bin:/usr/local/opt/python/libexec/bin:/home/user/.local/bin:/home/user/.poetry/bin:/usr/local/sbin:/usr/local/opt:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/intel/oneapi/compiler/2022.1.0/linux/bin:/Library/TeX/texbin
gfortran/10.2 (test package): Testing build using gfortran
FC: /home/user/.conan/data/gfortran/10.2/_/_/package/4db1be536558d833e52e862fd84d64d75c2b3656/bin/gfortran
GNU Fortran (GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

10.2.0
gfortran: fatal error: cannot execute ‘f951’: execvp: No such file or directory
compilation terminated.
ERROR: gfortran/10.2 (test package): Error in build() method, line 68
        self.run(
        ConanException: Error 1 while executing $FC /home/user/projects/conan-center-index/recipes/gfortran/all/test_package/hello.f90 -o /home/user/projects/conan-center-index/recipes/gfortran/all/test_package/build/c4c7a5053aa755720ec6a4032683d902e16b40af/hello_f90
@samuel-emrys samuel-emrys added the bug Something isn't working label Nov 9, 2022
@samuel-emrys
Copy link
Contributor Author

cc @uilianries

@uilianries
Copy link
Member

@samuel-emrys I think your best change is waiting for your PR #13896

@samuel-emrys
Copy link
Contributor Author

@uilianries agree, I just wanted to capture that the gfortran package is currently broken. Unfortunately #13896 is only a partial solution since it won't build on windows or Macos yet, so I was still hoping for this one to work to enable a lapack recipe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants