-
Notifications
You must be signed in to change notification settings - Fork 563
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
CMake issue with shared libraries, --prefix on Apple #91
Comments
How can we reproduce the problem? I don't have a Mac so someone with a Mac will have to do it. Anyway, I suspect that we can just add this to TriBITS in one line to address this. |
Here is the prefixed installed libraries $ otool -L arch-trilinos/lib/libthyraepetra.dylib Note that the rpath is missing for all the Trilinos libraries. Here is built libraries in the build directory, note the rpath is correct $ otool -L arch-trilinos/externalpackages/git.trilinos/build/packages/thyra/core/src/libthyracore.dylib Here is a message during the cmake process indicating troubling updating the rpaths in the installed libraries error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: for: /Users/barrysmith/Src/petsc/arch-trilinos/lib/libteuchosnumerics.12.7.dylib (for architecture x86_64) option "-add_rpath /Users/barrysmith/Src/petsc/arch-trilinos/lib" would duplicate path, file already has LC_RPATH for: /Users/barrysmith/Src/petsc/arch-trilinos/lib When I add the -DCMAKE_INSTALL_NAME_DIR the error does not appear and the final libraries are complete. The log file is too large to attach to github, you can get it from ftp.mcs.anl.gov pub/petsc/configure.log |
Was this ever resolved? If not, I can try setting CMAKE_INSTALL_NAME_DIR appropriate in TriBITS (can't hard code to "${CMAKE_INSTALL_PREFIX}/lib", see here) and snapshotting to Trilinos and then someone can try out who has a Mac. |
I use:
On my mac and it seems to give me the correct behavior. |
I have asked for an account on a Mac machine so that I can reproduce this issue and then fix it. I would fix this on the Trilinos 12.6 release branch and the merge back to 'master' (and also take this commit and make it part of TriBITS proper). From: Bartlett, Roscoe A Hello Trilinos developers, Is there a Mac machine that I can get a (temporary) account on to help fix some installation problems with Trilinos on the Mac, like:
Thanks, -Ross |
I have gotten access to a Mac where I should be able to test this change. However, first I want to know if this is really the right thing to do. Therefore, I am asking for some advice from Brad King at Kitware (see below email). I look over a bunch of emails from several people over the years (including the SCALE/Exnihilo developers) and it seems that setting:
is universally set. Why not set these by default on OSX? Hopefully Brad can help clear this up. I don't know OSX so I am fearful to change default CMake behavior without a really good reason or knowing all the ramifications of doing so. Depending on what feedback I get, I will move forward and make this change to TriBITS. From: Bartlett, Roscoe A Hello Brad, What is the right way to handle RPATH on OSX? On Linux, RPATH is enabled by default. On OSX, it seems that RPATH is not enabled by default and developers and users are having a hard time working with installs of Trilinos. For example, see:
What seems to be suggested in that ticket and by many other people (in emails going back several years) is to use:
I am not sure if CMAKE_MACOSX_RPATH should be set automatically by default or not (RPATH seems to be enabled by default on Linux) but why not always set CMAKE_INSTALL_RPATH as shown above by default? We can allow users to set a different value but why not set that default for CMAKE_INSTALL_RPATH? I am not sure how this relates to the guidance in: https://cmake.org/Wiki/CMake_RPATH_handling (or even if that page is still accurate). Why does CMake not just magically work with shared libs and RPATH on OSX like it does on Linux? Should TriBITS and Trilinos break with standard CMake behavior and just automatically set up to set to use RPATH by default by setting the above vars for OSX? This has been a recurring irritation for users of Trilinos (and other TriBITS projects) and we need to resolve this one way or the other (either by setting defaults for vars like above or documenting this somewhere people can find it). What is your advice? Thanks, -Ross |
This is a very good question. Almost every CMake package we've seen has this same bug of not setting those values; Trilinos was not the only one :-( Several PETSc developers use Macs (including me) so we find Mac issues pretty quick. I'm surprised you don't have a bunch of Trilinos developers who use Macs. Barry
|
I will provide a more detailed comment later (waiting for an email response), but it is very likely that this issue is already resolved on the 'master' branch of Triinos.
Many Trilinos developers also use the Mac, but they seem to have figured this stuff out. Also, note that if all you do is develop and run out of the build directory, then you never do an install so you never see any install problems. I think only Albany users see such issues. Drekar developers and others just use extra repos and packages and therefore just work out of the build tree as well. |
The correct fix for this is described in TriBITSPub/TriBITS#126. Does this need to be fixed on the Trilinos 12.6 branch as well? If so, the easiest thing to do would be to snapshot TriBITS into the Trilinos 12.6 branch. But we generally don't like to do such things. |
I don't think you need to backport it to 12.6 since we patch it in our build of Trilinos with 12.6 |
I was using Mac for a while as a secondary build platform until my El Capitan upgrade broke stuff, but as Ross mentioned, this would only ever show up with installation testing. |
I believe that this has been resolved as of Trilinos commit f2b04f7:
Now the CMake system for Trilinos will write in RPATH correctly by default for Linux and OSX. |
@BarrySmith, if the PETSc bulid of Trilinos is still being maintained, you might try stripping out all of the manually set I have put this in review. If someone gets a chance to try this out at some point, that would be good feedback so that we can close this. Thanks for posting this. |
I think I remember some time ago at an IDEAS meeting that @BarrySmith said this was fixed. Closing as complete. |
Suggest you add a
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
to appropriate CMAKE files. Otherwise with a prefix build and shared libraries on Apple the rpath within the shared libraries is not properly reset when the shared libraries are copied over to the installed locations.
The text was updated successfully, but these errors were encountered: