[help] taucs on linux

149 views
Skip to first unread message

isaac

unread,
Feb 3, 2009, 8:49:42 PM2/3/09
to matrixprogramming
Dear matrixprogramming group members:

I've been trying to get taucs working with c++ under linux without
success, so i thought i'll seek for help here ...

i followed
http://matrixprogramming.com/TAUCS/

everything went sucessfully (except i had to remove "treat warning as
error")
and the command

./bin/linux/direct -mesh2d 400 -log stdout -snmf

seems to work fine.


However when i tried the next step with cl (not sure what this is, but
i substituted it with g++)

g++ -Isrc -Ibuild/linux test_taucs.cpp

i get a bunch of errors "error: template with C linkage" from files
such as cmath.h, complex.h, etc ...

I looked up online what this error meant, and it seems like it has
something to do with "extern", but it seems like the error stemmed
from taucs..

so i'm clueless... does anyone have experience using taucs on linux
and want to guide me through the process?


thank you all very much in advance!

Isaac

Alejandro A. Ortiz Bernardin

unread,
Feb 4, 2009, 2:16:36 PM2/4/09
to matrixpr...@googlegroups.com
Hi Isaac,

I also had the same problem with the linkage of a C library in C++. There is
more than 1 solution. In my case I changed the taucs.h file. I don't
remember what I changed but I am attaching my modified taucs.h file ...
should work for you also. Then I use the following:

#define TAUCS_CORE_DOUBLE
#include <taucs.h>

You will see that "extern" is placed inside "taucs.h" rather than inside
your code. I know other people have used simply inside their own codes:

extern "C" {
#include <taucs.h>
}

In my case, it doesn't work and I don't know why. It seems that you have the
same problem.

Below is a Mikefile for linux that I use to compile an application which
uses TACUS and the "taucs.h" file attached. Hope that will be useful for you
... first you need to compile TAUCS libraries from the code that you have
downloaded from the author's web page.

Best wishes,
Alejandro.


Here is my Makefile:

************************************************************

# makefile
# Purpose: Create the executable for maxentSMsuite
#

# all these libraries are provided inside lib folder of maxentSMsuite main
folder but
# can be specified by the user if the libraries are already somewhere in the
system

LIBTAUCS = -L /home/alejandro/software/program_files/taucs/lib/linux
-ltaucs
LIBLAPACK = -L
/home/alejandro/software/program_files/taucs/external/lib/linux -llapack
LIBBLAS = -L /home/alejandro/software/program_files/taucs/external/lib/linux
-lf77blas -lcblas -latlas
LIBMETIS = -L
/home/alejandro/software/program_files/taucs/external/lib/linux -lmetis
LIBC = -L /home/alejandro/software/program_files/taucs/external/lib/linux
-lm
LIBF77 = -L /home/alejandro/software/program_files/taucs/external/lib/linux
-lg2c

# headers used by TAUCS

HEADTAUCS = -I /home/alejandro/software/program_files/taucs/external/src -I
/home/alejandro/software/program_files/taucs/src -I
/home/alejandro/software/program_files/taucs/build/linux

# compile

CC=g++
CC_LNK = -ansi -g -Wall
CC_COMPILE = -ansi -Wall -g -c
SOURCES = test4.cpp
ALLOBJECTS = test4.o
EXE = test4

$(EXE): $(ALLOBJECTS)
$(CC) $(CC_LNK) -o $(EXE) $(ALLOBJECTS) $(HEADTAUCS) $(LIBTAUCS)
$(LIBLAPACK) $(LIBBLAS) $(LIBMETIS) $(LIBC) $(LIBF77)

test4.o:
$(CC) $(CC_COMPILE) $(SOURCES) $(HEADTAUCS)

clean:
rm *.o $(EXE)

***************************************************



-----Mensaje original-----
De: matrixpr...@googlegroups.com
[mailto:matrixpr...@googlegroups.com] En nombre de isaac
Enviado el: Tuesday, February 03, 2009 5:50 PM
Para: matrixprogramming
Asunto: [matrixprogramming] [help] taucs on linux
taucs.h

Evgenii Rudnyi

unread,
Feb 4, 2009, 2:44:26 PM2/4/09
to matrixpr...@googlegroups.com
Alejandro A. Ortiz Bernardin schrieb:

> Hi Isaac,
>
> I also had the same problem with the linkage of a C library in C++. There is
> more than 1 solution. In my case I changed the taucs.h file. I don't
> remember what I changed but I am attaching my modified taucs.h file ...
> should work for you also. Then I use the following:
>
> #define TAUCS_CORE_DOUBLE
> #include <taucs.h>
>
> You will see that "extern" is placed inside "taucs.h" rather than inside
> your code. I know other people have used simply inside their own codes:
>
> extern "C" {
> #include <taucs.h>
> }
>
> In my case, it doesn't work and I don't know why. It seems that you have the
> same problem.
>

I have not compiled TAUCS on Linux for awhile. As far as I remember,
there was some incompatibility between the TAUCS headers and some
headers used by g++ indeed. That is, the compilation as a C code was
okay, but with C++ there was some problems - yes, it was necessary to
fix something in the taucs.h. Well, it could depend on the g++ version.

I do not have my files with me right now but I will post them tomorrow.

Evgenii

isaac

unread,
Feb 4, 2009, 7:29:03 PM2/4/09
to matrixprogramming
Hi Alejandro and Evgenii,

thank you for your replies, one way or another i got past the template
in c linking error ..

but now when i run

g++ test_taucs.cpp -ansi -g -Wall -o lol -Iexternal/src/ lib/linux/
libtaucs.a -Isrc/ -Ibuild/linux/ -Llib/linux/ -ltaucs -llapack -
lcblas -latlas -lm -lg2c

i get

/tmp/ccVH3owx.o: In function `main':
/home/isaac/program/taucs/test_taucs.cpp:76: undefined reference to
`taucs_logfile(char*)'
/home/isaac/program/taucs/test_taucs.cpp:77: undefined reference to
`taucs_linsolve(taucs_ccs_matrix*, void**, int, void*, void*, char**,
void**)'
/home/isaac/program/taucs/test_taucs.cpp:106: undefined reference to
`taucs_linsolve(taucs_ccs_matrix*, void**, int, void*, void*, char**,
void**)'


am i missing something in my compilation command?

thanks again ...
Isaac

Alejandro A. Ortiz Bernardin

unread,
Feb 4, 2009, 8:01:17 PM2/4/09
to matrixpr...@googlegroups.com
Isaac,

Not sure, but if you are using the header file "taucs.h" that I sent you in
the morning, then test_taucs.cpp that you have downloaded from
http://matrixprogramming.com/TAUCS/ might not work properly unless you do
some minor changes. If you want you can try the attached "test_taucs.cpp"
which is the original version which I used with the header file I sent you
in the morning. If that works, then you can study the options that Evgenii
changed to the original test.

Alejandro.


-----Mensaje original-----
De: matrixpr...@googlegroups.com
[mailto:matrixpr...@googlegroups.com] En nombre de isaac
Enviado el: Tuesday, February 03, 2009 5:50 PM
Para: matrixprogramming
Asunto: [matrixprogramming] [help] taucs on linux


test_taucs.cpp

isaac

unread,
Feb 4, 2009, 8:03:57 PM2/4/09
to matrixprogramming
Hi eveyone,
with a bit more fiddling around, i've gotten the example code to
compile!
Now integration to another project ...

hopefully everything will go smoothly!

Alejandro A. Ortiz Bernardin

unread,
Feb 4, 2009, 8:04:30 PM2/4/09
to matrixpr...@googlegroups.com
I replied the wrong e-mail, so for the sake of clarity I am sending it
again:


-----Mensaje original-----
De: matrixpr...@googlegroups.com
[mailto:matrixpr...@googlegroups.com] En nombre de isaac
Enviado el: Wednesday, February 04, 2009 4:29 PM
Para: matrixprogramming
Asunto: [matrixprogramming] Re: [help] taucs on linux

Alejandro A. Ortiz Bernardin

unread,
Feb 4, 2009, 8:10:13 PM2/4/09
to matrixpr...@googlegroups.com
Also pressed on the wrong key and the message was sent empty :-)

---------------------------------------

Isaac,

>> but now when i run

>> g++ test_taucs.cpp -ansi -g -Wall -o lol -Iexternal/src/ lib/linux/
>> libtaucs.a -Isrc/ -Ibuild/linux/ -Llib/linux/ -ltaucs -llapack -
>> lcblas -latlas -lm -lg2c

>> i get

>> /tmp/ccVH3owx.o: In function `main':
>> /home/isaac/program/taucs/test_taucs.cpp:76: undefined reference to
>> `taucs_logfile(char*)'
>> /home/isaac/program/taucs/test_taucs.cpp:77: undefined reference to
>> `taucs_linsolve(taucs_ccs_matrix*, void**, int, void*, void*, char**,
>> void**)'
>> /home/isaac/program/taucs/test_taucs.cpp:106: undefined reference to
>> `taucs_linsolve(taucs_ccs_matrix*, void**, int, void*, void*, char**,
>> void**)'

Not sure, but if you are using the header file "taucs.h" that I sent you in
the morning, then test_taucs.cpp that you have downloaded from


http://matrixprogramming.com/TAUCS/ might not work properly unless you do
some minor changes. If you want you can try the attached "test_taucs.cpp"
which is the original version which I used with the header file I sent you
in the morning. If that works, then you can study the options that Evgenii
changed to the original test.

Also, because of the error below it seems to be the path to headers files
and/or libraries might be wrong or incomplete.

Alejandro.


test_taucs.cpp

Evgenii Rudnyi

unread,
Feb 5, 2009, 3:28:25 PM2/5/09
to matrixpr...@googlegroups.com

I am glad that you have done it. Just in case, as I have promised
yesterday, I have enclosed taucs_simple.h that I have used once to
compile the code using TAUCS from g++.

taucs_simple.h
Reply all
Reply to author
Forward
0 new messages