Skip to content

FPM ELF Dynamic Executable displaying Error #72

Open

Description

@b1shtream

I was trying to solve Issue #44 but found this error-

SeaBIOS (version 1.16.1-3.fc38)
Booting from ROM..Powered by
o.   .o       _ _               __ _
Oo   Oo  ___ (_) | __ __  __ _ ' _) :_
oO   oO ' _ `| | |/ /  _)' _` | |_|  _)
oOo oOO| | | | |   (| | | (_) |  _) :_
 OoOoO ._, ._:_:_,\_._,  .__,_:_, \___)
      Prometheus 0.14.0~4cce8306-custom
[    0.153581] ERR:  [appelfloader] <elf_load.c @  135> fpm: ELF executable is not position-independent!
[    0.179544] ERR:  [appelfloader] <elf_load.c @  703> fpm: Parsing of ELF image failed: Exec format error (-8)

Steps to reproduce the error:

  • Make sure you have all the dependencies installed like gcc-gfortran to run FPM.

  • Build the Fortran package manager from the source by following the commands-

    • git clone https://github.com/fortran-lang/fpm

    • cd fpm

    • chmod +x install.sh

    • ./install.sh --prefix=/usr

  • Go to dynamic-apps repo and then create a folder fpm and inside that run sudo ../extract.sh /usr/bin/fpm
    cp /usr/bin/fpm .

  • Go to the run-app-elfloader repository and use the run.sh script to run the application we just prepared:
    sudo ./run.sh -r ../dynamic-apps/fpm/ /bin/fpm --help

I tried running it on Linux and it runs as expected without any errors.
Run on Linux: /usr/bin/fpm --help

NAME
   fpm(1) - A Fortran package manager and build system

SYNOPSIS
   fpm SUBCOMMAND [SUBCOMMAND_OPTIONS]

   fpm --help|--version|--list

DESCRIPTION
   fpm(1) is a package manager that helps you create Fortran projects
   from source -- it automatically determines dependencies!

   Most significantly fpm(1) lets you draw upon other fpm(1) packages
   in distributed git(1) repositories as if the packages were a basic
   part of your default programming environment, as well as letting
   you share your projects with others in a similar manner.

   All output goes into the directory "build/" which can generally be
   removed and rebuilt if required. Note that if external packages are
   being used you need network connectivity to rebuild from scratch.

SUBCOMMANDS
  Valid fpm(1) subcommands are:

  + build    Compile the packages into the "build/" directory.
  + new      Create a new Fortran package directory with sample files.
  + update   Update the project dependencies.
  + run      Run the local package binaries. Defaults to all binaries

Activity

  1. StefanJum commented on Sep 20, 2023

    @StefanJum
    Member

    Hi @chococandy63, can you please run file dynamic-apps/fpm/bin/fpm? It looks like the file is not compiled as position independent. The elfloader expects position independent executables (PIE), if the fpm default build does not compile it as PIE you might want to check the fpm installation process, maybe you can modify it, add some custom cflags etc.

  2. b1shtream commented on Sep 22, 2023

    @b1shtream
    ContributorAuthor
    [chococandy@fedora unikraft-devel]$ file dynamic-apps/fpm/bin/fpm
    
    dynamic-apps/fpm/bin/fpm: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=62a1041e62b171ae141f05f8124a01f4322de152, for GNU/Linux 3.2.0, with debug_info, not stripped
    
    

    @StefanJum It is not PIE , I will check the fpm installation process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions