0

I use Asus router (based on ARMv7 proc) with Advanced Tomato installed on it as my ARMv7 developer platform. I install compiler (gcc - 5.4.0-1) plus dependencies and libFTDI (libftdi1 - 1.3-1) from OpenWRT Linux repo. OpenWRT does not provide libftdi-dev so I copied ftdi.h file from libFTDI download page to /opt/include directly. I try to compile program taken directly from libFTDI samples. The compiler command is:

gcc -v -Wl,-rpath=/opt/usr/local/lib -Wl,--dynamic-linker=/opt/lib/ld-linux.so.3 -L/opt/lib -O2 -pipe -march=armv7-a -mtune=cortex-a9-fno-caller-saves -mfloat-abi=soft -l ftdi1 d.c -o d

But compilation fails because:

/opt/bin/ld: cannot find -lftdi1

But there is /opt/usr/local/lib/libftdi1.so linked to libftdi1.so.2

My LD_LIBRARY_PATH looks like this:

/lib:/usr/lib:/usr/local/lib:/opt/lib:/opt/usr/lib:/opt/include:/opt/usr/local/lib:/opt/usr/include

So what the problem is?

mackowiakp
  • 203
  • 1
  • 4
  • 12
  • If you're having to bodge /opt/usr/local/lib/ into the _runtime_ search paths, howcome you're not also passing it as a link-time search path? Really, you'd be a lot better off with a toolchain that's actually correctly configured for the environment you're running it in. – Notlikethat Oct 01 '16 at 20:02
  • Bah, wrong dupe target. Oh well, [take your pick, there's only ~2300](http://stackoverflow.com/search?q=ld+cannot+find+is%3Aq)... – Notlikethat Oct 01 '16 at 20:07
  • [This is probably the best one](http://stackoverflow.com/q/16710047/3156750) – Notlikethat Oct 01 '16 at 20:11

1 Answers1

0

I dont know why (probably bug) but for compiler taken from OpenWRT repo, MUST have wanted library in /opt/lib. So simply copy libftdi1.so.2.3.0 file and linking it to libftdi1.so resolved problem. That means that it does not use correctly LD_LIBRARY_PATH variable. Finally compilation command looks like this:

gcc -v -Wl,-rpath=/opt/usr/local/lib -Wl,--dynamic-linker=/opt/lib/ld-linux.so.3 -L/opt/lib -O2 -pipe -march=armv7-a -mtune=cortex-a9 -fno-caller-saves -mfloat-abi=soft -l ftdi1 arco.c -o arco

From my point of view - topic closed

mackowiakp
  • 203
  • 1
  • 4
  • 12