diff mbox

PR other/55291: Add support for GCC multilib run-time libraries to libsanitizer

Message ID CAMe9rOqvss--W25YGP0MPiLn9kxh2jm-jdgTOonZM9sA8K1Z4Q@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu Nov. 14, 2012, 4:21 p.m. UTC
On Tue, Nov 13, 2012 at 3:48 PM, Paolo Bonzini <bonzini@gnu.org> wrote:
> Il 14/11/2012 00:43, H.J. Lu ha scritto:
>> This works.
>
> Ok, then please test remove install-sh and friends and do
> autoconf/automake again.  If it works, commit the result (I don't care
> if you make it one or two commits).
>
> Then, wait 24 hours for breakages and commit the multilib patch.
>
> Paolo

This is the multilib patch I will commit later.

Comments

Markus Trippelsdorf Nov. 15, 2012, 8:47 a.m. UTC | #1
On 2012.11.14 at 08:21 -0800, H.J. Lu wrote:
> On Tue, Nov 13, 2012 at 3:48 PM, Paolo Bonzini <bonzini@gnu.org> wrote:
> > Il 14/11/2012 00:43, H.J. Lu ha scritto:
> >> This works.
> >
> > Ok, then please test remove install-sh and friends and do
> > autoconf/automake again.  If it works, commit the result (I don't care
> > if you make it one or two commits).
> >
> > Then, wait 24 hours for breakages and commit the multilib patch.
> >
> > Paolo
> 
> This is the multilib patch I will commit later.

And it still doesn't work (after applying the fix in my other reply):

make[4]: Entering directory `/var/tmp/gcc_build_dir/x86_64-pc-linux-gnu/libsanitizer/asan'
 /bin/mkdir -p '/usr/lib/gcc/x86_64-pc-linux-gnu/'
 /bin/sh ../libtool   --mode=install /usr/bin/install -c   libasan.la '/usr/lib/gcc/x86_64-pc-linux-gnu/'
libtool: install: error: cannot install `libasan.la' to a directory not ending in /usr/lib/gcc/x86_64-pc-linux-gnu/
make[4]: *** [install-toolexeclibLTLIBRARIES] Error 1
H.J. Lu Nov. 15, 2012, 2:01 p.m. UTC | #2
On Thu, Nov 15, 2012 at 12:47 AM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
> On 2012.11.14 at 08:21 -0800, H.J. Lu wrote:
>> On Tue, Nov 13, 2012 at 3:48 PM, Paolo Bonzini <bonzini@gnu.org> wrote:
>> > Il 14/11/2012 00:43, H.J. Lu ha scritto:
>> >> This works.
>> >
>> > Ok, then please test remove install-sh and friends and do
>> > autoconf/automake again.  If it works, commit the result (I don't care
>> > if you make it one or two commits).
>> >
>> > Then, wait 24 hours for breakages and commit the multilib patch.
>> >
>> > Paolo
>>
>> This is the multilib patch I will commit later.
>
> And it still doesn't work (after applying the fix in my other reply):
>
> make[4]: Entering directory `/var/tmp/gcc_build_dir/x86_64-pc-linux-gnu/libsanitizer/asan'
>  /bin/mkdir -p '/usr/lib/gcc/x86_64-pc-linux-gnu/'
>  /bin/sh ../libtool   --mode=install /usr/bin/install -c   libasan.la '/usr/lib/gcc/x86_64-pc-linux-gnu/'
> libtool: install: error: cannot install `libasan.la' to a directory not ending in /usr/lib/gcc/x86_64-pc-linux-gnu/
> make[4]: *** [install-toolexeclibLTLIBRARIES] Error 1
>

It works for me.  Did you do

# ./contrib/gcc_update --touch
Markus Trippelsdorf Nov. 15, 2012, 2:19 p.m. UTC | #3
On 2012.11.15 at 06:01 -0800, H.J. Lu wrote:
> On Thu, Nov 15, 2012 at 12:47 AM, Markus Trippelsdorf
> <markus@trippelsdorf.de> wrote:
> > On 2012.11.14 at 08:21 -0800, H.J. Lu wrote:
> >> On Tue, Nov 13, 2012 at 3:48 PM, Paolo Bonzini <bonzini@gnu.org> wrote:
> >> > Il 14/11/2012 00:43, H.J. Lu ha scritto:
> >> >> This works.
> >> >
> >> > Ok, then please test remove install-sh and friends and do
> >> > autoconf/automake again.  If it works, commit the result (I don't care
> >> > if you make it one or two commits).
> >> >
> >> > Then, wait 24 hours for breakages and commit the multilib patch.
> >> >
> >> > Paolo
> >>
> >> This is the multilib patch I will commit later.
> >
> > And it still doesn't work (after applying the fix in my other reply):
> >
> > make[4]: Entering directory `/var/tmp/gcc_build_dir/x86_64-pc-linux-gnu/libsanitizer/asan'
> >  /bin/mkdir -p '/usr/lib/gcc/x86_64-pc-linux-gnu/'
> >  /bin/sh ../libtool   --mode=install /usr/bin/install -c   libasan.la '/usr/lib/gcc/x86_64-pc-linux-gnu/'
> > libtool: install: error: cannot install `libasan.la' to a directory not ending in /usr/lib/gcc/x86_64-pc-linux-gnu/
> > make[4]: *** [install-toolexeclibLTLIBRARIES] Error 1
> >
> 
> It works for me.  Did you do
> 
> # ./contrib/gcc_update --touch

Yes.
I've used the following to configure gcc:

~/gcc/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.0/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-libsanitizer --enable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-initfini-array --with-gold --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --disable-libgomp --enable-cld --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.0/python --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-bootstrap --with-boot-ldflags="-Wl,-O1,--hash-style=gnu,--as-needed,--gc-sections" --enable-version-specific-runtime-libs --disable-libstdcxx-pch --enable-libstdcxx-time=yes
H.J. Lu Nov. 15, 2012, 2:44 p.m. UTC | #4
On Thu, Nov 15, 2012 at 6:19 AM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
> On 2012.11.15 at 06:01 -0800, H.J. Lu wrote:
>> On Thu, Nov 15, 2012 at 12:47 AM, Markus Trippelsdorf
>> <markus@trippelsdorf.de> wrote:
>> > On 2012.11.14 at 08:21 -0800, H.J. Lu wrote:
>> >> On Tue, Nov 13, 2012 at 3:48 PM, Paolo Bonzini <bonzini@gnu.org> wrote:
>> >> > Il 14/11/2012 00:43, H.J. Lu ha scritto:
>> >> >> This works.
>> >> >
>> >> > Ok, then please test remove install-sh and friends and do
>> >> > autoconf/automake again.  If it works, commit the result (I don't care
>> >> > if you make it one or two commits).
>> >> >
>> >> > Then, wait 24 hours for breakages and commit the multilib patch.
>> >> >
>> >> > Paolo
>> >>
>> >> This is the multilib patch I will commit later.
>> >
>> > And it still doesn't work (after applying the fix in my other reply):
>> >
>> > make[4]: Entering directory `/var/tmp/gcc_build_dir/x86_64-pc-linux-gnu/libsanitizer/asan'
>> >  /bin/mkdir -p '/usr/lib/gcc/x86_64-pc-linux-gnu/'
>> >  /bin/sh ../libtool   --mode=install /usr/bin/install -c   libasan.la '/usr/lib/gcc/x86_64-pc-linux-gnu/'
>> > libtool: install: error: cannot install `libasan.la' to a directory not ending in /usr/lib/gcc/x86_64-pc-linux-gnu/
>> > make[4]: *** [install-toolexeclibLTLIBRARIES] Error 1
>> >
>>
>> It works for me.  Did you do
>>
>> # ./contrib/gcc_update --touch
>
> Yes.
> I've used the following to configure gcc:
>
> ~/gcc/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.0/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-libsanitizer --enable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-initfini-array --with-gold --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --disable-libgomp --enable-cld --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.0/python --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-bootstrap --with-boot-ldflags="-Wl,-O1,--hash-style=gnu,--as-needed,--gc-sections" --enable-version-specific-runtime-libs --disable-libstdcxx-pch --enable-libstdcxx-time=yes
>
> --
> Markus

I can reproduce it with --enable-version-specific-runtime-libs.  I am
taking a look.
diff mbox

Patch

diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index 0b6cdef..27a7f95 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -4,7 +4,56 @@ 
 AC_PREREQ([2.64])
 AC_INIT(package-unused, version-unused, libsanitizer)
 AC_CONFIG_SRCDIR([include/sanitizer/common_interface_defs.h])
+
+AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
+AC_ARG_ENABLE(version-specific-runtime-libs,
+[  --enable-version-specific-runtime-libs    Specify that runtime
libraries should be installed in a compiler-specific directory ],
+[case "$enableval" in
+ yes) version_specific_libs=yes ;;
+ no)  version_specific_libs=no ;;
+ *)   AC_MSG_ERROR([Unknown argument to enable/disable
version-specific libs]);;
+ esac],
+[version_specific_libs=no])
+AC_MSG_RESULT($version_specific_libs)
+
+# Do not delete or change the following two lines.  For why, see
+# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
+AC_CANONICAL_SYSTEM
+target_alias=${target_alias-$host_alias}
+AC_SUBST(target_alias)
+
 AM_INIT_AUTOMAKE(foreign)
+AM_ENABLE_MULTILIB(, ..)
+
+# Calculate toolexeclibdir
+# Also toolexecdir, though it's only used in toolexeclibdir
+case ${version_specific_libs} in
+  yes)
+    # Need the gcc compiler version to know where to install libraries
+    # and header files if --enable-version-specific-runtime-libs option
+    # is selected.
+    toolexecdir='$(libdir)/gcc/$(target_alias)'
+    toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+    ;;
+  no)
+    if test -n "$with_cross_host" &&
+       test x"$with_cross_host" != x"no"; then
+      # Install a library built with a cross compiler in tooldir, not libdir.
+      toolexecdir='$(exec_prefix)/$(target_alias)'
+      toolexeclibdir='$(toolexecdir)/lib'
+    else
+      toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+      toolexeclibdir='$(libdir)'
+    fi
+    multi_os_directory=`$CC -print-multi-os-directory`
+    case $multi_os_directory in
+      .) ;; # Avoid trailing /.
+      *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+    esac
+    ;;
+esac
+AC_SUBST(toolexecdir)
+AC_SUBST(toolexeclibdir)