While I think that @Janyee gave the correct answer and should get credited, maybe this helps others that ran into a similar issue of library linking errors, too.
Compiling rsync 3.2.4 (the same happens for rsync 3.2.3) on macOS 10.12.x Sierra with manual installed external libraries xxHash, zstd, lz4, openssl, popt, zlib in non standard folders gave the following error on make, even though ./configure reported rsync 3.2.4 configuration successful:
$ make
awk -f ./daemon-parm.awk ./daemon-parm.txt
awk -f ./mkproto.awk ./*.c ./lib/compat.c daemon-parm.h
In file included from ./rounding.c:20:
./rsync.h:643:3: error: Could not find a 32-bit integer variable
# error Could not find a 32-bit integer variable
^
./rsync.h:712:2: error: unknown type name 'int32'
int32 size, entries;
^
./rsync.h:713:8: error: expected ';' at end of declaration list
uint32 node_size;
^
;
./rsync.h:719:2: error: unknown type name 'int32'
int32 key;
^
./rsync.h:803:3: error: Character pointers are not 4 or 8 bytes.
# error Character pointers are not 4 or 8 bytes.
^
./rsync.h:816:2: error: unknown type name 'int32'
int32 num;
^
./rsync.h:817:8: error: expected ';' at end of declaration list
uint32 unum;
^
;
./rsync.h:833:8: error: expected ';' at end of declaration list
uint32 len32; /* Lowest 32 bits of the file's length */
^
;
./rsync.h:992:2: error: unknown type name 'int32'
int32 len; /**< length of chunk of file */
^
./rsync.h:993:8: error: expected ';' at end of declaration list
uint32 sum1; /**< simple checksum */
^
;
./rsync.h:994:2: error: unknown type name 'int32'
int32 chain; /**< next hash-table collision */
^
./rsync.h:1002:2: error: unknown type name 'int32'
int32 count; /**< how many chunks */
^
./rsync.h:1003:2: error: unknown type name 'int32'
int32 blength; /**< block_length */
^
./rsync.h:1004:2: error: unknown type name 'int32'
int32 remainder; /**< flength % block_length */
^
./rsync.h:1013:2: error: unknown type name 'int32'
int32 p_size; /* Largest window size we allocated */
^
./rsync.h:1014:2: error: unknown type name 'int32'
int32 p_len; /* Latest (rounded) window size */
^
./rsync.h:1015:2: error: unknown type name 'int32'
int32 def_window_size; /* Default window size */
^
./rsync.h:1051:8: error: expected ';' at end of declaration list
uint32 rflags;
^
;
In file included from ./rounding.c:20:
In file included from ./rsync.h:1148:
./byteorder.h:75:8: error: 'inline' can only appear on functions
static inline uint32
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Failed to create rounding.h!
make: *** [rounding.h] Error
Compiling without extra libs worked:
$ ./configure --prefix=/NonStandardDir/rsync/rsync-3.2.4 --disable-openssl --disable-xxhash --disable-zstd --disable-lz4 --disable-roll-simd --disable-md2man
The config.log and the ./configure script output gave hints on missing libraries. Executing make generated files like ~/Library/Logs/DiagnosticReports/conftest_….crash. Those reports clearly that the library is searched in the wrong standard place: Library not loaded: /usr/local/lib/liblz4.1.dylib
That the dynamic libraries liblz4.1.9.3.dylib, libzstd.1.5.2.dylib and libxxhash.0.8.1.dylib were linked incorrectly could also be proofed by:
$ otool -L /NonStandardFolder/lz4/lz4-1.9.3/usr/local/lib/liblz4.1.9.3.dylib
# -> Output: … /usr/local/lib/liblz4.1.dylib (compatibility version 1.0.0, current version 1.9.3)…
As popt, openssl and zlib weren't affected, because --prefix was set in the ./configure command, the solution is to recompile the incorrectly linked libs with the right prefix for the destination:
$ export PREFIX="/NonStandardFolder/lz4/lz4-1.9.3" && make && make install
The mistake was to set DESTDIR instead of PREFIX while executing the make command.
Check the dynamic library again and it should be correctly linked:
$ otool -L /NonStandardFolder/lz4/lz4-1.9.3/lib/liblz4.1.9.3.dylib
# -> Output: … /NonStandardFolder/lz4/lz4-1.9.3/lib/liblz4.1.dylib (compatibility version 1.0.0, current version 1.9.3)…
After recompiling the libs lz4, xxHash, zstd, something like the following (adapt to your folder structure) should work to compile rsync:
$ cd /SourcecodeFolder/rsync/rsync-3.2.4
$ make clean
$ ./configure --prefix=/NonStandardDir/rsync/rsync-3.2.4 --disable-debug --disable-md2man --with-rsyncd-conf=/NonStandardDir/rsync/rsync-3.2.4/configuration/rsyncd.conf --with-included-popt=no --with-included-zlib=no --enable-ipv6 --disable-roll-simd CPPFLAGS="-I/NonStandardDir/openssl/openssl-1.1.1n/include -I/NonStandardDir/lz4/lz4-1.9.3/usr/local/include -I/NonStandardDir/zstd/zstd-1.5.2/include -I/NonStandardDir/xxHash/xxHash-0.8.1/include -I/NonStandardDir/popt/popt-1.18/include -I/NonStandardDir/zlib/zlib-1.2.11/include" LDFLAGS="-L/NonStandardDir/openssl/openssl-1.1.1n/lib -L/NonStandardDir/lz4/lz4-1.9.3/lib -L/NonStandardDir/zstd/zstd-1.5.2/lib -L/NonStandardDir/xxHash/xxHash-0.8.1/lib -L/NonStandardDir/popt/popt-1.18/lib -L/NonStandardDir/zlib/zlib-1.2.11/lib"
$ make
$ make test
$ make install