From 781d85c69abf78740dd980f98e084a8a9d74f04b Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 9 Nov 2019 23:32:56 +0100 Subject: [PATCH 1/2] rocksdb: enable USE_RTTI=1 This is required for programs using rocksdb and and typeinfo. Otherwise, linking them fails with errors like this (that's ceph): /nix/store/cg0k49h66nkdqx6ccwnqr0i4q0fnfznc-binutils-2.31.1/bin/ld: ../../lib/libos.a(RocksDBStore.cc.o):(.data.rel.ro._ZTIN12RocksDBStore14RocksWBHandlerE[_ZTIN12RocksDBStore14RocksWBHandlerE]+0x10): undefined reference to `typeinfo for rocksdb::WriteBatch::Handler' /nix/store/cg0k49h66nkdqx6ccwnqr0i4q0fnfznc-binutils-2.31.1/bin/ld: ../../lib/libos.a(RocksDBStore.cc.o):(.data.rel.ro._ZTIN12RocksDBStore19MergeOperatorRouterE[_ZTIN12RocksDBStore19MergeOperatorRouterE]+0x10): undefined reference to `typeinfo for rocksdb::AssociativeMergeOperator' /nix/store/cg0k49h66nkdqx6ccwnqr0i4q0fnfznc-binutils-2.31.1/bin/ld: ../../lib/libos.a(RocksDBStore.cc.o):(.data.rel.ro._ZTIN12RocksDBStore19MergeOperatorLinkerE[_ZTIN12RocksDBStore19MergeOperatorLinkerE]+0x10): undefined reference to `typeinfo for rocksdb::AssociativeMergeOperator' /nix/store/cg0k49h66nkdqx6ccwnqr0i4q0fnfznc-binutils-2.31.1/bin/ld: ../../lib/libos.a(RocksDBStore.cc.o):(.data.rel.ro._ZTI17CephRocksdbLogger[_ZTI17CephRocksdbLogger]+0x10): undefined reference to `typeinfo for rocksdb::Logger' /nix/store/cg0k49h66nkdqx6ccwnqr0i4q0fnfznc-binutils-2.31.1/bin/ld: ../../lib/libos.a(BlueRocksEnv.cc.o):(.data.rel.ro._ZTI12BlueRocksEnv[_ZTI12BlueRocksEnv]+0x10): undefined reference to `typeinfo for rocksdb::EnvWrapper' /nix/store/cg0k49h66nkdqx6ccwnqr0i4q0fnfznc-binutils-2.31.1/bin/ld: ../../lib/libos.a(BlueRocksEnv.cc.o):(.data.rel.ro._ZTI23BlueRocksSequentialFile[_ZTI23BlueRocksSequentialFile]+0x10): undefined reference to `typeinfo for rocksdb::SequentialFile' /nix/store/cg0k49h66nkdqx6ccwnqr0i4q0fnfznc-binutils-2.31.1/bin/ld: ../../lib/libos.a(BlueRocksEnv.cc.o):(.data.rel.ro._ZTI25BlueRocksRandomAccessFile[_ZTI25BlueRocksRandomAccessFile]+0x10): undefined reference to `typeinfo for rocksdb::RandomAccessFile' /nix/store/cg0k49h66nkdqx6ccwnqr0i4q0fnfznc-binutils-2.31.1/bin/ld: ../../lib/libos.a(BlueRocksEnv.cc.o):(.data.rel.ro._ZTI21BlueRocksWritableFile[_ZTI21BlueRocksWritableFile]+0x10): undefined reference to `typeinfo for rocksdb::WritableFile' /nix/store/cg0k49h66nkdqx6ccwnqr0i4q0fnfznc-binutils-2.31.1/bin/ld: ../../lib/libos.a(BlueRocksEnv.cc.o):(.data.rel.ro._ZTI17BlueRocksFileLock[_ZTI17BlueRocksFileLock]+0x10): undefined reference to `typeinfo for rocksdb::FileLock' --- pkgs/development/libraries/rocksdb/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/libraries/rocksdb/default.nix b/pkgs/development/libraries/rocksdb/default.nix index d2ea22b85a1..2bb56bec8c0 100644 --- a/pkgs/development/libraries/rocksdb/default.nix +++ b/pkgs/development/libraries/rocksdb/default.nix @@ -30,6 +30,7 @@ stdenv.mkDerivation rec { "-DWITH_ZLIB=1" "-DWITH_ZSTD=1" "-DWITH_GFLAGS=0" + "-DUSE_RTTI=1" (lib.optional (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux") From 05590b3efdc9884de47faaac8db3711103386705 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 11 Nov 2019 00:24:27 +0100 Subject: [PATCH 2/2] ceph: fix build and cleanup expression correct platforms. ceph currently doesn't build on aarch64-linux. So let's not lie in meta.platforms. ceph: fix multiple output We currently just move $out/share/ceph/mgr to $lib/lib/ceph, and then remove all references to $out with a find command. I checked $out, the only reference to $out is in $lib/lib/ceph/libceph-common.so.0, coming from src/common/options.cc: https://github.com/ceph/ceph/blob/master/src/common/options.cc#L5050: > Option("mgr_module_path", Option::TYPE_STR, Option::LEVEL_ADVANCED) > .set_default(CEPH_DATADIR "/mgr") > .add_service("mgr") > .set_description("Filesystem path to manager modules."), Just removing the reference might break some behaviour - it should point to $lib/ceph/mgr instead. We can fix this in a much more elegant fashion by just passing a custom CMAKE_INSTALL_DATADIR to the build system. ceph: fix outdated Boost::python substitutions Instead of substituting in CMakeLists.txt files, one now needs to set MGR_PYTHON_VERSION. ceph: clean up PYTHONPATH wrapping Set `pythonPath` instead of exporting PYTHONPATH. Use `toPythonPath` to construct the PYTHONPATH where we need manual wrapping. There's no ceph-volume, only ceph-mgr. ceph: set doCheck = false explicitly and describe why. ceph: patch more shebangs ceph: use system-provided gtest and rocksdb --- pkgs/tools/filesystems/ceph/default.nix | 35 ++++++++++++------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/pkgs/tools/filesystems/ceph/default.nix b/pkgs/tools/filesystems/ceph/default.nix index 141d21951a8..3066be27772 100644 --- a/pkgs/tools/filesystems/ceph/default.nix +++ b/pkgs/tools/filesystems/ceph/default.nix @@ -6,9 +6,10 @@ , libxml2, zlib, lz4 , openldap, lttng-ust , babeltrace, gperf +, gtest , cunit, snappy , rocksdb, makeWrapper -, leveldb, oathToolkit, removeReferencesTo +, leveldb, oathToolkit # Optional Dependencies , yasm ? null, fcgi ? null, expat ? null @@ -108,14 +109,14 @@ in rec { nativeBuildInputs = [ cmake pkgconfig which git python3Packages.wrapPython makeWrapper + python3Packages.python # for the toPythonPath function (ensureNewerSourcesHook { year = "1980"; }) ]; buildInputs = cryptoLibsMap.${cryptoStr} ++ [ boost ceph-python-env libxml2 optYasm optLibatomic_ops optLibs3 - malloc zlib openldap lttng-ust babeltrace gperf cunit + malloc zlib openldap lttng-ust babeltrace gperf gtest cunit snappy rocksdb lz4 oathToolkit leveldb - removeReferencesTo ] ++ optionals stdenv.isLinux [ linuxHeaders utillinux libuuid udev keyutils optLibaio optLibxfs optZfs # ceph 14 @@ -124,54 +125,52 @@ in rec { optFcgi optExpat optCurl optFuse optLibedit ]; + pythonPath = [ ceph-python-env "${placeholder "out"}/${ceph-python-env.sitePackages}" ]; + preConfigure ='' substituteInPlace src/common/module.c --replace "/sbin/modinfo" "modinfo" substituteInPlace src/common/module.c --replace "/sbin/modprobe" "modprobe" - # Since Boost 1.67 this seems to have changed - substituteInPlace CMakeLists.txt --replace "list(APPEND BOOST_COMPONENTS python)" "list(APPEND BOOST_COMPONENTS python37)" - substituteInPlace src/CMakeLists.txt --replace "Boost::python " "Boost::python37 " # for pybind/rgw to find internal dep export LD_LIBRARY_PATH="$PWD/build/lib:$LD_LIBRARY_PATH" # install target needs to be in PYTHONPATH for "*.pth support" check to succeed - export PYTHONPATH=${ceph-python-env}/lib/python3.7/site-packages:$lib/lib/python3.7/site-packages/:$out/lib/python3.7/site-packages/ - patchShebangs src/spdk + patchShebangs src/script src/spdk src/test src/tools ''; cmakeFlags = [ "-DWITH_PYTHON3=ON" "-DWITH_SYSTEM_ROCKSDB=OFF" + "-DCMAKE_INSTALL_DATADIR=${placeholder "lib"}/lib" + "-DWITH_SYSTEM_BOOST=ON" + "-DWITH_SYSTEM_ROCKSDB=ON" + "-DWITH_SYSTEM_GTEST=ON" + "-DMGR_PYTHON_VERSION=${ceph-python-env.python.pythonVersion}" "-DWITH_SYSTEMD=OFF" "-DWITH_TESTS=OFF" # TODO breaks with sandbox, tries to download stuff with npm "-DWITH_MGR_DASHBOARD_FRONTEND=OFF" ]; - preFixup = '' - find $lib -type f -exec remove-references-to -t $out '{}' + - mv $out/share/ceph/mgr $lib/lib/ceph/ - ''; - postFixup = '' - export PYTHONPATH="${ceph-python-env}/lib/python3.7/site-packages:$lib/lib/ceph/mgr:$out/lib/python3.7/site-packages/" wrapPythonPrograms - wrapProgram $out/bin/ceph-mgr --prefix PYTHONPATH ":" "${ceph-python-env}/lib/python3.7/site-packages:$lib/lib/ceph/mgr:$out/lib/python3.7/site-packages/" - wrapProgram $out/bin/ceph-volume --prefix PYTHONPATH ":" "${ceph-python-env}/lib/python3.7/site-packages:$lib/lib/ceph/mgr:$out/lib/python3.7/site-packages/" + wrapProgram $out/bin/ceph-mgr --prefix PYTHONPATH ":" "$(toPythonPath ${placeholder "out"}):$(toPythonPath ${ceph-python-env})" ''; enableParallelBuilding = true; outputs = [ "out" "lib" "dev" "doc" "man" ]; + doCheck = false; # uses pip to install things from the internet + meta = { homepage = https://ceph.com/; description = "Distributed storage system"; license = with licenses; [ lgpl21 gpl2 bsd3 mit publicDomain ]; maintainers = with maintainers; [ adev ak krav johanot ]; - platforms = platforms.unix; + platforms = [ "x86_64-linux" ]; }; passthru.version = version; @@ -183,7 +182,7 @@ in rec { description = "Tools needed to mount Ceph's RADOS Block Devices"; license = with licenses; [ lgpl21 gpl2 bsd3 mit publicDomain ]; maintainers = with maintainers; [ adev ak johanot krav ]; - platforms = platforms.unix; + platforms = [ "x86_64-linux" ]; }; } '' mkdir -p $out/{bin,etc,lib/python3.7/site-packages}