Check out example codes for "linker command failed with exit code 1 ruby". It will help you in understanding the concepts better.
Code Example 1
$ bundle config --local build.mysql2 "--with-cppflags=-I/usr/local/opt/openssl/include"
$ bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib"
Code Example 2
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
Learn ReactJs, React Native from akashmittal.com