Artificial intelligent assistant

In the LD flags of a makefile, is it better to give the dir with platform-specific libs priority over /usr/lib? The makefile of my solution (for Raspbian Buster) contains an `LDFLAGS` definition like this: LDFLAGS=-L/usr/lib -L/usr/lib/arm-linux-gnueabihf …so that the standard libdir is given priority over the platform-specific one. Unfortunately, I ran into some trouble with one of the libs in `/usr/lib`, which was impossible to link against because of an outdated C++ ABI. When I swapped the dirs, however, everything worked fine: LDFLAGS=-L/usr/lib/arm-linux-gnueabihf -L/usr/lib Is it generally preferable to state platform-dependent libdirs before the universal `/usr/lib`? Thank you. **UPDATE:** The corresponding recipe is fairly standard and reads as follows: $(EXEC) : $(OBJECTS) $(CC) $(CFLAGS) $(OBJECTS) -o $(EXEC) $(LDFLAGS) $(LIBRARIES) $(OBJECTS) : $(SRC) $(CC) $(CFLAGS) -c $(SRC)

Using `LDFLAGS` is a last resort helper. If you use it in your makefiles, this is a good method to make your software non-portable.

Better write Makefiles that directly use the needed `ld` command line.

You could e.g. use command lines like:


$(CC) $(CFLAGS) $(OBJECTS) -o $@ $(LDPATH:%=-L%) $(LIBRARIES)


and put the list of search directories for the library search into `LDPATH`.

Note that the pattern matching macro expansions as used for `LDPATH` are not part of the POSIX `make` spec, but this feature has been introduced by SunPro Make in 1986 and copied by many make implementations, e.h. `smake`, `gnu make`. If you have a older `make`, you need to manually use a `-Lpath` entry for each library search dir intim the command line.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 8bdccd33d618194d980b02b43eaeb974