I also have built gcc 7.3 from sources. My example program name is consolehost.
I've done following:
>ldd ./consolehost
./consolehost: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by ./consolehost)
./consolehost: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./consolehost)
linux-vdso.so.1 => (0x00007ffd79916000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f8458cfc000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f84589f4000)
libm.so.6 => /lib64/libm.so.6 (0x00007f84586f1000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f84584db000)
libc.so.6 => /lib64/libc.so.6 (0x00007f8458118000)
/lib64/ld-linux-x86-64.so.2 (0x0000556169234000)
Then I've investigated that:
>ls -ali /lib64/libstdc++.so.6
37631 lrwxrwxrwx. 1 root root 19 мар 17 06:38 /lib64/libstdc++.so.6 -> libstdc++.so.6.0.19
I've figured out that I need version that fresher that 6.0.19. So
>sudo find / -name "libstdc++.so.6*"
/usr/lib64/libstdc++.so.6
/usr/lib64/libstdc++.so.6.0.19
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.py
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyc
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyo
/usr/local/lib64/libstdc++.so.6.0.24
/usr/local/lib64/libstdc++.so.6
/usr/local/lib64/libstdc++.so.6.0.24-gdb.py
/home/declspec/gcc_build/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24
/home/declspec/gcc_build/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
/home/declspec/gcc_build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24
/home/declspec/gcc_build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
/home/declspec/gcc_build/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24
/home/declspec/gcc_build/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
In that moment I need to copy libstdc++.so.6.0.24 to /lib64/ and make new Symbolic link.
sudo mv /lib64/libstdc++.so.6 /lib64/libstdc++.so.6.orig
sudo ln -s /lib64/libstdc++.so.6.0.24 /lib64/libstdc++.so.6
That helps me. Hope that helps to you too. This link decribes GLIBCXX, but I did not understand how this works and what's a porpose (why versions is not enough)