Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak pkg-config setup to work with Autotools-based project #59

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ilumsden
Copy link
Contributor

Resolves #50

This PR tweaks the pkg-config stuff for PerfFlow Aspect to allow an Autotools-based project (i.e., DYAD) to correctly load the C/C++ interface for PerfFlow. In particular, this PR does the following:

  • Adds a static version of libperfflow_parser.so to the build. Note that this static library is not installed
  • Tweaks the build of WeavePass to use this static library (resolves linking/lookup issues when using the Clang plugin)
  • Removes WeavePass from the Libs entry of perfflowaspect.pc
  • Adds -lssl and -lcrypto to the Libs entry of perfflowaspect.pc to prevent undefined symbol errors on SHA1
  • Removes the content of the Cflags entry of perfflowaspect.pc
  • Adds a new weavepass entry to perfflowaspect.pc. This entry's value is the path to libWeavePass.so

Additionally, in DYAD, I created the following m4 macro to actually load all the info from pkg-config into the Autotools-based build system:

AC_DEFUN([AX_PERFFLOW_ASPECT], [
    PKG_CHECK_MODULES([$1], [perfflowaspect],
        [
            $1_WEAVEPASS=`pkg-config --variable=weavepass perfflowaspect`
            if test ! -e "${$1_WEAVEPASS}"; then
                AC_MSG_ERROR([Cannot find libWeavePass.so!])
            fi
            $1_PLUGIN_CPPFLAGS="-Xclang -load -Xclang ${$1_WEAVEPASS} -fPIC"
            AC_MSG_NOTICE([Flags are ${$1_PLUGIN_CPPFLAGS}])
            AC_SUBST($1_WEAVEPASS)
            AC_SUBST($1_PLUGIN_CPPFLAGS)
            $2
        ],
        [
            $3
        ]
    )
])

In DYAD, this is put into config/ax_perfflow_aspect.m4. This file is not included in this PR, but I can include it if desired.

slabasan
slabasan previously approved these changes Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot compile application that links with PerfFlow Aspect via pkg-config
2 participants