LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 5018 - ffi/oprofile checked for even when explicitly disabled
Summary: ffi/oprofile checked for even when explicitly disabled
Status: RESOLVED FIXED
Alias: None
Product: Build scripts
Classification: Unclassified
Component: autoconf (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Jeffrey Yasskin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-21 08:07 PDT by Török Edwin
Modified: 2010-02-09 17:05 PST (History)
6 users (show)

See Also:
Fixed By Commit(s):


Attachments
Possible fix for the oprofile part of this bug (11.64 KB, patch)
2009-10-06 14:00 PDT, Jeffrey Yasskin
Details
Fix for oprofile part, now checking bfd in the right order (11.72 KB, patch)
2009-10-06 16:05 PDT, Jeffrey Yasskin
Details
Patch to make --disable-libffi work and adjust the default (4.29 KB, patch)
2010-02-09 16:30 PST, Jeffrey Yasskin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Török Edwin 2009-09-21 08:07:21 PDT
./configure --enable-ffi=no --enable-oprofile=no still checks for ffi and oprofile
and adds it to LIBS.

The problem is here in configure.ac:
dnl --enable-libffi : check whether the user wants to turn off libffi:
AC_ARG_ENABLE(libffi,AS_HELP_STRING(
  --enable-libffi,[Check for the presence of libffi (default is YES)]),,
  enableval=yes)
case "$enableval" in
  yes) llvm_cv_enable_libffi="yes" ;;
  no)  llvm_cv_enable_libffi="no"  ;;
  *) AC_MSG_ERROR([Invalid setting for --enable-libffi. Use "yes" or "no"]) ;;
esac

enableval should be tested inside AC_ARG_ENABLE, otherwise it contains something else:
+ eval 'enable_ffi=$ac_optarg'
++ enable_ffi=no
...
+ case "$withval" in
+ with_ocaml_libdir=auto
+ test '' = set
+ withval=default
+ case "$withval" in
+ WITH_BINUTILS_INCDIR=default
+ test xdefault '!=' xdefault
+ test '' = set
+ enableval=yes
+ case "$enableval" in
+ llvm_cv_enable_libffi=yes
Comment 1 Török Edwin 2009-10-06 11:06:18 PDT
Also since Debian's libopagent.so doesn't link against bfd it fails to be found:

configure:28860: gcc -o conftest -g -O2   conftest.c -lopagent  -lpthread -lffi -ldl -lm  -L/usr/lib/oprofile -Wl,-rpath,/usr/lib/oprofile
 >&5
/usr/lib/oprofile/libopagent.so: undefined reference to `bfd_check_format'
/usr/lib/oprofile/libopagent.so: undefined reference to `bfd_init'
/usr/lib/oprofile/libopagent.so: undefined reference to `bfd_openr'
/usr/lib/oprofile/libopagent.so: undefined reference to `bfd_perror'
/usr/lib/oprofile/libopagent.so: undefined reference to `bfd_get_mach'
/usr/lib/oprofile/libopagent.so: undefined reference to `bfd_get_arch'

If I configure --with-oprofile I get an error that libopagent needs to be around.

Here is relevant part from /usr/lib/oprofile/libopagent.la:
# Libraries that this one depends upon.
dependency_libs=' -liberty -ldl'

And dependencies:
ldd /usr/lib/oprofile/libopagent.so
        linux-vdso.so.1 =>  (0x00007fff00767000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007f83f4a9f000)
        libc.so.6 => /lib/libc.so.6 (0x00007f83f474e000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003410e00000)
Comment 2 Jeffrey Yasskin 2009-10-06 14:00:22 PDT
Created attachment 3615 [details]
Possible fix for the oprofile part of this bug

This patch makes --without-oprofile work, makes that the default instead of searching for oprofile, and tries to work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537744 by searching for libbfd after pulling in libopagent. Edwin, could you check that this fixes things on your system?
Comment 3 Jeffrey Yasskin 2009-10-06 16:05:42 PDT
Created attachment 3617 [details]
Fix for oprofile part, now checking bfd in the right order

Here's a new patch for testing.
Comment 4 Jeffrey Yasskin 2009-10-07 18:26:59 PDT
I've committed the OProfile part in r83503. Edwin, do you want to get the ffi part?
Comment 5 Chris Lattner 2010-02-09 00:08:24 PST
anyone willing to finish this off?
Comment 6 Jeffrey Yasskin 2010-02-09 16:30:51 PST
Created attachment 4208 [details]
Patch to make --disable-libffi work and adjust the default

Here's a patch that makes --disable-libffi work. It also changes the default to not using libffi to match libopagent. I remember Duncan wanting that change, but Nick suggests defaulting to "'on if detected'. that's pretty standard for most software". So I'm waiting for them to agree before committing.
Comment 7 Eric Christopher 2010-02-09 16:51:48 PST
Yeah, that's fine. Go ahead and commit.
Comment 8 Jeffrey Yasskin 2010-02-09 17:05:46 PST
Fixed in r95712.  I'm happy to change the defaults to pay attention to what's installed if Nick convinces people that's the right behavior.