Re: build libLLVM.so in devel/llvm
On 3/6/2018 7:47 AM, Stuart Henderson wrote: > On 2018/03/06 21:32, Jonathan Gray wrote: >> On Sat, Feb 17, 2018 at 11:12:44PM +1100, Jonathan Gray wrote: >>> On Thu, Feb 15, 2018 at 05:08:56PM +, Stuart Henderson wrote: On 2018/02/15 11:19, Brian Callahan wrote: > On 02/15/18 10:02, Jonathan Gray wrote: >> Build libLLVM.so and link tools with it. >> >> This seems to be the way almost all Linux distributions and BSDs >> ship LLVM and is what Mesa expects. >> >> Use the documented cmake var for RTTI while here. > Any reason not to use the SHARED_LIBS facility of ports for libLLVM, like > libclang and libLTO already do in the LLVM port? agreed, it's a bit non-obvious that it might be needed because unlike other build systems (which normally use a default value if not passed via SHARED_LIBS) the way we've got cmake setup it just skips the library version in that case.. >>> Trying to use SHARED_LIBS breaks and isn't so useful as the name >>> of the library includes the major/minor llvm version with the abi >>> unlikely to change on new release based from the same branch. >>> >>> The intent seems to be to allow multiple versions to be installed >>> concurrently as llvm breaks abi/api between most releases. >>> >>> Warning: symlink(s) point to non-existent >>> /usr/ports/pobj/llvm-5.0.1/fake-amd64/usr/local/lib/libLLVM-5.0.so >>> /usr/ports/pobj/llvm-5.0.1/fake-amd64/usr/local/lib/libLLVM-5.0.1.so >>> /usr/ports/pobj/llvm-5.0.1/fake-amd64/usr/local/lib/libLLVM.so >>> >>> $ ls -l /usr/local/lib/libLLVM*.so* >>> lrwxr-xr-x 1 root wheel14 Feb 17 22:55 >>> /usr/local/lib/libLLVM-5.0.1.so -> libLLVM-5.0.so >>> -rw-r--r-- 1 root bin61453686 Feb 17 22:47 >>> /usr/local/lib/libLLVM-5.0.so.0.0 >>> lrwxr-xr-x 1 root wheel14 Feb 17 22:55 /usr/local/lib/libLLVM.so >>> -> libLLVM-5.0.so >>> >>> $ llvm-config --link-shared >>> llvm-config: error: libLLVM-5.0.so is missing >>> $ llvm-config --shared-mode >>> static >> So would anyone be opposed to the first diff in this thread going in? > The potential issue with this is that if things in ports start linking > to it, we'll run into problems with updates. > > That said I don't really have a better idea and I don't want to get in > the way of your work on Mesa, so OK sthen@ but think we will need to keep > an eye on it. > Same ok with me. Go ahead.
Re: build libLLVM.so in devel/llvm
On 2018/03/06 21:32, Jonathan Gray wrote: > On Sat, Feb 17, 2018 at 11:12:44PM +1100, Jonathan Gray wrote: > > On Thu, Feb 15, 2018 at 05:08:56PM +, Stuart Henderson wrote: > > > On 2018/02/15 11:19, Brian Callahan wrote: > > > > > > > > On 02/15/18 10:02, Jonathan Gray wrote: > > > > > Build libLLVM.so and link tools with it. > > > > > > > > > > This seems to be the way almost all Linux distributions and BSDs > > > > > ship LLVM and is what Mesa expects. > > > > > > > > > > Use the documented cmake var for RTTI while here. > > > > > > > > Any reason not to use the SHARED_LIBS facility of ports for libLLVM, > > > > like > > > > libclang and libLTO already do in the LLVM port? > > > > > > agreed, it's a bit non-obvious that it might be needed because unlike > > > other build systems (which normally use a default value if not passed > > > via SHARED_LIBS) the way we've got cmake setup it just skips the library > > > version in that case.. > > > > > > > Trying to use SHARED_LIBS breaks and isn't so useful as the name > > of the library includes the major/minor llvm version with the abi > > unlikely to change on new release based from the same branch. > > > > The intent seems to be to allow multiple versions to be installed > > concurrently as llvm breaks abi/api between most releases. > > > > Warning: symlink(s) point to non-existent > > /usr/ports/pobj/llvm-5.0.1/fake-amd64/usr/local/lib/libLLVM-5.0.so > > /usr/ports/pobj/llvm-5.0.1/fake-amd64/usr/local/lib/libLLVM-5.0.1.so > > /usr/ports/pobj/llvm-5.0.1/fake-amd64/usr/local/lib/libLLVM.so > > > > $ ls -l /usr/local/lib/libLLVM*.so* > > lrwxr-xr-x 1 root wheel14 Feb 17 22:55 > > /usr/local/lib/libLLVM-5.0.1.so -> libLLVM-5.0.so > > -rw-r--r-- 1 root bin61453686 Feb 17 22:47 > > /usr/local/lib/libLLVM-5.0.so.0.0 > > lrwxr-xr-x 1 root wheel14 Feb 17 22:55 /usr/local/lib/libLLVM.so > > -> libLLVM-5.0.so > > > > $ llvm-config --link-shared > > llvm-config: error: libLLVM-5.0.so is missing > > $ llvm-config --shared-mode > > static > > So would anyone be opposed to the first diff in this thread going in? The potential issue with this is that if things in ports start linking to it, we'll run into problems with updates. That said I don't really have a better idea and I don't want to get in the way of your work on Mesa, so OK sthen@ but think we will need to keep an eye on it.
Re: build libLLVM.so in devel/llvm
On Sat, Feb 17, 2018 at 11:12:44PM +1100, Jonathan Gray wrote: > On Thu, Feb 15, 2018 at 05:08:56PM +, Stuart Henderson wrote: > > On 2018/02/15 11:19, Brian Callahan wrote: > > > > > > On 02/15/18 10:02, Jonathan Gray wrote: > > > > Build libLLVM.so and link tools with it. > > > > > > > > This seems to be the way almost all Linux distributions and BSDs > > > > ship LLVM and is what Mesa expects. > > > > > > > > Use the documented cmake var for RTTI while here. > > > > > > Any reason not to use the SHARED_LIBS facility of ports for libLLVM, like > > > libclang and libLTO already do in the LLVM port? > > > > agreed, it's a bit non-obvious that it might be needed because unlike > > other build systems (which normally use a default value if not passed > > via SHARED_LIBS) the way we've got cmake setup it just skips the library > > version in that case.. > > > > Trying to use SHARED_LIBS breaks and isn't so useful as the name > of the library includes the major/minor llvm version with the abi > unlikely to change on new release based from the same branch. > > The intent seems to be to allow multiple versions to be installed > concurrently as llvm breaks abi/api between most releases. > > Warning: symlink(s) point to non-existent > /usr/ports/pobj/llvm-5.0.1/fake-amd64/usr/local/lib/libLLVM-5.0.so > /usr/ports/pobj/llvm-5.0.1/fake-amd64/usr/local/lib/libLLVM-5.0.1.so > /usr/ports/pobj/llvm-5.0.1/fake-amd64/usr/local/lib/libLLVM.so > > $ ls -l /usr/local/lib/libLLVM*.so* > lrwxr-xr-x 1 root wheel14 Feb 17 22:55 > /usr/local/lib/libLLVM-5.0.1.so -> libLLVM-5.0.so > -rw-r--r-- 1 root bin61453686 Feb 17 22:47 > /usr/local/lib/libLLVM-5.0.so.0.0 > lrwxr-xr-x 1 root wheel14 Feb 17 22:55 /usr/local/lib/libLLVM.so -> > libLLVM-5.0.so > > $ llvm-config --link-shared > llvm-config: error: libLLVM-5.0.so is missing > $ llvm-config --shared-mode > static So would anyone be opposed to the first diff in this thread going in? > > Index: Makefile > === > RCS file: /cvs/ports/devel/llvm/Makefile,v > retrieving revision 1.172 > diff -u -p -r1.172 Makefile > --- Makefile 2 Feb 2018 13:33:11 - 1.172 > +++ Makefile 17 Feb 2018 11:59:08 - > @@ -14,11 +14,12 @@ COMMENT-main =modular, fast C/C++/ObjC > COMMENT-python = Python bindings for Clang > > LLVM_V = 5.0.1 > +LLVM_BRANCH =${LLVM_V:C/\.[^\.]*$//} > DISTNAME = llvm-${LLVM_V}.src > PKGNAME =llvm-${LLVM_V} > PKGNAME-main = llvm-${LLVM_V} > PKGNAME-python = py-llvm-${LLVM_V} > -REVISION-main = 1 > +REVISION-main = 2 > CATEGORIES = devel > DISTFILES = llvm-${LLVM_V}.src${EXTRACT_SUFX} \ > cfe-${LLVM_V}.src${EXTRACT_SUFX} \ > @@ -27,7 +28,8 @@ MASTER_SITES = https://www.llvm.org/rele > EXTRACT_SUFX = .tar.xz > > SHARED_LIBS =clang 6.0 \ > - LTO 3.0 > + LTO 3.0 \ > + LLVM-${LLVM_BRANCH} 0.0 > > # packager notes in http://llvm.org/docs/Packaging.html > HOMEPAGE = http://www.llvm.org/ > @@ -55,10 +57,12 @@ RUN_DEPENDS-python = ${MODPY_RUN_DEPENDS > LIB_DEPENDS-python = ${BUILD_PKGPATH},-main > > SEPARATE_BUILD = Yes > -CONFIGURE_ARGS = -DLLVM_ENABLE_FFI:Bool=False \ > +CONFIGURE_ARGS = -DLLVM_ENABLE_FFI:Bool=True \ > -DLLVM_ENABLE_TERMINFO:Bool=False \ > - -DLLVM_REQUIRES_RTTI:Bool=True \ > + -DLLVM_ENABLE_RTTI:Bool=True \ > -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2:Bool=True \ > + -DLLVM_LINK_LLVM_DYLIB:Bool=True \ > + -DLLVM_BUILD_LLVM_DYLIB:Bool=True \ > -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND \ > -DBacktrace_LIBRARY='' > > Index: patches/patch-tools_llvm-shlib_CMakeLists_txt > === > RCS file: patches/patch-tools_llvm-shlib_CMakeLists_txt > diff -N patches/patch-tools_llvm-shlib_CMakeLists_txt > --- /dev/null 1 Jan 1970 00:00:00 - > +++ patches/patch-tools_llvm-shlib_CMakeLists_txt 17 Feb 2018 11:59:08 > - > @@ -0,0 +1,26 @@ > +$OpenBSD$ > + > +fix symbols not getting added to shared library > + > +Index: tools/llvm-shlib/CMakeLists.txt > +--- tools/llvm-shlib/CMakeLists.txt.orig > tools/llvm-shlib/CMakeLists.txt > +@@ -37,15 +37,15 @@ endif() > + add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES}) > + > + list(REMOVE_DUPLICATES LIB_NAMES) > +-if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU) OR > ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") OR ("${CMAKE_SYSTEM_NAME}" > STREQUAL "DragonFly")) # FIXME: It should be "GNU ld for elf" > ++if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") > ++ set(LIB_NAMES -Wl,-all_load ${LIB_NAMES}) > ++else() > + configure_file( > + $
Re: build libLLVM.so in devel/llvm
On Thu, Feb 15, 2018 at 05:08:56PM +, Stuart Henderson wrote: > On 2018/02/15 11:19, Brian Callahan wrote: > > > > On 02/15/18 10:02, Jonathan Gray wrote: > > > Build libLLVM.so and link tools with it. > > > > > > This seems to be the way almost all Linux distributions and BSDs > > > ship LLVM and is what Mesa expects. > > > > > > Use the documented cmake var for RTTI while here. > > > > Any reason not to use the SHARED_LIBS facility of ports for libLLVM, like > > libclang and libLTO already do in the LLVM port? > > agreed, it's a bit non-obvious that it might be needed because unlike > other build systems (which normally use a default value if not passed > via SHARED_LIBS) the way we've got cmake setup it just skips the library > version in that case.. > Trying to use SHARED_LIBS breaks and isn't so useful as the name of the library includes the major/minor llvm version with the abi unlikely to change on new release based from the same branch. The intent seems to be to allow multiple versions to be installed concurrently as llvm breaks abi/api between most releases. Warning: symlink(s) point to non-existent /usr/ports/pobj/llvm-5.0.1/fake-amd64/usr/local/lib/libLLVM-5.0.so /usr/ports/pobj/llvm-5.0.1/fake-amd64/usr/local/lib/libLLVM-5.0.1.so /usr/ports/pobj/llvm-5.0.1/fake-amd64/usr/local/lib/libLLVM.so $ ls -l /usr/local/lib/libLLVM*.so* lrwxr-xr-x 1 root wheel14 Feb 17 22:55 /usr/local/lib/libLLVM-5.0.1.so -> libLLVM-5.0.so -rw-r--r-- 1 root bin61453686 Feb 17 22:47 /usr/local/lib/libLLVM-5.0.so.0.0 lrwxr-xr-x 1 root wheel14 Feb 17 22:55 /usr/local/lib/libLLVM.so -> libLLVM-5.0.so $ llvm-config --link-shared llvm-config: error: libLLVM-5.0.so is missing $ llvm-config --shared-mode static Index: Makefile === RCS file: /cvs/ports/devel/llvm/Makefile,v retrieving revision 1.172 diff -u -p -r1.172 Makefile --- Makefile2 Feb 2018 13:33:11 - 1.172 +++ Makefile17 Feb 2018 11:59:08 - @@ -14,11 +14,12 @@ COMMENT-main = modular, fast C/C++/ObjC COMMENT-python = Python bindings for Clang LLVM_V = 5.0.1 +LLVM_BRANCH = ${LLVM_V:C/\.[^\.]*$//} DISTNAME = llvm-${LLVM_V}.src PKGNAME = llvm-${LLVM_V} PKGNAME-main = llvm-${LLVM_V} PKGNAME-python = py-llvm-${LLVM_V} -REVISION-main =1 +REVISION-main =2 CATEGORIES = devel DISTFILES =llvm-${LLVM_V}.src${EXTRACT_SUFX} \ cfe-${LLVM_V}.src${EXTRACT_SUFX} \ @@ -27,7 +28,8 @@ MASTER_SITES =https://www.llvm.org/rele EXTRACT_SUFX = .tar.xz SHARED_LIBS = clang 6.0 \ - LTO 3.0 + LTO 3.0 \ + LLVM-${LLVM_BRANCH} 0.0 # packager notes in http://llvm.org/docs/Packaging.html HOMEPAGE = http://www.llvm.org/ @@ -55,10 +57,12 @@ RUN_DEPENDS-python =${MODPY_RUN_DEPENDS LIB_DEPENDS-python = ${BUILD_PKGPATH},-main SEPARATE_BUILD = Yes -CONFIGURE_ARGS = -DLLVM_ENABLE_FFI:Bool=False \ +CONFIGURE_ARGS = -DLLVM_ENABLE_FFI:Bool=True \ -DLLVM_ENABLE_TERMINFO:Bool=False \ - -DLLVM_REQUIRES_RTTI:Bool=True \ + -DLLVM_ENABLE_RTTI:Bool=True \ -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2:Bool=True \ + -DLLVM_LINK_LLVM_DYLIB:Bool=True \ + -DLLVM_BUILD_LLVM_DYLIB:Bool=True \ -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND \ -DBacktrace_LIBRARY='' Index: patches/patch-tools_llvm-shlib_CMakeLists_txt === RCS file: patches/patch-tools_llvm-shlib_CMakeLists_txt diff -N patches/patch-tools_llvm-shlib_CMakeLists_txt --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-tools_llvm-shlib_CMakeLists_txt 17 Feb 2018 11:59:08 - @@ -0,0 +1,26 @@ +$OpenBSD$ + +fix symbols not getting added to shared library + +Index: tools/llvm-shlib/CMakeLists.txt +--- tools/llvm-shlib/CMakeLists.txt.orig tools/llvm-shlib/CMakeLists.txt +@@ -37,15 +37,15 @@ endif() + add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES}) + + list(REMOVE_DUPLICATES LIB_NAMES) +-if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU) OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")) # FIXME: It should be "GNU ld for elf" ++if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") ++ set(LIB_NAMES -Wl,-all_load ${LIB_NAMES}) ++else() + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/simple_version_script.map.in + ${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map) + + # GNU ld doesn't resolve symbols in the version script. + set(LIB_NAMES -Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map -Wl,--whole-archive ${LIB_NAMES} -Wl,-
Re: build libLLVM.so in devel/llvm
On 2018/02/15 11:19, Brian Callahan wrote: > > On 02/15/18 10:02, Jonathan Gray wrote: > > Build libLLVM.so and link tools with it. > > > > This seems to be the way almost all Linux distributions and BSDs > > ship LLVM and is what Mesa expects. > > > > Use the documented cmake var for RTTI while here. > > Any reason not to use the SHARED_LIBS facility of ports for libLLVM, like > libclang and libLTO already do in the LLVM port? agreed, it's a bit non-obvious that it might be needed because unlike other build systems (which normally use a default value if not passed via SHARED_LIBS) the way we've got cmake setup it just skips the library version in that case..
Re: build libLLVM.so in devel/llvm
On 02/15/18 10:02, Jonathan Gray wrote: Build libLLVM.so and link tools with it. This seems to be the way almost all Linux distributions and BSDs ship LLVM and is what Mesa expects. Use the documented cmake var for RTTI while here. Any reason not to use the SHARED_LIBS facility of ports for libLLVM, like libclang and libLTO already do in the LLVM port? ~Brian Index: Makefile === RCS file: /cvs/ports/devel/llvm/Makefile,v retrieving revision 1.172 diff -u -p -r1.172 Makefile --- Makefile2 Feb 2018 13:33:11 - 1.172 +++ Makefile15 Feb 2018 13:32:09 - @@ -18,7 +18,7 @@ DISTNAME =llvm-${LLVM_V}.src PKGNAME = llvm-${LLVM_V} PKGNAME-main =llvm-${LLVM_V} PKGNAME-python = py-llvm-${LLVM_V} -REVISION-main =1 +REVISION-main =2 CATEGORIES = devel DISTFILES = llvm-${LLVM_V}.src${EXTRACT_SUFX} \ cfe-${LLVM_V}.src${EXTRACT_SUFX} \ @@ -55,10 +55,12 @@ RUN_DEPENDS-python =${MODPY_RUN_DEPENDS LIB_DEPENDS-python = ${BUILD_PKGPATH},-main SEPARATE_BUILD = Yes -CONFIGURE_ARGS = -DLLVM_ENABLE_FFI:Bool=False \ +CONFIGURE_ARGS = -DLLVM_ENABLE_FFI:Bool=True \ -DLLVM_ENABLE_TERMINFO:Bool=False \ - -DLLVM_REQUIRES_RTTI:Bool=True \ + -DLLVM_ENABLE_RTTI:Bool=True \ -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2:Bool=True \ + -DLLVM_LINK_LLVM_DYLIB:Bool=True \ + -DLLVM_BUILD_LLVM_DYLIB:Bool=True \ -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND \ -DBacktrace_LIBRARY='' Index: patches/patch-tools_llvm-shlib_CMakeLists_txt === RCS file: patches/patch-tools_llvm-shlib_CMakeLists_txt diff -N patches/patch-tools_llvm-shlib_CMakeLists_txt --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-tools_llvm-shlib_CMakeLists_txt 15 Feb 2018 13:32:09 - @@ -0,0 +1,26 @@ +$OpenBSD$ + +fix symbols not getting added to shared library + +Index: tools/llvm-shlib/CMakeLists.txt +--- tools/llvm-shlib/CMakeLists.txt.orig tools/llvm-shlib/CMakeLists.txt +@@ -37,15 +37,15 @@ endif() + add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES}) + + list(REMOVE_DUPLICATES LIB_NAMES) +-if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU) OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")) # FIXME: It should be "GNU ld for elf" ++if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") ++ set(LIB_NAMES -Wl,-all_load ${LIB_NAMES}) ++else() + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/simple_version_script.map.in + ${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map) + + # GNU ld doesn't resolve symbols in the version script. + set(LIB_NAMES -Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive) +-elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") +- set(LIB_NAMES -Wl,-all_load ${LIB_NAMES}) + endif() + + target_link_libraries(LLVM PRIVATE ${LIB_NAMES}) Index: pkg/PLIST-main === RCS file: /cvs/ports/devel/llvm/pkg/PLIST-main,v retrieving revision 1.5 diff -u -p -r1.5 PLIST-main --- pkg/PLIST-main 8 Sep 2017 05:58:19 - 1.5 +++ pkg/PLIST-main 15 Feb 2018 13:32:09 - @@ -1939,6 +1939,9 @@ lib/cmake/llvm/LLVMInstallSymlink.cmake lib/cmake/llvm/LLVMProcessSources.cmake lib/cmake/llvm/TableGen.cmake lib/cmake/llvm/VersionFromVCS.cmake +lib/libLLVM-${LLVM_V}.so +lib/libLLVM-5.0.so +lib/libLLVM.so lib/libLLVMAArch64AsmParser.a lib/libLLVMAArch64AsmPrinter.a lib/libLLVMAArch64CodeGen.a