base on A small utility to modify the dynamic linker and RPATH of ELF executables # PatchELF PatchELF is a simple utility for modifying existing ELF executables and libraries. In particular, it can do the following: * Change the dynamic loader ("ELF interpreter") of executables: ```console $ patchelf --set-interpreter /lib/my-ld-linux.so.2 my-program ``` * Change the `RPATH` of executables and libraries: ```console $ patchelf --set-rpath /opt/my-libs/lib:/other-libs my-program ``` * Shrink the `RPATH` of executables and libraries: ```console $ patchelf --shrink-rpath my-program ``` This removes from the `RPATH` all directories that do not contain a library referenced by `DT_NEEDED` fields of the executable or library. For instance, if an executable references one library `libfoo.so`, has an RPATH `/lib:/usr/lib:/foo/lib`, and `libfoo.so` can only be found in `/foo/lib`, then the new `RPATH` will be `/foo/lib`. In addition, the `--allowed-rpath-prefixes` option can be used for further rpath tuning. For instance, if an executable has an `RPATH` `/tmp/build-foo/.libs:/foo/lib`, it is probably desirable to keep the `/foo/lib` reference instead of the `/tmp` entry. To accomplish that, use: ```console $ patchelf --shrink-rpath --allowed-rpath-prefixes /usr/lib:/foo/lib my-program ``` * Remove declared dependencies on dynamic libraries (`DT_NEEDED` entries): ```console $ patchelf --remove-needed libfoo.so.1 my-program ``` This option can be given multiple times. * Add a declared dependency on a dynamic library (`DT_NEEDED`): ```console $ patchelf --add-needed libfoo.so.1 my-program ``` This option can be give multiple times. * Replace a declared dependency on a dynamic library with another one (`DT_NEEDED`): ```console $ patchelf --replace-needed liboriginal.so.1 libreplacement.so.1 my-program ``` This option can be give multiple times. * Change `SONAME` of a dynamic library: ```console $ patchelf --set-soname libnewname.so.3.4.5 path/to/libmylibrary.so.1.2.3 ``` ## Compiling and Testing ### Via [GNU Autotools](https://www.gnu.org/software/automake/manual/html_node/Autotools-Introduction.html) ```console ./bootstrap.sh ./configure make make check sudo make install ``` ### Via [CMake](https://cmake.org/) (and [Ninja](https://ninja-build.org/)) ```console mkdir build cd build cmake .. -GNinja ninja all sudo ninja install ``` ### Via [Meson](https://mesonbuild.com/) (and [Ninja](https://ninja-build.org/)) ```console mkdir build meson configure build cd build ninja all sudo ninja install ``` ### Via Nix You can build with Nix in several ways. 1. Building via `nix build` will produce the result in `./result/bin/patchelf`. If you would like to build _patchelf_ with _musl_ try `nix build .#patchelf-musl` 2. You can launch a development environment with `nix develop` and follow the autotools steps above. If you would like to develop with _musl_ try `nix develop .#musl` ## Help and resources - Matrix: [#patchelf:nixos.org](https://matrix.to/#/#patchelf:nixos.org) ## Author Copyright 2004-2019 Eelco Dolstra <[email protected]>. ## License This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ", Assign "at most 3 tags" to the expected json: {"id":"4715","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"