The error is generated by the following command:
gcc -shared -WI -soname,libaverage.so.1 -o libaverage.so.1.0.1 average.o
It is solved by replacing -soname with install_name, i.e.,
gcc -shared -WI -install_name,libaverage.so.1 -o libaverage.so.1.0.1 average.o
gcc -shared -WI -soname,libaverage.so.1 -o libaverage.so.1.0.1 average.o
It is solved by replacing -soname with install_name, i.e.,
gcc -shared -WI -install_name,libaverage.so.1 -o libaverage.so.1.0.1 average.o