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
libfplll tries to link 64-bit objects to 32-bit libstdc++.so #7864
Comments
comment:2
Could you check what compiler_lib_search_path is set to inside the generated libtool in the fplll build directory? ( |
comment:3
Replying to @wjp:
Yes, sure. Since posting this, I recompiled gcc and put it in the prefix
so the output from the build process is different to above. Here is the output, which is achieved when CFLAGS, CXXFLAGS, CPPFLAGS and LDFLAGS all have the option "-m64" addded.
Here is the output you requested.
If I manually add
to CFLAGS, CXXFLAGS etc, so this will link properly. But it should not be necessary to do this. I sent this problem via email today to the three developers listed in src/README. Dave |
Upstream: Reported upstream. Little or no feedback. |
comment:4
I've found a workaround. It is not ideal, but it is the same as I'm using for #7861. Basically this involves adding the directory of the 64-bit GCC libraries with -L and -R options to the compiler. An assumption is made that the directories containing the binaries (gcc, g++ etc) and libraries (libgfortran.so etc) share the same parent directory. This is the usual case, although it is possible to install these in different places. So if gcc is built with --prefix=/usr/local/gcc-4.5.0, then it is assumed that the following directories exists
Testing on OpenSolaris x64 with a Sun Ultra 27
Testing on Solaris 10 (SPARC) using 't2' with SAGE64=yesThis time, instead of the directory for the libraries have 'amd64' in the name, so it has 'sparcv9'.
Likewise, this builds ok.
|
Author: David Kirkby |
comment:5
The package may be found here for review. http://boxen.math.washington.edu/home/kirkby/patches/libfplll-3.0.12.p1.spkg This may be tested on 't2' if the following are set
The latter assumes you use the C compiler /usr/local/gcc-4.4.1-sun-linker/bin/gcc. Dave |
comment:6
This is rather confusing. Could you also run
? (Both with |
comment:7
As noted above (10 days ago), I'm now using a different compiler, /usr/local/gcc-4.4.4-multilib/bin/gcc I've shown the error with the new compiler above, so I don't need to repeat it. So I'm not typing exactly what you said. I compared with and without sage-env source. I copied the output to a file, then done a diff between the two files. They were the same, so no point showing it twice. First the 32-bit.
Now, the 64-bit:
|
comment:8
Replying to @sagetrac-drkirkby:
Oh, sorry, I copy/pasted the gcc path from your message (8 days ago) about t2. I'm glad you were more awake than me :-) If I'm reading this right, then in the 64-bit "libraries" section, the correct path
shows up before the wrong path that it's using
(Which is not unexpected.) The question remains: why does libtool pick up the wrong path... If you're willing to try one more (last ditch effort) command, could you put the (very lengthy) output of the failing libtool command online somewhere (maybe as a .gz'ed attachment or on a webserver somewhere), but with a This is the failing libtool command with an extra
It should be possible to trace back the origin of the offending path from that dump. |
comment:9
Replying to @wjp:
Yes, I think so. I just checked to make sure the correct library is there
as you can see, the 64-bit one is there.
Yes. This is not the only package where I've had this problem. There are two of them. But many packages use libtool ok.
Of course I am willing. I'd like to get a better solution to this. My fix is a hack, I know that. It allows it to build, but I'm not keen on it. Given you have some ideas on how to resolve this, I'm going to change it to 'needs work' so it does not get reviewed. Hopefully we can find a better solution than this one. I just started a fresh build of this. I'll have a shower, and by the time I'm finished, it should have failed and I'll post the output in an half an hour or so. (It depends somewhat on the size of the log file. It might take me a time to upload.) Unlike 't2', this machine is pretty quick, so it does not take long to build Sage. Excluding Maxima and R, which are not building on OpenSolaris, it only takes 40 minutes to build all of Sage. Dave |
Attachment: libtool-failure.log Failed libtool command, on a Sun Ultra 27, OpenSolaris 06/2009. |
comment:10
I've attached the complete log - it is not that big. |
comment:11
Interestingly the lines for At first glance this doesn't seem to be consistent with the value of |
comment:12
Thanks for looking. It would be good to get a real solution to this, rather than a hack Dave |
comment:13
It looks like this list of library search directories is generated by the configure-script by running This seems to strongly suggest that the way of selecting 32/64 bit builds using autoconf+libtool is to set CC (and consequently CXX. Maybe LD too?) to "gcc -m32" or "gcc -m64" (by using It would be nice to find confirmation of this in the autotools or libtool documentation somewhere. I found a brief reference here, but that's hardly authorative: |
comment:14
Replying to @wjp:
I'm a member of the autoconf mailing list and I think possibly the libtool mailing list too. I will post and ask there. I know one has to set CC with Python, but many packages don't need that. There are loads of packages in Sage building with only CFLAGS set, and not CC. Dave |
comment:15
Did you already post to the autoconf or libtool mailing lists? (If so, could you post a link to the thread?) I think it would be good to resolve this question soon. I'm also willing to post this question to the autoconf mailing list if you prefer. |
comment:16
Replying to @wjp:
I had overlooked to do it. I have since posted it on the autoconf list. http://lists.gnu.org/archive/html/autoconf/2010-07/msg00032.html I've attempted to subscribe to the libtool list, but so far got no response to my request to join. I will post a link here when I can join. The followup on there suggests not using CFLAGS/LDFLAGS but instead adding the directories manually, which is what this patch does. But that's a lot more difficult for the user, and is not necessary for most packages that use libtool. The vast majority of tools that use libtool manage to work out where the 64-bit libraries are. Dave |
comment:17
Do you mean simply using CC="gcc -m64" doesn't already help? My impression from the configure script was that this would make libtool pick up the correct library paths (the output from ' |
comment:18
Replying to @wjp:
I just checked spkg-install and see I had not done this at all. I will check that later. If that works, the solution would be a lot less hackish. I need to go out now, so will not be able to do this for a few hours. Dave |
comment:19
Hi William, your solution of setting CC="gcc -m64" works well. (Actually, it needs CXX set to "g++ -m64", though I have set both CC and CXX) I've written the changes to spkg-install in such a way it should work for any compiler (not just gcc/g++. This should help in the unlikely even this is ever ported to AIX or HP-UX. Here are some test results using your method. I've put you as an author too. The package is here and needs review http://boxen.math.washington.edu/home/kirkby/patches/libfplll-3.0.12.p1.spkg Here are some test results. I've tested on Solaris 10, OpenSolaris and OS X. Testing on OpenSolaris x64 as a 64-bit build (
|
Changed author from David Kirkby to David Kirkby, Willem Jan Palenstijn |
Attachment: 7864-redefined-CC-and-CXX.patch.gz Replaces earlier patch - work in a different way. |
comment:21
Replying to @sagetrac-drkirkby:
Any chance of this being reviewed? William and I can review it together, as long as we are revising changes made by the other. I've confirmed William's suggestion works, so if he confirms my implementation works, this should be ok for us both to review it. Dave |
comment:22
I don't think William was involved in this ticket, so I'm going to assume you mean me :-) I don't really like how all this logic is going into spkg-install files. If this keeps up, every spkg-install file will end up having pages and pages of code which is common to (almost) every spkg-install, and this will make maintaining that common code a mess. Additionally, it makes it very untransparent what effect the various environment variables that can be set have (and for that matter I'd prefer this being moved up either to a file which is sourced in spkg-install, or the relevant environment variables being set higher up. You've no doubt been following build system discussions much more closely than I have. Do you know if there has been any talk about moving in this direction already? |
comment:23
Replying to @wjp:
Sorry Willem, I did mean you.
I do agree in principle, but we have tried in the past (e.g. #7818) to set things like CFLAGS globally, and it just failed - totally messing up Cython in particular. Different packages in Sage have different ways of how to specify 64-bit builds. ATLAS takes a command line option (-b64), zlib takes a command line option (--64), some need CFLAGS set, some need an ABI set. Some (in fact most) packages use "gcc" irrespective of the setting of the variable CC, so setting CC is pointless, as packages have "gcc" hard-coded in them. At one point I started fixing some of these, so they would use $CC, but I gave up, as there are so many of them - see for example #7024, #7027, #7038, #7041, #7048, #7066, #7069, #7071, etc etc.) To my knowledge, there are only three tickets that need this change of adding -m64 to $CC.
I don't think there will be any more either, as I have managed to build a 64-bit Sage on Solaris 10 on the SPARC processor using this change. Implementing a global change is likely to cause more problems than on 3 tickets. Dave |
comment:24
I don't know if anyone else has any comments on this. The package at http://boxen.math.washington.edu/home/kirkby/patches/libfplll-3.0.12.p1.spkg solves the problem, and I really doubt any other way to solve this problem such as globally setting compilers would be a good idea, given different packages handle 64-bit builds in different ways. It only needs this simple change, and similar ones for Pynac (#7861) and Numpy (#8086), with a few totally different changes to ATLAS to get a 64-bit SPARC version of Sage built. From there, we can start debugging it, which will no doubt present some problems. Dave |
comment:25
Sorry for not commenting earlier. The patch looks good. I've been testing and it seems to work on various different machines, both 32-bit and 64-bit. I'm waiting until the build on mark2 finishes, which could be several weeks :) Then I'll give it a positive review. |
Reviewer: John Palmieri |
comment:26
Okay, looks good. |
comment:27
Note to the release managerJust drop in http://boxen.math.washington.edu/home/kirkby/patches/libfplll-3.0.12.p1.spkg There are no library patches. All patches are in the .spkg file and are committed to the repository. |
Merged: sage-4.5.3.alpha0 |
Build environment
== The problem ==
Despite the fact all the objects file (.o) are created 64-bit (as intended), the final link phase tries to link against a 32-bit library
rather than the 64-bit version:
I don't understand why Here is the the failed part of the build.
== Workaround ==
A workaround is to delete the library, then create a link to the same library in the amd64 directory. But this is a hack, and obviously means gcc would not work properly for 32-bit builds in this case.
Upstream: Reported upstream. Little or no feedback.
CC: @jaapspies @jhpalmieri
Component: porting: Solaris
Author: David Kirkby, Willem Jan Palenstijn
Reviewer: John Palmieri
Merged: sage-4.5.3.alpha0
Issue created by migration from https://trac.sagemath.org/ticket/7864
The text was updated successfully, but these errors were encountered: