profile: add logging on failure

Add logging to report any failures that may occur on calls to libdl.  Without
this, it is difficult to identify the actual problem if the test fails.
profile: adjust flags for libdl

dlopen expects that the flags contains RTLD_LAZY or RTLD_NOW.  RTLD_LAZY will
resolve the symbol on first use, and is generally preferred due to efficiency.
Add this to fix the test failure on the build bots.