Date: Tue, 30 Jun 2015 15:19:56 +0200 From: Hans Ottevanger <hans@beastielabs.net> To: Marcin Cieslak <saper@saper.info> Cc: freebsd-hackers@freebsd.org Subject: Re: Build for profiling? Got //usr/lib/libc_p.a(sbrk.po): undefined reference to symbol '_end' Message-ID: <5592977C.2030304@beastielabs.net> In-Reply-To: <alpine.BSF.2.11.1506300812150.7491@z.fncre.vasb> References: <alpine.BSF.2.11.1506300812150.7491@z.fncre.vasb>
next in thread | previous in thread | raw e-mail | index | archive | help
On 06/30/15 10:19, Marcin Cieslak wrote: > I am trying to compile https://github.com/sass/libsass instrumented > for profiling. As far as I understand this does not work with clang, > so I am trying with gcc version 4.8.5 20150212 (prerelease) > (FreeBSD Ports Collection). > Profiling with -pg was added to clang a few years ago by Roman Divacky, with a bit of my help. It is not (yet) documented AFAIK and don't know about the situation upstream. See also the mailing list thread starting here: https://lists.freebsd.org/pipermail/freebsd-toolchain/2011-January/000075.html > This is a shared library in C++ that gets loaded by node (www/node). > > I have a world built with profiling libraries, I have additionally > ran "make install INSTALL_PIC_ARCHIVE=yes" in lib/libc, lib/msun > and lib/libcxxrt directories (the latter probably not needed). > > Here's config.log output: > > configure:3344: checking whether the C++ compiler works > configure:3366: g++48 -pg -g conftest.cpp >&5 > /usr/local/bin/ld: //usr/lib/libc_p.a(sbrk.po): undefined reference to symbol '_end' > //lib/libc.so.7: error adding symbols: DSO missing from command line > collect2: error: ld returned 1 exit status > configure:3370: $? = 1 > configure:3408: result: no > configure: failed program was: > | /* confdefs.h */ > | #define PACKAGE_NAME "libsass" > | #define PACKAGE_TARNAME "libsass" > | #define PACKAGE_VERSION "3.2.5-9-gbe07-dirty" > | #define PACKAGE_STRING "libsass 3.2.5-9-gbe07-dirty" > | #define PACKAGE_BUGREPORT "support@moovweb.com" > | #define PACKAGE_URL "" > | #define PACKAGE "libsass" > | #define VERSION "3.2.5-9-gbe07-dirty" > | /* end confdefs.h. */ > | > | int > | main () > | { > | > | ; > | return 0; > | } > Maybe adding an extra -lc_p helps. Keep in mind that time spent in libraries that are dynamically linked will not turn up in your profile. If I want profiling results from the standard libraries I explicitly link (statically, because they are .a archives) with the profiled libs, e.g. using -lc++_p -lm_p -lc_p (with clang). Kind regards, Hans Ottevanger Eindhoven, Netherlands www.beastielabs.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5592977C.2030304>