LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-08-2016, 05:48 AM   #1
rdx
Member
 
Registered: Apr 2007
Location: Dallas
Distribution: Slackware64 14.2
Posts: 283

Rep: Reputation: 25
How do you use ALGLIB?


I wanted elliptic integrals, complete 1st and 2nd kind. Ultimately I found an algorithm for the 1st kind using agm and very slick. I am still trying to get the 2nd kind. I would love a good algorithm but Wikipedia failed me there. I tried to install BOOST and I can't figure out how to use it. Now I'm trying to use ALGLIB but no luck so far.

The docs say using ALGLIB is so simple there is no need for a makefile or other guidance. But when I try to compile, there are loads of undefined stuff, apparently missing libraries. All in all it's a pain.

Does anyone know how to use ALGLIB? I'd love a few hints. Thanks.
 
Old 11-08-2016, 06:38 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,140
Blog Entries: 4

Rep: Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227
What are the commands that you are using to compile and link the program?

How is ALGLIB supplied? As an .so file? As a .lib?

What instructions are you referring to?

Superficially, it sounds to me like you are not actually referencing the library when you link your program after compiling its parts.
 
Old 11-16-2016, 09:02 AM   #3
rdx
Member
 
Registered: Apr 2007
Location: Dallas
Distribution: Slackware64 14.2
Posts: 283

Original Poster
Rep: Reputation: 25
Ok, ALGLIB comes as alglib-3.10.0.cpp.gpl.tgz which expands o a directory tree, the meat of which is a collection of .h and .cpp files. These cpp files readily compile to .o files but after that, I have no idea. There is no Makefile to construct a .a or .so nor even hints about where these files should go. I'm guessing the .h go to /usr/local/include and that seems to work OK, the problem comes when there are oodles of unresolved references at link time.
 
Old 11-16-2016, 11:13 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,140
Blog Entries: 4

Rep: Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227Reputation: 3227
There are many tutorials that show how to use static libraries with gcc. Here's one:

http://www.network-theory.co.uk/docs...cintro_25.html
 
Old 11-16-2016, 12:16 PM   #5
rdx
Member
 
Registered: Apr 2007
Location: Dallas
Distribution: Slackware64 14.2
Posts: 283

Original Poster
Rep: Reputation: 25
OK, the plot thickens. Obviously something was missing. I searched all over to no avail. Then I have the idea to DL the python version to see how it worked and guess what! It included another directory with the missing lib sources AND a build_unix script. I ran it and got a alglib.so out of it. I moved that file to /usr/local/lib and added a -lalglib to the compile line. The new problem is "cannot find -lalglib. I thought the -L flag would do it but no luck.
 
Old 11-16-2016, 04:43 PM   #6
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
According to the docs you don't need a library. You could just copy the .h and .cpp files you need into your project tree. http://www.alglib.net/translator/man...l#gs_compiling

I successfully compiled one of the test programs using the following command:
Code:
~/alglib/cpp/tests$ g++ -I../src test_c.cpp ../src/*.cpp
HTH
 
1 members found this post helpful.
Old 11-16-2016, 05:02 PM   #7
rdx
Member
 
Registered: Apr 2007
Location: Dallas
Distribution: Slackware64 14.2
Posts: 283

Original Poster
Rep: Reputation: 25
WOW, you're right, that does work. It works for test_i too but fails on test_x. It seems that this is a collection of source routines rather than a library. In fact, to get what I want from it (complete elliptic integrals) all I need is two functions, easily copied and used as C/C++. It's not what I expected but I'm going to declare it PROBLEM SOLVED. Thanks.
 
Old 11-16-2016, 05:34 PM   #8
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
You're welcome.

To compile test_x.cpp you need to define AE_USE_ALLOC_COUNTER and AE_DEBUG4POSIX:
Code:
g++ -I../src test_x.cpp -DAE_USE_ALLOC_COUNTER -DAE_DEBUG4POSIX ../src/*.cpp
From ap.cpp:
Code:
#ifdef AE_DEBUG4POSIX
#include <sys/time.h>
int _tickcount()
{
    ...
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration