smbk5pwd is the strangest failure, since there are no #includes preceding portable.h and slap.h to interfere. My guess is RHEL[34] need a compilation flag like -pthread to enable threading. If you can still test this, check against which options OpenLDAP uses when compiling an overlay in slapd/overlays/.
If that's not it, run the gcc compile command but replace '-c (-o foo.o)' with '-E -dD -o foo.i' This puts the preprocessor output plus macro definitions in foo.i, which should ease comparing with the /usr/include/ files and see why the pthread_rwlock_t def is excluded.