[openwrt/openwrt] libreadlne: create symlinks for .so

LEDE Commits lede-commits at lists.infradead.org
Sat Nov 16 08:20:27 PST 2024


ansuel pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/0000ba6ab8062f965d8fed240b76d36f9a493b55

commit 0000ba6ab8062f965d8fed240b76d36f9a493b55
Author: Jeronimo Pellegrini <j_p at aleph0.info>
AuthorDate: Sat Sep 21 15:46:36 2024 -0300

    libreadlne: create symlinks for .so
    
    Currently, libreadline only installs
    
    ```
     /usr/lib/libhistory.so.8 -> libhistory.so.8.2
     /usr/lib/libhistory.so.8.2
     /usr/lib/libreadline.so.8 -> libreadline.so.8.2
     /usr/lib/libreadline.so.8.2
    ```
    
    But there is no `libreadline.so` or `libhistory.so` available.
    
    So this happens:
    
    ```
    root at OpenWRT:~# cat a.c
    int main() {
    }
    root at OpenWRT:~# gcc a.c -lreadline
    /usr/bin/ld: cannot find -lreadline: No such file or directory
    collect2: error: ld returned 1 exit status
    ```
    
    Unless, of course, one uses `-l:libreadline.so.8`... But that
    doesn't help with binaries that try to dynamically open
    
    `libreadline.so`. I have one of those here (the STklos Scheme
    compiler -- I didn't make a PR for it because it's far from
    being ready, but one issue is that it does use dlopen to use
    readline...)
    
    With the symlink, it works:
    
    ```
    root at OpenWRT:~# ln -s /usr/lib/libreadline.so.8 /usr/lib/libreadline.so
    root at OpenWRT:~#
    root at OpenWRT:~# gcc a.c -lreadline
    root at OpenWRT:~#
    ```
    
    Another example: when trying to package rlwrap, the build failed
    complaining it could not find readline (using `-lreadline`).
    It would then be necessary to change rlwrap's `configure.ac`
    (and also in all packages that use readline), but it seems
    simpler to add the symlinks...
    
    This PR changes the Makefile so it will include the links.
    
    Signed-off-by: Jeronimo Pellegrini <j_p at aleph0.info>
    Link: https://github.com/openwrt/openwrt/pull/16445
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 package/libs/readline/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/libs/readline/Makefile b/package/libs/readline/Makefile
index 11b9e0172f..03e56f36ed 100644
--- a/package/libs/readline/Makefile
+++ b/package/libs/readline/Makefile
@@ -69,7 +69,7 @@ endef
 
 define Package/libreadline/install
 	$(INSTALL_DIR) $(1)/usr/lib
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{history,readline}.so.* $(1)/usr/lib/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{history,readline}.so* $(1)/usr/lib/
 endef
 
 $(eval $(call HostBuild))




More information about the lede-commits mailing list