Russell Harmon
2014-May-30 04:18 UTC
[LLVMdev] [PATCH] Use GCC_INSTALL_PREFIX for rpath if set.
The behavior of automatically detecting libraries installed in the same prefix feels like magic to me anyway. Perhaps it would be better to have project-level variables for specifying the path to them individually? The default value for them could remain as origin/../lib which would keep from breaking things. On Thu May 29 2014 at 7:06:17 PM, Chandler Carruth <chandlerc at google.com> wrote:> This looks like it would remove the origin/../lib RPATH which would break > finding libraries related to Clang such as libc++? > > It makes sense to add the GCC install prefix to the RPATH though. I > wonder, should we try to do something about the lib vs. lib{32,64} > business? I don't know that either of these does the right thing there. > > > On Thu, May 29, 2014 at 3:37 PM, Russell Harmon <eatnumber1 at google.com> > wrote: > >> This way, an LLVM compiled after setting GCC_INSTALL_PREFIX will work >> correctly >> if you don't want to install LLVM into the GCC_INSTALL_PREFIX. >> --- >> CMakeLists.txt | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/CMakeLists.txt b/CMakeLists.txt >> index 9ec3e33..c85a028 100644 >> --- a/CMakeLists.txt >> +++ b/CMakeLists.txt >> @@ -450,7 +450,12 @@ if (APPLE) >> set(CMAKE_INSTALL_RPATH "@executable_path/../lib") >> else(UNIX) >> if(NOT DEFINED CMAKE_INSTALL_RPATH) >> - set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") >> + if(DEFINED GCC_INSTALL_PREFIX) >> + set(CMAKE_INSTALL_RPATH "${GCC_INSTALL_PREFIX}/lib") >> + else() >> + set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") >> + endif() >> + >> if (${CMAKE_SYSTEM_NAME} MATCHES FreeBSD) >> set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} >> -Wl,-z,origin") >> endif() >> > -- >> 1.9.1.423.g4596e3a >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140530/e13ecd9a/attachment.html>
Russell Harmon
2014-May-30 06:25 UTC
[LLVMdev] [PATCH] Prepend GCC_INSTALL_PREFIX to rpath if set.
This patch just prepends the gcc install prefix to the rpath rather than overriding it. It also uses the LLVM_LIBDIR_SUFFIX under the assumption that if you want llvm to install to lib{32,64} that you also installed gcc under that directory. This way, an LLVM compiled after setting GCC_INSTALL_PREFIX will work correctly if you don't want to install LLVM into the GCC_INSTALL_PREFIX. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ec3e33..70684a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -451,6 +451,10 @@ if (APPLE) else(UNIX) if(NOT DEFINED CMAKE_INSTALL_RPATH) set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") + if(DEFINED GCC_INSTALL_PREFIX) + set(CMAKE_INSTALL_RPATH "${GCC_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}:${CMAKE_INSTALL_RPATH}") + endif() + if (${CMAKE_SYSTEM_NAME} MATCHES FreeBSD) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,origin") endif() -- 1.9.1.423.g4596e3a
Chandler Carruth
2014-May-30 06:50 UTC
[LLVMdev] [PATCH] Use GCC_INSTALL_PREFIX for rpath if set.
I'm pretty hesitant to change this. We haven't really had any complaints and it makes several scenarios "just work". I'm sympathetic to your point, just not yet 100% convinced of what the change should be. On Thu, May 29, 2014 at 9:18 PM, Russell Harmon <eatnumber1 at google.com> wrote:> The behavior of automatically detecting libraries installed in the same > prefix feels like magic to me anyway. Perhaps it would be better to have > project-level variables for specifying the path to them individually? The > default value for them could remain as origin/../lib which would keep from > breaking things. > > > On Thu May 29 2014 at 7:06:17 PM, Chandler Carruth <chandlerc at google.com> > wrote: > >> This looks like it would remove the origin/../lib RPATH which would break >> finding libraries related to Clang such as libc++? >> >> It makes sense to add the GCC install prefix to the RPATH though. I >> wonder, should we try to do something about the lib vs. lib{32,64} >> business? I don't know that either of these does the right thing there. >> >> >> On Thu, May 29, 2014 at 3:37 PM, Russell Harmon <eatnumber1 at google.com> >> wrote: >> >>> This way, an LLVM compiled after setting GCC_INSTALL_PREFIX will work >>> correctly >>> if you don't want to install LLVM into the GCC_INSTALL_PREFIX. >>> --- >>> CMakeLists.txt | 7 ++++++- >>> 1 file changed, 6 insertions(+), 1 deletion(-) >>> >>> diff --git a/CMakeLists.txt b/CMakeLists.txt >>> index 9ec3e33..c85a028 100644 >>> --- a/CMakeLists.txt >>> +++ b/CMakeLists.txt >>> @@ -450,7 +450,12 @@ if (APPLE) >>> set(CMAKE_INSTALL_RPATH "@executable_path/../lib") >>> else(UNIX) >>> if(NOT DEFINED CMAKE_INSTALL_RPATH) >>> - set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") >>> + if(DEFINED GCC_INSTALL_PREFIX) >>> + set(CMAKE_INSTALL_RPATH "${GCC_INSTALL_PREFIX}/lib") >>> + else() >>> + set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") >>> + endif() >>> + >>> if (${CMAKE_SYSTEM_NAME} MATCHES FreeBSD) >>> set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} >>> -Wl,-z,origin") >>> endif() >>> >> -- >>> 1.9.1.423.g4596e3a >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>> >>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140529/991e2f1e/attachment.html>
Chandler Carruth
2014-May-30 06:51 UTC
[LLVMdev] [PATCH] Prepend GCC_INSTALL_PREFIX to rpath if set.
I would separate the LLVM_LIBDIR_SUFFIX change out. If we want to go that route, it should be applied both to the install rpath and to the GCC one. It seems unambiguously better for the install rpath, and probably better for the GCC one. But still, separate patch. Adding the GCC rpath seems like a good first step, feel free to commite. On Thu, May 29, 2014 at 11:25 PM, Russell Harmon <eatnumber1 at google.com> wrote:> This patch just prepends the gcc install prefix to the rpath rather than > overriding it. It also uses the LLVM_LIBDIR_SUFFIX under the assumption > that if > you want llvm to install to lib{32,64} that you also installed gcc under > that > directory. > > This way, an LLVM compiled after setting GCC_INSTALL_PREFIX will work > correctly > if you don't want to install LLVM into the GCC_INSTALL_PREFIX. > --- > CMakeLists.txt | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/CMakeLists.txt b/CMakeLists.txt > index 9ec3e33..70684a7 100644 > --- a/CMakeLists.txt > +++ b/CMakeLists.txt > @@ -451,6 +451,10 @@ if (APPLE) > else(UNIX) > if(NOT DEFINED CMAKE_INSTALL_RPATH) > set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") > + if(DEFINED GCC_INSTALL_PREFIX) > + set(CMAKE_INSTALL_RPATH > "${GCC_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}:${CMAKE_INSTALL_RPATH}") > + endif() > + > if (${CMAKE_SYSTEM_NAME} MATCHES FreeBSD) > set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} > -Wl,-z,origin") > endif() > -- > 1.9.1.423.g4596e3a > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140529/b8bb31b8/attachment.html>