Much better, thanks.
So here you go, your library compiles fine now. I just did a bit of cleaning and added:
NIX_CFLAGS_COMPILE = [
"-I${python3.pkgs.numpy}/${python3.sitePackages}/numpy/core/include"
];
To fix the error (I’m not sure if there is a cleaner way to solve it, but at least it works).
Then to compile the rest of the library I just added a bunch of needed dependencies and packaged libquicktime as well (no difficulty). Note that it seems like a lot of the library you added are useless (not sure why you added so many libraries, usually when you get an error about a missing library, you can use nix-locate nameofthefile.h
to find the name of the missing library. Anyway, I’ll let you do the cleaning.
gxsm3/default.nix
{ lib, stdenv,
fetchFromGitHub,
gtk3,
pkg-config,
fftw,
pythonSupport ? false,
python3,
gnome2,
autoconf, libtool, automake, fetchpatch,
openexrSupport ? true, openexr,
libzipSupport ? true, libzip,
libwebpSupport ? true, libwebp,
# libXmu is not used if libunique is.
libXmuSupport ? false, xorg,
libxsltSupport ? true, libxslt,
fitsSupport ? true, cfitsio,
zlibSupport ? true, zlib,
libuniqueSupport ? true, libunique,
libpngSupport ? true, libpng,
openglSupport ? !stdenv.isDarwin,
intltool,
libxml2,
gtksourceview,
bison,
hostname,
libsoup,
yelp-tools,
libglvnd,
icu,
itstool,
glm,
freeglut, libGLU, libGL,
glew,
gsl,
nettools,
netcdf,
# netcdfcxx4,
netcdfcxx4-legacy,
libquicktime,
opencv2,
glibc, # Or error on ld: cannot find -lnlopt: No such file or directory. https://unix.stackexchange.com/questions/371050/ld-cannot-find-lc-on-nixos
nlopt, # or errors on ld: cannot find -lnlopt
popt,
}:
stdenv.mkDerivation rec {
# hardeningDisable = [ "all" ];
pname = "gxsm3";
version = "3.0.2";
src = fetchFromGitHub {
owner= "StefanSchroeder";
repo= "Gxsm3";
rev ="a5b3c2ec8629bf9e9927f103b7c5cb89c9fbba6a";
sha256= "gxaT+qIoPYWsTqALmKiMOxs55+qeNfHSEwSO7eFVvoU=";
};
nativeBuildInputs = [
pkg-config
autoconf
automake
# glibc.static
bison
];
dontDisableStatic = true;
# configurePlatforms = [ "build" "host" "target" ];
postPatch = ''
# Or we get an error:
# error: format not a string literal and no format arguments [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wformat-security-Werror=format-security8;;]
substituteInPlace gxsm3/app_view.C --replace "g_message (line);" 'g_message ("%s", line);'
'';
buildInputs = with lib;
[
gsl
icu
glm
freeglut
libGLU
libGL
glew
gtk3
fftw
autoconf
libxml2
libxml2
gtksourceview
libsoup
intltool
libtool
libxml2
yelp-tools
itstool
libglvnd
nettools
icu
netcdf
# netcdfcxx4
netcdfcxx4-legacy
libquicktime
opencv2.dev
nlopt
popt
] ++
optional openglSupport gnome2.gtkglext ++
# optional openexrSupport openexr ++
optional libXmuSupport xorg.libXmu ++
optional fitsSupport cfitsio ++
optional libpngSupport libpng ++
optional libxsltSupport libxslt ++
# optional libwebpSupport libwebp ++
optional zlibSupport zlib ++
optional libuniqueSupport libunique ++
optional libzipSupport libzip;
propagatedBuildInputs = with python3.pkgs; [
pygobject3
numpy
pybind11
];
doCheck = false;
NIX_CFLAGS_COMPILE = [
"-I${python3.pkgs.numpy}/${python3.sitePackages}/numpy/core/include"
];
preConfigure = ''
./autogen.sh
'';
meta = {
homepage = "https://sourceforge.net/projects/gxsm/";
description = "Scanning probe microscopy control and analysis";
longDescription = ''
GXSM -- Gnome X Scanning Microscopy: A multi-channel image and
vector-probe data acquisition and visualization system designed for
SPM techniques (STM,AFM..), but also SPA-LEED/LEED/LEEM data analysis.
A plug-in interface allows any user add-on data-processing and special
hardware and instrument support. Latest: NC-AFM and related
explorative methods as SQDM can be configured. High-Speed external
PAC-PLL hardware option with digital DSP link.
'';
license = lib.licenses.gpl2;
platforms = with lib.platforms; linux ++ darwin;
maintainers = [ lib.maintainers.todo ];
# never built on aarch64-darwin since first introduction in nixpkgs
broken = stdenv.isDarwin && stdenv.isAarch64;
};
}
libquicktime/default.nix
{
lib,
stdenv,
fetchurl,
doxygen,
zlib,
}:
stdenv.mkDerivation rec {
pname = "libquicktime";
version = "1.2.4";
src = fetchurl {
url = "mirror://sourceforge/${pname}/${pname}/${version}/${pname}-${version}.tar.gz";
sha256 = "HFM1nDOzE0e017ANNhFGP+XpQsrj7A/v4NL9QT/Uc2g=";
};
buildInputs = [
doxygen
zlib
];
}
netcdf-cxx4-legacy/default.nix
:
{ lib, stdenv, fetchurl, netcdf, hdf5, curl }:
stdenv.mkDerivation rec {
pname = "netcdf-cxx4-legacy";
version = "4.2";
src = fetchurl {
url = "https://downloads.unidata.ucar.edu/netcdf-cxx/4.2/netcdf-cxx-4.2.tar.gz";
sha512 = "11ycy7x3j12f5ba7y4pnw6zwpfxq7jsp14a8rwgdadkp80jwpvplr56r7sn6c63xmapr3x8qdgjhvhlwm176hb9in38c8dc332xnz9l";
};
buildInputs = [ netcdf hdf5 curl ];
doCheck = false;
enableParallelChecking = false;
meta = {
description = "C++ API to manipulate netcdf files";
homepage = "https://www.unidata.ucar.edu/software/netcdf/";
license = lib.licenses.free;
platforms = lib.platforms.unix;
};
}
default.nix
{ pkgs ? import <nixpkgs> {} }:
let
netcdfcxx4-legacy = pkgs.callPackage ./netcdf-cxx4-legacy/default.nix {};
libquicktime = pkgs.callPackage ./libquicktime {};
gxsm3 = pkgs.callPackage ./gxsm3/default.nix { inherit netcdfcxx4-legacy libquicktime; };
in gxsm3
Compile with nix-build