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

Make packaging of cartesi machine easier #120

Open
19 of 21 tasks
edubart opened this issue Aug 17, 2023 · 1 comment
Open
19 of 21 tasks

Make packaging of cartesi machine easier #120

edubart opened this issue Aug 17, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@edubart
Copy link
Contributor

edubart commented Aug 17, 2023

Context

Currently we provide Debian package for the emulator, but it would also be nice to make easier to package the Cartesi Machine for any Linux distributions and even other operating systems. In this issue I listed suggestions and changes to improve this after packaging it for ArchLinux (see its build script in https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=cartesi-machine).

Suggested enhancements

  • Remove the need of make dep step (bundle mongoose in source tree).
    NOTE: Not possible because of license issues.
  • Remove the need of patchelf.
    The tool patchelf hard code library paths when installing, this makes moving a package installed in one PREFIX to another impossible. Also patchelf is also not a common tool available, and somewhat hacky, it's responsibility of the packager to decide to use -rpath flags when linking, we should not enforce using -rpath. And when we think about operating systems that does not even use ELF, it doesn't make sense.
  • Command make DESTDIR=pkg is not working.
    Workaround is to use make DESTDIR="$(pwd)/pkg", but it's common for a packager to use the shorthand version to "debug" the package.
  • Command make -j4 install-strip is not working.
    It's common to use make with multiple threads when packaging, sometimes this is even done under the hood automatically, it should work.
  • Bundle keccak hash implementation and remove cryptopp.
    Cryptopp is a huge library and a burden to compile to WebAssembly or other systems. This will also make packaging cartesi machine easier, that is, one less package for the packager to deal with. We only use it for one hash function.
  • Bundle nlohmann-json.
    This is a header-only library and it's not available in all systems, we could just copy its header and bundle it. This will also make packaging cartesi machine easier, that is, one less package for the packager to deal with.
  • Bundle lua-dkjson lua sources.
    We don't want to enforce the packager to install LuaRocks or lua packages himself, LuaRocks is notoriously problematic to install and unsupported in some operating systems.
  • Remove the need of protobuf, replace with something using JSON.
  • Remove the need of grpc and protobuf to compile libcartesi
  • Don't use shasum command when compiling.
    This package is provided by perl, and requiring perl to compile is unnecessary.
  • Remove use of __FILE__ define from sources.
    Because this is generating warnings by some package managers due to references to building source directory, mongoose is using this but there is a option to disable it.
  • Fix warning about cartesi::require() in uarch-solidity-compat.h when compiling in release.
  • Some tests are being compiled despite no being installed.
    Like machine-c-tests and other binaries used only for testing, this increases the build time when packaging and also give us the burden to maintain test-only files build-able and workable in many systems.
  • Move emulator-defines inside emulator repository.
    By having these outside the packager has to keep downloading them by hand and move files around.
  • Add make install-headers.
    This is in case the packager don't want to install development headers.
  • Add a way to build static library libcartesi.a.
    This will allow building contained Linux apps that use the cartesi machine emulator and facilitate WebAssembly use.
  • Remove the need of installing uarch-ram.bin (embed inside libcartesi.so)
  • Remove the need of downloading and installing ROM.
  • See the possibility of not needing boost to build (low priority).
    We already removed many boost dependencies, we might not even need boost.
  • Remove the "proxy" scripts to run cartesi-machine and its tools.
    Now that we are installing the emulator in standard OS paths, we may not need to have a Lua script just to append cartesi Lua paths. It's responsibly of the packager to sort out this, and most of the time he will have to do nothing because cartesi libraries will be available in standard Lua paths.
  • Environment variable CARTESI_IMAGES_PATH should not be mandatory.
    The cartesi machine must try to auto detect where its images are in case CARTESI_IMAGES_PATH is unset.
    This will alleviate the burden of the packager to have it properly set in /etc/profile. This will also give room for an user to override it, currently we can't override because it is hard-coded in the "proxy" scripts.
@edubart edubart added the enhancement New feature or request label Aug 17, 2023
@edubart edubart self-assigned this Aug 17, 2023
@mpolitzer
Copy link
Contributor

We can use this option: -Wl,-rpath,'$ORIGIN/../lib to make the executable find the libraries it uses.
As a way to eliminate the patchelf.

@edubart edubart moved this from Todo to In Progress in Machine Emulator SDK Aug 25, 2023
@edubart edubart moved this from In Progress to Todo in Machine Emulator SDK Oct 7, 2023
@edubart edubart moved this from Todo to In Progress in Machine Emulator SDK Feb 6, 2024
@edubart edubart moved this from In Progress to Todo in Machine Emulator SDK Feb 6, 2024
@edubart edubart mentioned this issue Feb 8, 2024
@edubart edubart moved this from Todo to In Progress in Machine Emulator SDK Feb 15, 2024
@edubart edubart moved this from In Progress to On Hold in Machine Emulator SDK Mar 12, 2024
@edubart edubart moved this from On Hold to Todo in Machine Emulator SDK May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants