Bug 11451

Summary: Can't find libmpfr.so.4 when using external toolchain on ubuntu 18.04/18.10
Product: buildroot Reporter: galen <lgnice>
Component: OtherAssignee: unassigned
Status: RESOLVED WONTFIX    
Severity: critical CC: buildroot, lgnice
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:
Attachments: libzlib configure error
add LD_LIBRARY_PATH

Description galen 2018-10-30 06:37:28 UTC
Created attachment 7836 [details]
libzlib configure error

When I upgraded ubuntu from 16.04 to 18.04, output/build/libzlib-1.2.11 will have a compilation error, because I used the toolchain provided by the bsp vendor.

The reason is: ubuntu 18.04/18.10 removed
Libgmpv4-dev - Multiprecision arithmetic library developers tools (GCC 4.x compatible)

Only reserved: libmpfr6 - multiple precision floating-point computation

However, I found that all toolchains provide libmpfr.so by themselves:

/opt/Vatics/vtcs_toolchain/arm-eabi-uclibc/usr/lib/libmpfr.so
/opt/ralink/arm-buildroot-gcc463-for-ibox/usr/lib/libmpfr.so
/opt/ralink/buildroot-gcc463/usr/lib/libmpfr.so
/opt/mtk_mipsel_gcc-4.6.3_uclibc-0.9.33/usr/lib/libmpfr.so
/opt/GrainMedia/gm813x/toolchain_gnueabi-4.4.0_ARMv5TE/usr/lib/libmpfr.so
/opt/mipsel-24kec-linux-uclibc-4.9-2017.07/usr/lib/libmpfr.so
/opt/960A/buildroot-gcc463/usr/lib/libmpfr.so

 Just set the environment variable LD_LIBRARY_PATH to solve it.

Export LD_LIBRARY_PATH=/opt/mipsel-24kec-linux-uclibc-4.9-2017.07/usr/lib:$LD_LIBRARY_PATH


but, once LD_LIBRARY_PATH is set, an error will be reported in buildroot:

You seem to have the current working directory in your
LD_LIBRARY_PATH environment variable. This doesn't work.
Make: *** [support/dependencies/dependencies.mk:25: core-dependencies] Error 1


How to solve it?
Comment 1 galen 2018-10-30 07:05:07 UTC
Created attachment 7841 [details]
add LD_LIBRARY_PATH
Comment 2 Thomas Petazzoni 2018-10-30 08:36:58 UTC
If the programs in your external toolchain use libmpfr.so, but it is not provided by the external toolchain, then the external toolchain is broken.

Your patch causes two problems:

 (1) libmpfr.so is not guaranteed to be installed $(HOST_DIR)/lib. Buildroot only builds/installs host-mpfr if needed, and a typical configuration that uses an external toolchain will not build/install host-mpfr.

 (2) Passing LD_LIBRARY_PATH pointing to some host libraries will very likely confuse the cross-compilation of some packages. We tried a while ago to use LD_LIBRARY_PATH, and it was a total failure.

So, here, you really need to fix the external toolchain itself.