Hi,
Could you please suggest me on how can I use readline lib (tab auto complete) functions when building code with gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf for iMX7d?
arm-linux-gnueabihf-gcc -o test main.c -l readline
/usr/lib/gcc-cross/arm-linux-gnueabihf/7/…/…/…/…/arm-linux-gnueabihf/bin/ld: cannot find -lreadline
collect2: error: ld returned 1 exit status
gcc -o test main.c -l readline
NO ERROR
Thank you
Neeraj
Greetings,
There are a lot of unknowns for us here. Are you including the readline library in your C code properly? Do you have the readline development libraries installed on your development PC? Or maybe your readline libraries are installed in a non-standard location and need to be specified to the compiler.
Perhaps try compiling a simple readline example program to eliminate any complexity initially. For example the example in this forum: c - using readline() for completion - Stack Overflow
Unfortunately as of now it’s hard to tell what went wrong from the information given.
Best Regards,
Jeremias
Hi @jeremias.tx ,
If you see my message again… you will find that I shared below info already:
- When I compile it using gcc main.c (which has readline test code) in my PC it works
- When I do cross compilation for arm I see this issue.
Thank you
Neeraj
In that case it would appear then that the toolchain you are using for cross-compilation doesn’t have readline library/support. Can you check the toolchain libraries/header files if there’s anything readline related at all?
If not you’ll most likely need to create a new toolchain/sdk with Yocto that has support for readline.
Best Regards,
Jeremias
Hi @jeremias.tx
Thanks for understanding.
Could you please point me some link where I can get the arm toolchain for imx7d which supports readline?
Thank you
Neeraj
Well first you’ll need to setup a Yocto build that matches the version of our BSP you are working on as detailed here: Build a Reference Image with Yocto Project/OpenEmbedded | Toradex Developer Center
Then you need to modify the image to add readline support to the image I believe there’s a generic readline recipe in the standard openembedded-core meta-layer. Once you’ve done this you can then build an sdk as detailed here: Linux SDKs | Toradex Developer Center
If everything went correctly then this SDK should have all the libraries and header files corresponding to whatever packages were built into the image. Which if the readline package was added correctly would mean a toolchain that has readline libraries and header files.
Best Regards,
Jeremias
@jeremias.tx
Thank you for details, let me work and update you.
Perfect. We will wait for your results.