Request for apophenia in manjaro repostiory


#1

Using pacman and yaourt I couldn’t find the package apophenia. This package is a library for dealing with materix, vectors, and databases in C. One can use this library for statistical analysis in C. (http://apophenia.info/)

It would be great if one could add a package of the library to the repository.


#2

i’ve moved this post to the package request category.


#3

beat me to it, i also edited the title @nownuri . you should present a description of what apophenia is in your original post and why it should be added.


#4

theres a github page for apophenia that seems easy enough to to install.


in terminal:
sudo pacman -S make gcc gsl sqlite git
git clone https://github.com/b-k/Apophenia.git
cd Apophenia
git checkout pkg
./configure
make
sudo make install


#5

Looks like it wouldnt be too hard to write an AUR package for it :

@dglt BAH :persevere:

Well anyhoo … this line is enjoyable:

PS: Lawyers, please note that a file named COPYING in the install/ directory describes how this package is licensed under GPLv2.


#6

great minds think alike :roll_eyes:


#7

Something like this might work … I’m away from home, so maybe someone wants to give it a shot

Instructions:

(as with all AUR things we assume you have base-devel installed)

mkdir -p ~/.builds/apophenia && cd ~/.builds/apophenia

nano PKGBUILD

And put this in it:

PKGBUILD
# Maintainer: cscs
# Good Luck

pkgname=apophenia
_gitname=apophenia
pkgver=1.0
pkgrel=1
pkgdesc="An open statistical library for working with data sets and statistical or simulation models"
arch=('any')
url="https://github.com/b-k/apophenia"
license=('GPL3')
depends=('sqlite' 'gsl')
#optdepends=()
makedepends=('git' 'make')
#conflicts=()
source=("git+${url}.git")
sha256sums=('SKIP')

build() {
  cd ${srcdir}/${_gitname}
  ./configure
  cd ${srcdir}/${_gitname}/${_gitname}-${pkgver}
  make 
}

package() {
  make -C ${srcdir}/${_gitname}/${_gitname}-${pkgver} DESTDIR=${pkgdir}/ install
}

Save and exit with Ctrl+X

makepkg -sri


#8

What’s the point of using _gitname when it’s the same as the pkgname?


#9

If it wouldnt stay the same.
For example this is just a test, and while gitname will be static, maybe if this moves to AUR it would be apophenia-stable apophenia-git and so on. So the package name can change without touching the rest of the (albeit very short) code.
[besides it was already there from the last pkgbuild I had made :wink:]


#10

Hmm, yes. Future-proofing, I see. Good show, old chap.

(I was just watching Doctor Who, so you’ll have to read that in William Hartnell’s voice :smile:).


#12

sorry i cant help more, but i dont even know what that program does. links on that github link may help.

∙ Find detailed setup instructions and some troubleshooting notes at
http://apophenia.info/setup.html .


#13

in terminal:
sudo pacman -S make gcc gsl sqlite git
git clone https://github.com/b-k/Apophenia.git
cd Apophenia
git checkout pkg
./configure
make
sudo make install

I tried the above before posting this request. After the ‘sudo make install’, when a program using the library is compiled and runs, then the following error occurs.
‘error while loading shared libraries: libapophenia.so.2: cannot open shared object file: No such file or directory’
The file libapophenia.so was found in my /usr/local/lib but was not recognized properly. I thought this has something to do with environmental variable setting or the path wherhe the so files are copied. In addition, I tried installing the library in home directory as explained in the readme file, but the target directory was not set with ‘cofigure’


#14

Please attempt to undo what you’ve done, then go back to my instructions above. I had a missing piece before, but I edited and it should work now - it just successfully installed on my system.

[I have no way of testing it or anything but here it is:]

image

If a number of people confirm it works well, we can move to submitting it to the AUR so others can use it easily too.


#15

executable files are installed but the libraries are not. Can you please try compiling the following example program?

#include <apop.h>
//Your processes are probably a bit more complex.
double process_one(gsl_rng *r){
    return gsl_rng_uniform(r) * gsl_rng_uniform(r) ;
}
double process_two(gsl_rng *r){
    return gsl_rng_uniform(r);
}
int main(){
    gsl_rng *r = apop_rng_alloc(123);
    //create the database and the data table.
    apop_db_open("runs.db");
    apop_table_exists("samples", 'd'); //If the table already exists, delete it.
    apop_query("create table samples(iteration, process, value); begin;");
    //populate the data table with runs.
    for (int i=0; i<1000; i++){
        double p1 = process_one(r);
        double p2 = process_two(r);
        apop_query("insert into samples values(%i, %i, %g);", i, 1, p1);
        apop_query("insert into samples values(%i, %i, %g);", i, 2, p2);
    }
    apop_query("commit;"); //the begin-commit wrapper saves writes to the drive.
    //pull the data from the database, converting it into a table along the way. 
    apop_data *m  = apop_db_to_crosstab("samples", "iteration","process", "value");
    gsl_vector *v1 = Apop_cv(m, 0); //get vector views of the two table columns.
    gsl_vector *v2 = Apop_cv(m, 1);
    //Output a table of means/variances, and t-test results.
    printf("\t   mean\t\t   var\n");
    printf("process 1: %f\t%f\n", apop_mean(v1), apop_var(v1));
    printf("process 2: %f\t%f\n\n", apop_mean(v2), apop_var(v2));
    printf("t test\n");
    apop_data_show(apop_t_test(v1, v2));
    apop_data_print(m, "the_data.txt");
}

For compilation you need the following options.

-lapophenia -lgsl -lgslcblas -lsqlite3

#16

oh, you just mean use it as a makefile…mk. I see what you mean.


#17

I usually use a makefile but for a test using gcc command with those cflags would be sufficient. I think this installation procedure should include a way of setting environmental variables. I managed to do it on Ubunto, but not on Majaro yet. Strangely, ./configure --target=path does not work either on Manjaro, so one cannot point a target non-root directory.


#18

I think thats the issue I’m running into. I’m pretty sure I’ve follwoed the build instructions they give … but I’m always ending up in the same spot with a few executables and like 3 libs. I see it compile all the other libs … but they dont want to go anywhere. :thinking:
[I thought I fixed the pkgbuild … but no, and tried a few ways…]
@Lolix if you have some spare time could you give us/me some pointers here?


#19

I’m tired so I’ll be terse


I’ve got to build the package, somewhat, docs and examples seems that need to be installed manually. I found some things quirky for packaging

Program is compiled with prefix /usr/local (should be avoided, Arch guidelines) instead of /usr, can be this the issue? Can it be modified passing --help to ./configure is ignored

It is packaged for Debian and Ubuntu and there are some patches

$ gcc -o apo apo.c -lapophenia -lgsl -lgslcblas -lsqlite3

$ l
totale 24
-rwxr-xr-x 1 fabio fabio 17560 22 gen 23.32 apo
-rw-r–r-- 1 fabio fabio 1497 22 gen 23.31 apo.c

$ ./apo
./apo: error while loading shared libraries: libapophenia.so.2: cannot open shared object file: No such file or directory

$ ldd apo
linux-vdso.so.1 (0x00007ffd1c9c6000)
libapophenia.so.2 => not found
libgsl.so.23 => /usr/lib/libgsl.so.23 (0x00007f6d09895000)
libgslcblas.so.0 => /usr/lib/libgslcblas.so.0 (0x00007f6d09656000)
libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x00007f6d09530000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f6d0936c000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f6d091e7000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f6d091e0000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007f6d08fc9000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f6d08fa8000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6d09d64000)

$ sudo updatedb
$ locate libapophenia.so.2
/usr/local/lib/libapophenia.so.2
/usr/local/lib/libapophenia.so.2.0.0

$ LD_PRELOAD=/usr/local/lib/libapophenia.so.2 /home/fabio/Dev/pkg_make/NOT/apo
	   mean		   var
process 1: 0.259623	0.051570
process 2: 0.497805	0.083759

t test
1st avg: 0.259623; 1st std dev: 0.227089; 1st count: 1000.
2st avg: 0.497805; 2st std dev: 0.289412; 2nd count: 1000.
t-statistic: -20.4642.
  mean left - right   -0.238181
        t statistic    -20.4642
                 df        1998
    p value, 1 tail 5.89207e-85
 confidence, 1 tail           1
    p value, 2 tail           0
 confidence, 2 tail           1

Any ideas?


#20

I’m sorry that the source code configuration is not compatible with Manjaro. So it would be difficult to install the library using yaourt?


#21

is generally recommended not to use yaourt as not fully supported anymore
yay or trizen is usually suggested for KDE


Manjaro WiFi switch disappeared after installation of yaourt