Carrot
November 16, 2024, 7:05pm
1
Hi all
I could use some help/tips.
So far I’ve tried a few thing but haven’t gotten far.
I also tried to use the SQLite driver to access the OpenEdge db, which seemed to function, but failed with my basic test sql queries.
The data I’m interested in to visualize on my dashboard is in someone else’s db(Progress OpenEdge). They told me the only way I can access it, is through odbc. And they gave me credentials.
I want to add a odbc driver to unixODBCDrivers for a progress openedge database.
I found 2 archives, each could be ‘the thing’, but I’m in over my head.
I started with :
{ fetchurl, stdenv, unixODBC, cmake, mariadb, sqlite, zlib, libxml2, dpkg, lib, openssl, libkrb5, libuuid, patchelf, libiconv, fixDarwinDylibNames, fetchFromGitHub, psqlodbc }:
# Each of these ODBC drivers can be configured in your odbcinst.ini file using
# the various passthru and meta values. Of note are:
#
# * `passthru.fancyName`, the typical name used to reference the driver
# * `passthru.driver`, the path to the driver within the built package
# * `meta.description`, a short description of the ODBC driver
#
# For example, you might generate it as follows:
#
# ''
# [${package.fancyName}]
# Description = ${package.meta.description}
# Driver = ${package}/${package.driver}
# ''
{
psql = psqlodbc.override { withUnixODBC = true; withLibiodbc = false; };
This file has been truncated. show original
and:
I’m currently trying to connect to an ODBC datasource with a database driver that was compiled for CentOS. The same driver is also working on Ubuntu, so I assume that it should also work on NixOS.
In reality the driver will not even start claiming “No such file or directory”, even though the driver file is obviously present.
Also, I read that this type of error is common, when shared libraries are missing. For me this makes sense, since there are no standard Unix paths in NixOS. So: Is it poss…
Is there anything else I should look at?
download archives
first archive: PROGRESS_DATADIRECT_ODBC_OPENEDGE_LINUX_64.tgz
> tree
DriverModules
├── PROGRESS_DATADIRECT_ODBC_COMMON_8.0.0_LINUX_64_INSTALL.iam.zip
├── PROGRESS_DATADIRECT_ODBC_DM_8.0.0_LINUX_64_INSTALL.iam.zip
├── PROGRESS_DATADIRECT_ODBC_OPENEDGE_8.0.2_LINUX_64_INSTALL.iam.zip
└── PROGRESS_DATADIRECT_ODBC_OPENSSL_8.0.0_LINUX_64_INSTALL.iam.zip
PROGRESS_DATADIRECT_ODBC_8.0_LINUX_64_INSTALL.bin
second archive: PROGRESS_OE_12.2_LNX_64_SQLCLIENTACCESS.tar.gz
> tree
├── common
├── dbtools
├── icupsc
├── installd.ini
├── install.tab
├── inst_hlp
├── intlsets.txt
├── itermcap
├── JavaVersion.ini
├── juniper
├── JvmProperties.class
├── namesvr
├── _ovrly
├── perl
├── pmame
├── progress.cfg
├── proinst
├── proupdt
├── secclnt
├── seccmn
├── sqlcom
├── sqljdbc
├── sqlodbc
└── wscmn
Carrot
November 17, 2024, 11:25pm
2
When I build it without the mkdir
line it seems to work.
As soon as I uncomment the mkdir
line it get the following error:
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
variable $src or $srcs should point to the source
As I understand it, the unpackPhase
was working before. But doesn’t anymore as soon as I use mkdir
in the installPhase
?
{
lib,
stdenv,
writeTextDir,
autoPatchelfHook,
unixODBC,
jdk11,
gnutar,
tree,
makeWrapper,
which,
zlib,
libGL,
glib,
xorg,
libxkbcommon,
xdg-utils,
libXrender,
fontconfig,
freetype,
systemd,
libpulseaudio,
cairo,
gdk-pixbuf,
gtk3,
pixman,
}:
let
unixodbc-progress-openedge = stdenv.mkDerivation rec {
pname = "unixodbc-progress-openedge";
version = "12.2";
src = ./PROGRESS_OE_12.2_LNX_64_SQLCLIENTACCESS.tar.gz;
# Work around the "unpacker appears to have produced no directories"
# case that happens when the archive doesn't have a subdirectory.
sourceRoot = ".";
nativeBuildInputs = [
autoPatchelfHook
jdk11 # necessary for the installer (./proinst)
gnutar
makeWrapper
which
xdg-utils
];
buildInputs = [
unixODBC
# zlib
];
installPhase = ''
# echo "---installPhase---"
runHook preInstall
# echo "-- pname: $pname"
# echo "-- src: ${src}"
# echo "-- out: $out"
# echo "-- ls:"
# ls
# echo "-- tree:"
# tree
# echo "-- pwd:"
# pwd
################### This Line
# mkdir -p $out/bin
# echo "-- proinst 11"
# ./proinst
# # A version of progress.cfg has been detected in your current
# # working directory. You may not run this installation from a
# # directory containing a Progress installation. Change to another
# # directory and type /build/proinst to start the installation.
# echo "-- proinst 22"
# runHook postInstall
'';
# # move libraries to $out/lib where they're expected to be
# postInstall = ''
# echo "- - - ls out"
# ls $out
# mkdir -p "$out/lib"
# mv "$out"/*.* "$out/lib"
# '';
# # see the top of the file for an explanation
# passthru = {
# fancyName = "Progress";
# driver = "lib/sqlodbc";
# };
meta = with lib; {
description = "ODBC driver for Progress OpenEdge";
homepage = "http://progress.com";
license = licenses.unfree;
platforms = platforms.linux;
};
};
in
stdenv.mkDerivation {
name = "project-depending-on-unixodbc-progress-openedge";
buildInputs = [
unixodbc-progress-openedge
];
nativeBuildInputs = [
unixODBC
];
# shellHook =
# let
# ODBCINI = writeTextDir "odbc.ini" ''
# [unixodbc-progress-openedge]
# Description = unixodbc-progress-openedge
# Driver = ${unixodbc-progress-openedge}/lib/libirisodbc35.so
# '';
# in
# ''
# export ODBCINI=${ODBCINI}/odbc.ini
# '';
}
Carrot
December 6, 2024, 7:07pm
3
When I run the install script (proinst) during the installPhase I get an error that another file it launches isn’t found. But it should be there?
What am I missing?
{
lib,
stdenv,
# fetchurl,
writeTextDir,
autoPatchelfHook,
unixODBC,
jdk11,
gnutar,
tree,
makeWrapper,
which,
zlib,
libGL,
glib,
xorg,
libxkbcommon,
xdg-utils,
libXrender,
fontconfig,
freetype,
systemd,
libpulseaudio,
cairo,
gdk-pixbuf,
gtk3,
pixman,
# For glewinfo
libXmu,
libXi,
libXext,
}:
# # Run during testing:
# nix build .#unixodbc-progress-openedge
# nix build .#unixodbc-progress-openedge -L
let
# proinst: run script to install, will ask to enter codes and date/time info
unixodbc-progress-openedge = stdenv.mkDerivation rec {
pname = "unixodbc-progress-openedge";
version = "12.2";
src = ./PROGRESS_OE_12.2_LNX_64_SQLCLIENTACCESS.tar.gz;
# Work around the "unpacker appears to have produced no directories"
# case that happens when the archive doesn't have a subdirectory.
sourceRoot = ".";
nativeBuildInputs = [
autoPatchelfHook
jdk11 # necessary for the installer (./proinst)
gnutar
tree
makeWrapper
which
xdg-utils
];
buildInputs = [
unixODBC
# zlib
];
# configureFlags = [
# "--with-odbc=${unixODBC}"
# "--with-sqlite3=${sqlite.dev}"
# ];
# installTargets = [ "install-3" ];
dontBuild = true;
configureFlags = [
# "--with-x"
# "--enable-frills"
# "--enable-xft"
# "--enable-xim"
"--with-term=xterm"
# "--with-max-profiles=100"
# "--with-max-term=100"
# "--with-save-lines=10000"
];
installPhase = ''
echo "---installPhase---"
# runHook preInstall
# echo "-- pname: $pname"
# echo "-- src: ${src}"
# echo "-- out: $out"
# echo "-- ls:"
# ls
# echo "-- tree:"
# tree
# echo "-- pwd:"
# pwd
# echo "-- ls /:"
# ls /
# echo "-- java version:"
# java --version
mkdir -p $out/bin
echo -e " -- tree out/bin before: `tree $out/bin`\n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
mv * "$out"/bin/
echo -e " -- tree out/bin after: `tree $out/bin`\n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
# cp * "$out"/bin/
# mv $out/* $out/
# mv JvmProperties.class icupsc itermcap progress.cfg sqlcom $out
# echo "-- ls:"
# ls
# echo "-- ls out:"
# ls $out
echo " -- TERM before: -$TERM-"
export TERM=xterm
echo " -- TERM after: -$TERM-"
# mkdir -p $out/test
# cd $out/test
echo " - - - - run PROINST"
$out/bin/proinst
# $out/lib/proinst
'';
# # move libraries to $out/lib where they're expected to be
# postInstall = ''
# echo "- - - ls out"
# ls $out
# mkdir -p "$out/lib"
# mv "$out"/*.* "$out/lib"
# '';
# # see the top of the file for an explanation
# passthru = {
# fancyName = "Progress";
# driver = "lib/sqlodbc";
# };
meta = with lib; {
description = "ODBC driver for Progress OpenEdge";
homepage = "http://progress.com";
license = licenses.unfree;
platforms = platforms.linux;
};
};
in
stdenv.mkDerivation {
name = "project-depending-on-unixodbc-progress-openedge";
buildInputs = [
unixodbc-progress-openedge
];
nativeBuildInputs = [
unixODBC
];
# shellHook =
# let
# ODBCINI = writeTextDir "odbc.ini" ''
# [unixodbc-progress-openedge]
# Description = unixodbc-progress-openedge
# Driver = ${unixodbc-progress-openedge}/lib/libirisodbc35.so
# '';
# in
# ''
# export ODBCINI=${ODBCINI}/odbc.ini
# '';
}
❯ nix build .#unixodbc-progress-openedge -L
unixodbc-progress-openedge> Running phase: unpackPhase
unixodbc-progress-openedge> unpacking source archive /nix/store/0m9cnmz8r3x2f393jf968qag6vq2p7n2-PROGRESS_OE_12.2_LNX_64_SQLCLIENTACCESS.tar.gz
unixodbc-progress-openedge> source root is .
unixodbc-progress-openedge> setting SOURCE_DATE_EPOCH to timestamp 1584485398 of file ./wscmn
unixodbc-progress-openedge> Running phase: patchPhase
unixodbc-progress-openedge> Running phase: updateAutotoolsGnuConfigScriptsPhase
unixodbc-progress-openedge> Running phase: configurePhase
unixodbc-progress-openedge> no configure script, doing nothing
unixodbc-progress-openedge> Running phase: installPhase
unixodbc-progress-openedge> ---installPhase---
unixodbc-progress-openedge> -- tree out/bin BEFORE: /nix/store/h7rvd3g0hzcbw6d078llys59fmy867rl-unixodbc-progress-openedge-12.2/bin
unixodbc-progress-openedge> 0 directories, 0 files
unixodbc-progress-openedge> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unixodbc-progress-openedge> -- tree out/bin AFTER: /nix/store/h7rvd3g0hzcbw6d078llys59fmy867rl-unixodbc-progress-openedge-12.2/bin
unixodbc-progress-openedge> |-- JavaVersion.ini
unixodbc-progress-openedge> |-- JvmProperties.class
unixodbc-progress-openedge> |-- _ovrly
unixodbc-progress-openedge> |-- common
unixodbc-progress-openedge> |-- dbtools
unixodbc-progress-openedge> |-- env-vars
unixodbc-progress-openedge> |-- icupsc
unixodbc-progress-openedge> |-- inst_hlp
unixodbc-progress-openedge> |-- install.tab
unixodbc-progress-openedge> |-- installd.ini
unixodbc-progress-openedge> |-- intlsets.txt
unixodbc-progress-openedge> |-- itermcap
unixodbc-progress-openedge> |-- juniper
unixodbc-progress-openedge> |-- namesvr
unixodbc-progress-openedge> |-- perl
unixodbc-progress-openedge> |-- pmame
unixodbc-progress-openedge> |-- progress.cfg
unixodbc-progress-openedge> |-- proinst
unixodbc-progress-openedge> |-- proupdt
unixodbc-progress-openedge> |-- secclnt
unixodbc-progress-openedge> |-- seccmn
unixodbc-progress-openedge> |-- sqlcom
unixodbc-progress-openedge> |-- sqljdbc
unixodbc-progress-openedge> |-- sqlodbc
unixodbc-progress-openedge> `-- wscmn
unixodbc-progress-openedge> 1 directory, 25 files
unixodbc-progress-openedge> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unixodbc-progress-openedge> -- TERM before: -xterm-256color-
unixodbc-progress-openedge> -- TERM after: -xterm-
unixodbc-progress-openedge> - - - - run PROINST
unixodbc-progress-openedge> /nix/store/h7rvd3g0hzcbw6d078llys59fmy867rl-unixodbc-progress-openedge-12.2/bin/proinst: line 105: /nix/store/h7rvd3g0hzcbw6d078llys59fmy867rl-unixodbc-progress-openedge-12.2/bin/_ovrly: not found
unixodbc-progress-openedge> Cleaning up temporary files...
Carrot
December 6, 2024, 9:12pm
4
{
lib,
stdenv,
autoPatchelfHook,
unixODBC,
jdk11,
gnutar,
tree,
makeWrapper,
which,
xdg-utils,
}:
# # Run during testing:
# nix build .#unixodbc-progress-openedge -L
let
# proinst: run script to install, will ask to enter codes and date/time info
unixodbc-progress-openedge = stdenv.mkDerivation rec {
pname = "unixodbc-progress-openedge";
version = "12.2";
src = ./PROGRESS_OE_12.2_LNX_64_SQLCLIENTACCESS.tar.gz;
# Work around the "unpacker appears to have produced no directories"
# case that happens when the archive doesn't have a subdirectory.
sourceRoot = ".";
nativeBuildInputs = [
autoPatchelfHook
jdk11 # necessary for the installer (./proinst)
gnutar
tree
makeWrapper
which
xdg-utils
];
buildInputs = [
unixODBC
stdenv.cc.cc
# zlib
];
dontBuild = true;
configureFlags = [
# "--with-x"
# "--enable-frills"
# "--enable-xft"
# "--enable-xim"
"--with-term=xterm"
# "--with-max-profiles=100"
# "--with-max-term=100"
# "--with-save-lines=10000"
];
installPhase = ''
echo "---installPhase---"
runHook preInstall
# echo " -- pname: *$pname*"
# echo " -- src: *${src}*"
# echo " -- out: *$out*"
# echo -e " -- ls: *`ls`\n * * * * * * * * * * * * * * * * * *"
# echo -e " -- tree: *`tree`\n * * * * * * * * * * * * * * * * * *"
# echo -e " -- tree out/bin: `tree $out/bin`\n * * * * * * * * * * * * * * * * * *"
# echo -e " -- tree out/lib: `tree $out/lib`\n * * * * * * * * * * * * * * * * * *"
# echo " -- pwd: *`pwd`*"
# echo -e " -- ls /: *`ls /`\n * * * * * * * * * * * * * * * * * *"
# echo -e " -- java version: *`java --version`\n * * * * * * * * * * * * * * * * * *"
mkdir -p $out/lib
mv JavaVersion.ini JvmProperties.class common dbtools env-vars icupsc inst_hlp install.tab installd.ini intlsets.txt itermcap juniper namesvr perl pmame progress.cfg proinst proupdt secclnt seccmn sqlcom sqljdbc sqlodbc wscmn $out/lib
mv _ovrly $out/lib
# install -v -m755 _ovrly $out/lib/_ovrly
# patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/lib/_ovrly
# echo -e " -- tree out/lib: `tree $out/lib`\n * * * * * * * * * * * * * * * * * *"
# addAutoPatchelfSearchPath $out/lib
echo " -- TERM before: *$TERM*"
export TERM=xterm
echo " -- TERM after: *$TERM*"
echo " - - - - run PROINST"
$out/lib/proinst $out/lib/
echo " - - - - run PROINST END END END"
runHook postInstall
'';
meta = with lib; {
description = "ODBC driver for Progress OpenEdge";
homepage = "http://progress.com";
license = licenses.unfree;
platforms = platforms.linux;
};
};
in
stdenv.mkDerivation {
name = "project-depending-on-unixodbc-progress-openedge";
buildInputs = [
unixodbc-progress-openedge
];
nativeBuildInputs = [
unixODBC
];
}
❯ nix build .#unixodbc-progress-openedge -L
unixodbc-progress-openedge> Running phase: unpackPhase
unixodbc-progress-openedge> unpacking source archive /nix/store/0m9cnmz8r3x2f393jf968qag6vq2p7n2-PROGRESS_OE_12.2_LNX_64_SQLCLIENTACCESS.tar.gz
unixodbc-progress-openedge> source root is .
unixodbc-progress-openedge> setting SOURCE_DATE_EPOCH to timestamp 1584485398 of file ./wscmn
unixodbc-progress-openedge> Running phase: patchPhase
unixodbc-progress-openedge> Running phase: updateAutotoolsGnuConfigScriptsPhase
unixodbc-progress-openedge> Running phase: configurePhase
unixodbc-progress-openedge> no configure script, doing nothing
unixodbc-progress-openedge> Running phase: installPhase
unixodbc-progress-openedge> ---installPhase---
unixodbc-progress-openedge> -- TERM before: *xterm-256color*
unixodbc-progress-openedge> -- TERM after: *xterm*
unixodbc-progress-openedge> - - - - run PROINST
unixodbc-progress-openedge> /nix/store/b5h892kxyaval8kwp3x33mcs3vnc1gcx-unixodbc-progress-openedge-12.2/lib/proinst: line 105: /nix/store/b5h892kxyaval8kwp3x33mcs3vnc1gcx-unixodbc-progress-openedge-12.2/lib/_ovrly: not found
You should move the proinst stuff into something that runs after the fixup phase, which is what patches script shebangs and library paths in binaries (those are causing the most recent problem you’re encountering). I don’t know what the proinst
command does, but if it modifies the installation it should also go in the fixup phase—this is tricky, because it needs to run after the other fixup hooks that run in postFixup
, and that won’t happen if you just use a postFixup
Nix attribute. But you can do it by manipulating the postFixupHooks
array yourself, like this:
postHook = ''
function runProinst {
echo " -- TERM before: *$TERM*"
export TERM=xterm
echo " -- TERM after: *$TERM*"
echo " - - - - run PROINST"
$out/lib/proinst $out/lib/
echo " - - - - run PROINST END END END"
}
postFixupHooks+=(runProinst)
'';
(Or, instead, you could run autoPatchelf
and patchShebangs
manually in whatever phase you want. I think that’s a little hackier, though.)
Carrot
December 6, 2024, 11:00pm
6
As I understand, proinst is a shell script which calls a binary (_ovrly).
I was told on other Linux distributions it would be an install procedure which asks for a date, time, serialnumber.
Currently I see it stays at the fixupPhase.
I’ll try to install it on Fedora and see it for myself.
Carrot:
asks for a date, time, serialnumber.
Currently I see it stays at the fixupPhase.
Hmm, it might be waiting for an input in that case. Is there a way to provide the required data to the script via the derivation? It won’t be able to access the TTY to ask you for them.
Carrot
December 10, 2024, 6:06pm
8
solved using the tips in other thread