libjpeg installed and linked but not found when install other libraries

I am using Mac OSX 10.14 The error message I got when installing HDF4 library (https://portal.hdfgroup.org/display/support/HDF+4.2.14#files) is

ld: library not found for -ljpeg

I have tried:

brew update brew install libjpeg brew unlink libjpeg brew link libjpeg

also tried: xcode-select --install

also tried: git clone https://github.com/LuaDist/libjpeg.git ./configure make make instal...

All of the above are successful, but I still cannot get rid of the same error message when installing other libs that requires libjpeg (ld: library not found for -ljpeg).