Skip to content

(Need help) Feature: add duperemove package - #31

Closed
kayhadrin wants to merge 2 commits into
Entware:masterfrom
kayhadrin:feature/add-duperemove-package
Closed

kayhadrin wants to merge 2 commits into
Entware:masterfrom
kayhadrin:feature/add-duperemove-package

Conversation

@kayhadrin

@kayhadrin kayhadrin commented May 5, 2025 •

Copy link
Copy Markdown

First of all, I'm not a C/C++ developer and my knowledge of GCC + Makefile is very rudimentary so apologies for this incomplete PR.
I tried to port an incoming new OpenWRT package named duperemove submitted by @ktgeek and wanted to give it a fair go but it's taking more time than I can affort to so I'll just share my code experiments here.
If anyone qualified wants to pick it up, please be my guest! 😅

What I've done:

  1. Created a docker container based on the wiki docs: https://github.com/Entware/docker/blob/main/README.md
  2. Customized the docker image since the original Dockerfile hadn't changed in a while.
  3. Cloned the entware git repo
  4. Copied configs/x64-3.2.config to .config
  5. Ran make package/symlinks
  6. It seems that the new package I made in /home/me/Entware/feeds/rtndev/duperemove didn't get picked up, so I made a symlink myself to package/feeds/rtndev/duperemove
  7. Compiling duperemove fails due to missing btrfs.h file. So I tried adding CONFIG_KERNEL_BTRFS_FS=y to the .config, rebuild the toolchain, but it didn't fix it. I then decided to add an include of -I/usr/include to CFLAGS in the package Makefile.
  8. Compiling duperemove with the default Makefile from https://github.com/openwrt/packages/pull/26206/commits failed. I believe it's related to the introduction of [[maybe_unused]] attributes and other syntax errors.
  9. Customized the .config file to use GCC 12 since the default GCC 8.4 didn't support some code syntax from duperemove.
  10. Enabled CONFIG_BINUTILS_USE_VERSION_2_34=y since the Entware toolchain wouldn't build with GCC 12 + glibc v2.27
  11. Finally managed to rebuild the toolchain.
    Make command:
make dirclean && \
make -j$(nproc) tools/install && \
make -j$(nproc) toolchain/install && \
make -j$(nproc) target/compile && \
make -j1 V=sc package/feeds/rtndev/duperemove/compile |& tee out.txt
  1. Compiling duperemove still fails during the linking phase due to the linker not finding some shared libraries like libiconv or libintl
  2. Customized the duperemove/Makefile to expose more include file paths
  3. Managed to compile duperemove but now it doesn't seem to run properly.
~/Entware/build_dir/target-x86_64_glibc-2.33/duperemove-0.15.1$ ./duperemove 
bash: ./duperemove: No such file or directory

~/Entware/build_dir/target-x86_64_glibc-2.33/duperemove-0.15.1$ cd $(pwd) && readelf -d duperemove

Dynamic section at offset 0x1adf0 contains 27 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libsqlite3.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libblkid.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libmount.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libuuid.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [/opt/lib:/../target-x86_64_glibc-2.33/opt/lib/libiconv-full/lib]
 0x000000000000000c (INIT)               0x403000
 0x000000000000000d (FINI)               0x413824
 0x0000000000000004 (HASH)               0x4003b0
 0x000000006ffffef5 (GNU_HASH)           0x400728
 0x0000000000000005 (STRTAB)             0x4012d8
 0x0000000000000006 (SYMTAB)             0x400768
 0x000000000000000a (STRSZ)              1612 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x41c000
 0x0000000000000002 (PLTRELSZ)           2736 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x401bc0
 0x0000000000000007 (RELA)               0x401b18
 0x0000000000000008 (RELASZ)             168 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x401a18
 0x000000006fffffff (VERNEEDNUM)         4
 0x000000006ffffff0 (VERSYM)             0x401924
 0x0000000000000000 (NULL)               0x0

I also tried running duperemove after installing the generated duperemove_0.15.1-1_x64-3.2.ipk package manually on my NAS but the same error appeared.

At this stage, I've spent two days on this but I'm unfortunately forced to let go due to other priorities. 🥲

See this gist for more info:

Compile tested: intended for x86_64
Run tested: n/a

@ryzhovau

Copy link
Copy Markdown
Member

This package uses ioctl_fideduperange which was added to the kernel in 4.5 version.
We've got too old toolchain for that.

@ryzhovau ryzhovau closed this May 21, 2025
@ryzhovau ryzhovau added the wontfix This will not be worked on label May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wontfix This will not be worked on

Development

Successfully merging this pull request may close these issues.

2 participants