New to TAUCS, need to compile with Multi-threaded Debug DLL (/MDd) in VS .NET 2003

167 views
Skip to first unread message

Olumide

unread,
Feb 5, 2009, 1:20:38 PM2/5/09
to matrixprogramming
Hello,

I'm very new to TAUCS and I need to use TAUCS in my code (an Audesk
Maya plugin) which must be compiled as Multi-threaded Debug DLL or I
suppose Multi-threaded DLL. Is there a way to compile TAUCS code as
either? (None of the forum threads I've found answer this question.)

Thanks,

- Olumide

Alejandro A. Ortiz Bernardin

unread,
Feb 5, 2009, 2:23:36 PM2/5/09
to matrixpr...@googlegroups.com
Hi Olumide,

There is a discussion regarding something related to your question where you
can get some help. Egvenii test several ways to compile TAUCS libraries
here:

http://groups.google.com/group/matrixprogramming/browse_thread/thread/1738fb
386f9a744f?hl=en#

It is not exactly what you are looking for but I suppose Egvenii can say
something more.

Best,
Alejandro


-----Mensaje original-----
De: matrixpr...@googlegroups.com
[mailto:matrixpr...@googlegroups.com] En nombre de Olumide
Enviado el: Thursday, February 05, 2009 10:21 AM
Para: matrixprogramming
Asunto: [matrixprogramming] New to TAUCS, need to compile with
Multi-threaded Debug DLL (/MDd) in VS .NET 2003

Evgenii Rudnyi

unread,
Feb 5, 2009, 3:51:16 PM2/5/09
to matrixpr...@googlegroups.com
Olumide schrieb:

This clearly should be possible. However, I should confess that I do not
know how to compile DLL under VS. I have done it once under Cygwin but
have not learnt yet how to do it under VS. The first part - to change
the compiler flag to compile the object files is simple. Just edit
config/win32.mk, for example change CFLAGS to

CFLAGS = /nologo /O2 /W3 /D "WIN32" /MD

to have /MD option. Then all the object files will be compiled with this
option. So the question is how to make a DLL from the object files. If
you send me a command for VS to do it from the command line , I could
think on how to implement it in the makefile.

Olumide

unread,
Feb 5, 2009, 7:17:09 PM2/5/09
to matrixprogramming
On 5 Feb, 20:51, Evgenii Rudnyi <use...@rudnyi.ru> wrote:
> This clearly should be possible. However, I should confess that I do not
> know how to compile DLL under VS. I have done it once under Cygwin but
> have not learnt yet how to do it under VS. The first part - to change
> the compiler flag to compile the object files is simple. Just edit
> config/win32.mk, for example change CFLAGS to
>
> CFLAGS    = /nologo /O2 /W3 /D "WIN32" /MD
>
> to have /MD option. Then all the object files will be compiled with this
> option. So the question is how to make a DLL from the object files. If
> you send me a command for VS to do it from the command line , I could
> think on how to implement it in the makefile.

Thanks guys!

Its not that I'm interested in compiling TAUCS into a DLL. The problem
is that I would like to use the TAUCS libraries in a project that must
be compiled as multithreaded DLL.

Olumide

unread,
Feb 5, 2009, 7:42:25 PM2/5/09
to matrixprogramming
On 5 Feb, 20:51, Evgenii Rudnyi <use...@rudnyi.ru> wrote:
> This clearly should be possible. However, I should confess that I do not
> know how to compile DLL under VS. I have done it once under Cygwin but
> have not learnt yet how to do it under VS. The first part - to change
> the compiler flag to compile the object files is simple. Just edit
> config/win32.mk, for example change CFLAGS to
>
> CFLAGS    = /nologo /O2 /W3 /D "WIN32" /MD

I've tried this and it worked for a while but eventually, as
predicted, it conked out when it was time to link. Output:

cl -c /nologo /O2 /W3 /D "WIN32" /MDd -DMACHTYPE_ -I src\\
-I build\\win32\\ -I external
\\src\\ -DTAUCS_CORE_GENERAL src\\taucs_sn_llt.c /Foobj\\win32\
\taucs_sn_llt.obj
taucs_sn_llt.c
cl -c /nologo /O2 /W3 /D "WIN32" /MDd -DMACHTYPE_ -I src\\
-I build\\win32\\ -I external
\\src\\ -DTAUCS_CORE_DOUBLE src\\taucs_sn_llt.c /Foobj\\win32\
\taucs_sn_llt_D.obj
taucs_sn_llt.c
...
cl -c /nologo /O2 /W3 /D "WIN32" /MDd -DMACHTYPE_ -I src\\
-I build\\win32\\ -I external
\\src\\ external\\src\\colamd.c /Foobj\\win32\\colamd.obj
colamd.c
external\\src\\colamd.c(1114) : warning C4244: '=' : conversion from
'double' to 'int', possible los
s of data
external\\src\\colamd.c(1115) : warning C4244: '=' : conversion from
'double' to 'int', possible los
s of data
del /Q lib\\win32\\libtaucs.lib
lib /nologo /out:lib\\win32\\libtaucs.lib obj\\win32\
\taucs_sn_llt.obj obj\\win32\\taucs_sn
_llt_D.obj obj\\win32\\taucs_sn_llt_S.obj obj\\win32\
\taucs_sn_llt_Z.obj obj\\win32\\taucs_sn_llt
_C.obj obj\\win32\\taucs_linsolve.obj obj\\win32\\taucs_logging.obj
obj\\win32\\taucs_memory.obj
obj\\win32\\taucs_timer.obj obj\\win32\\taucs_ccs_base.obj obj\
\win32\\taucs_ccs_base_D.obj obj\
\win32\\taucs_ccs_base_S.obj obj\\win32\\taucs_ccs_base_Z.obj obj\
\win32\\taucs_ccs_base_C.obj ob
j\\win32\\taucs_vec_base.obj obj\\win32\\taucs_vec_base_D.obj obj\
\win32\\taucs_vec_base_S.obj ob
j\\win32\\taucs_vec_base_Z.obj obj\\win32\\taucs_vec_base_C.obj obj\
\win32\\taucs_ccs_ops.obj obj
\\win32\\taucs_ccs_ops_D.obj obj\\win32\\taucs_ccs_ops_S.obj obj\
\win32\\taucs_ccs_ops_Z.obj obj\
\win32\\taucs_ccs_ops_C.obj obj\\win32\\taucs_ccs_io.obj obj\\win32\
\taucs_ccs_io_D.obj obj\\win3
2\\taucs_ccs_io_S.obj obj\\win32\\taucs_ccs_io_Z.obj obj\\win32\
\taucs_ccs_io_C.obj obj\\win32\\t
aucs_ccs_order.obj obj\\win32\\taucs_ccs_factor_llt.obj obj\\win32\
\taucs_ccs_factor_llt_D.obj ob
j\\win32\\taucs_ccs_factor_llt_S.obj obj\\win32\
\taucs_ccs_factor_llt_Z.obj obj\\win32\\taucs_ccs_
factor_llt_C.obj obj\\win32\\taucs_ccs_solve_llt.obj obj\\win32\
\taucs_ccs_solve_llt_D.obj obj\\w
in32\\taucs_ccs_solve_llt_S.obj obj\\win32\
\taucs_ccs_solve_llt_Z.obj obj\\win32\\taucs_ccs_solve_
llt_C.obj obj\\win32\\taucs_complex.obj obj\\win32\
\taucs_complex_D.obj obj\\win32\\taucs_complex
_S.obj obj\\win32\\taucs_complex_Z.obj obj\\win32\
\taucs_complex_C.obj obj\\win32\\taucs_ccs_ooc_
llt.obj obj\\win32\\taucs_ccs_ooc_llt_D.obj obj\\win32\
\taucs_ccs_ooc_llt_S.obj obj\\win32\\taucs
_ccs_ooc_llt_Z.obj obj\\win32\\taucs_ccs_ooc_llt_C.obj obj\\win32\
\taucs_ccs_ooc_lu.obj obj\\win3
2\\taucs_ccs_ooc_lu_D.obj obj\\win32\\taucs_ccs_ooc_lu_S.obj obj\
\win32\\taucs_ccs_ooc_lu_Z.obj o
bj\\win32\\taucs_ccs_ooc_lu_C.obj obj\\win32\\taucs_ooc_io.obj obj\
\win32\\taucs_iter_D.obj obj\\
win32\\taucs_vaidya_D.obj obj\\win32\\taucs_recvaidya_D.obj obj\
\win32\\taucs_gremban_D.obj obj\\
win32\\taucs_ccs_xxt_D.obj obj\\win32\\taucs_ccs_generators_D.obj obj
\\win32\\taucs_malloc.obj ob
j\\win32\\readhb.obj obj\\win32\\amdatr.obj obj\\win32\\amdbar.obj
obj\\win32\\amdexa.obj obj\\w
in32\\amdhaf.obj obj\\win32\\amdhat.obj obj\\win32\\amdpre.obj obj\
\win32\\amdtru.obj obj\\win32
\\genmmd.obj obj\\win32\\colamd.obj
echo lib\\win32\\libtaucs.lib
lib\\win32\\libtaucs.lib
cl -c /nologo /O2 /W3 /D "WIN32" /MDd -DMACHTYPE_ -I src\\
-I build\\win32\\ -I external
\\src\\ progs\\direct.c /Foobj\\win32\\direct.obj
direct.c
cl /nologo /MT /F64000000 /Febin\\win32\\direct.exe obj\
\win32\\direct.obj lib\\win32\\li
btaucs.lib external\\lib\\win32\\liblapack.lib external\\lib\\win32\
\libf77blas.lib external\\lib\\
win32\\libcblas.lib external\\lib\\win32\\libatlas.lib external\\lib\
\win32\\libmetis.lib external\\
lib\\win32\\vcf2c.lib
LIBCMT.lib(dosmap.obj) : error LNK2005: __errno already defined in
MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined
in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in
MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in
MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in
MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in
MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(atox.obj) : error LNK2005: _atoi already defined in
MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(isctype.obj) : error LNK2005: __isctype already defined in
MSVCRTD.lib(MSVCR71D.dll)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of
other libs; use /NODEFAULTLIB:lib
rary
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of
other libs; use /NODEFAULTLIB:libr
ary
bin\\win32\\direct.exe : fatal error LNK1169: one or more multiply
defined symbols found
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.

Evgenii Rudnyi

unread,
Feb 6, 2009, 2:44:40 PM2/6/09
to matrixpr...@googlegroups.com
Olumide schrieb:

> On 5 Feb, 20:51, Evgenii Rudnyi <use...@rudnyi.ru> wrote:
>> This clearly should be possible. However, I should confess that I do not
>> know how to compile DLL under VS. I have done it once under Cygwin but
>> have not learnt yet how to do it under VS. The first part - to change
>> the compiler flag to compile the object files is simple. Just edit
>> config/win32.mk, for example change CFLAGS to
>>
>> CFLAGS = /nologo /O2 /W3 /D "WIN32" /MD
>
> I've tried this and it worked for a while but eventually, as
> predicted, it conked out when it was time to link. Output:
>

...


> cl /nologo /MT /F64000000 /Febin\\win32\\direct.exe obj\
> \win32\\direct.obj lib\\win32\\li
> btaucs.lib external\\lib\\win32\\liblapack.lib external\\lib\\win32\
> \libf77blas.lib external\\lib\\
> win32\\libcblas.lib external\\lib\\win32\\libatlas.lib external\\lib\
> \win32\\libmetis.lib external\\
> lib\\win32\\vcf2c.lib
> LIBCMT.lib(dosmap.obj) : error LNK2005: __errno already defined in
> MSVCRTD.lib(MSVCR71D.dll)

...


> LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of
> other libs; use /NODEFAULTLIB:lib
> rary
> LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of
> other libs; use /NODEFAULTLIB:libr
> ary

The linker try to use both run time libraries LIBCMT.lib and
MSVCRTD.lib. This will not work. It is necessary to understand why this
happens. First the flag is wrong - it is /MT and and /MD.

I guess it is necessary to change LDFLAGS in win32.mk as well

LDFLAGS = /nologo /MD /F64000000

However, it may not solve the problem as VC writes the default libraries
in the object files. And the libraries included with TAUCS have been
compiled with /MT, that is, for them LIBCMT.lib is the default library.
I do not know how to check it correctly but the brute force approach

strings libmetis.lib | grep -i libcmt

shows that both metis and f2c has such a text. It could be possible to
add /NODEFAULTLIB:LIBCMT.lib to the command above but it could be that
it should go after -link at the end of the command. Hard to say how to
do it in win32.mk. It could be simpler just to copy this command in some
batch file and edit there. Though I do not know if this will help, it
well might be that LIBCMT.lib has some symbols that are not available in
MSVCRTD.lib. But it makes sense to try it.

If this will not help, then you have to recompile the libraries on which
TAUCS depends with /MD. The life is not that simple.

If you have MKL, then it is possible to use it for the optimized BLAS
and then it would be necessary just to recompile METIS. The latter is
pretty simple, METIS is not that complicated.

Evgenii

Olumide

unread,
Feb 6, 2009, 5:46:07 PM2/6/09
to matrixprogramming
On 6 Feb, 19:44, Evgenii Rudnyi <use...@rudnyi.ru> wrote:
> I guess it is necessary to change LDFLAGS in win32.mk as well
>
> LDFLAGS   = /nologo /MD /F64000000

I have. Here is the error message I got:

cl /nologo /MDd /F64000000 /Febin\\win32\\direct.exe obj\
\win32\\direct.obj lib\\win32\\l
ibtaucs.lib external\\lib\\win32\\liblapack.lib external\\lib\\win32\
\libf77blas.lib external\\lib\
\win32\\libcblas.lib external\\lib\\win32\\libatlas.lib external\\lib\
\win32\\libmetis.lib external\
\lib\\win32\\vcf2c.lib
LIBCMT.lib(dosmap.obj) : error LNK2005: __errno already defined in
MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined
in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in
MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in
MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in
MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in
MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(atox.obj) : error LNK2005: _atoi already defined in
MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(isctype.obj) : error LNK2005: __isctype already defined in
MSVCRTD.lib(MSVCR71D.dll)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of
other libs; use /NODEFAULTLIB:lib
rary
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of
other libs; use /NODEFAULTLIB:libr
ary
bin\\win32\\direct.exe : fatal error LNK1169: one or more multiply
defined symbols found
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.

> If this will not help, then you have to recompile the libraries on which
> TAUCS depends with /MD. The life is not that simple.

What libraries are those?

> If you have MKL, then it is possible to use it for the optimized BLAS
> and then it would be necessary just to recompile METIS. The latter is
> pretty simple, METIS is not that complicated.

What's MKL and METIS?

Olumide

unread,
Feb 6, 2009, 5:51:25 PM2/6/09
to matrixprogramming
> What's MKL and METIS?

I've found both libraries on the net, but I'm not sure either is
available for free. Does TAUCS depend on either?

Olumide

unread,
Feb 6, 2009, 7:57:12 PM2/6/09
to matrixprogramming
An update:

I added the following lines of code to my Maya Plugin (compiled as /
MDd), and the project compileded without a fuss:

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

...

taucs_ccs_matrix* A = taucs_ccs_generate_mesh2d( 20 , "dirichlet" );
taucs_ccs_write_ijv( A , "sampleMatrx.txt" );

I'd like to know if a library that's been compiled as /MT (in this
case, TAUCS) can be safely used to build another library compiled as /
MDd or /Md

Thanks.

Evgenii Rudnyi

unread,
Feb 7, 2009, 9:37:23 AM2/7/09
to matrixpr...@googlegroups.com
Olumide schrieb:

>> What's MKL and METIS?
>
> I've found both libraries on the net, but I'm not sure either is
> available for free. Does TAUCS depend on either?

TAUCS needs METIS for reodering. There are other reodering schemes in
TAUCS but METIS seems to be the fastest - see for example slide 18 in

http://modelreduction.com/doc/teaching/eurosime/lecture2.pdf

It is not a problem to compile METIS under /MD, if you need
instructions, I can make them. METIS is free for research, please look
at the METIS copyright.

Then TAUCS needs BLAS, well, if you need speed, then the optimized BLAS.
You can compare the reference BLAS with ATLAS at

http://matrixprogramming.com/MatrixMultiply/

If speed is not essential you can use LAPACK from Netlib that contains
the reference BLAS. They are public domain, that is, completely free. It
is relatively easy to compile them under /MD but to this end you need
Intel Fortran.

A free optimized BLAS is ATLAS but I have never compiled it under MS VS.
It should be possible, it seems that the TAUCS author has done it, but
my experience with ATLAS tells me that this is not an easy thing.
Actually it would be good to look at the latest ATLAS and to see what
people say about it.

MKL is the optimized BLAS from Intel. It is not free but it allows us to
save some time. I have it and hence like it.

Evgenii Rudnyi

unread,
Feb 7, 2009, 9:44:59 AM2/7/09
to matrixpr...@googlegroups.com
Olumide schrieb:

> On 6 Feb, 19:44, Evgenii Rudnyi <use...@rudnyi.ru> wrote:
>> I guess it is necessary to change LDFLAGS in win32.mk as well
>>
>> LDFLAGS = /nologo /MD /F64000000
>
> I have. Here is the error message I got:
>
> cl /nologo /MDd /F64000000 /Febin\\win32\\direct.exe obj\
> \win32\\direct.obj lib\\win32\\l
> ibtaucs.lib external\\lib\\win32\\liblapack.lib external\\lib\\win32\
> \libf77blas.lib external\\lib\
> \win32\\libcblas.lib external\\lib\\win32\\libatlas.lib external\\lib\
> \win32\\libmetis.lib external\
> \lib\\win32\\vcf2c.lib

...


> LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of
> other libs; use /NODEFAULTLIB:lib
> rary
> LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of
> other libs; use /NODEFAULTLIB:libr
> ary

There is still a conflict between LIBCMT and MSVCRTD. You can try to use
the flag /NODEFAULTLIB:LIBCMT. It could help.

>> If this will not help, then you have to recompile the libraries on which
>> TAUCS depends with /MD. The life is not that simple.
>
> What libraries are those?

Look in external/lib/win32

The optimized BLAS (ATLAS)
liblapack.lib libf77blas.lib libcblas.lib libatlas.lib

f2c(g2c) as some Fortran code in ATLAS has been compiled with g77 or
with f2c
vcf2c.lib

METIS
libmetis.lib

>> If you have MKL, then it is possible to use it for the optimized BLAS
>> and then it would be necessary just to recompile METIS. The latter is
>> pretty simple, METIS is not that complicated.
>
> What's MKL and METIS?

I have answered this in another email.

Evgenii Rudnyi

unread,
Feb 7, 2009, 9:49:10 AM2/7/09
to matrixpr...@googlegroups.com
Olumide schrieb:

I should confess that I do not know well, how different runtime
libraries in MS VC function. But if this works, then why not. Start with
this, run tests if everything is working they it should be okay. If you
see crashes during TAUCS calls, you may return back to this point later on.

Reply all
Reply to author
Forward
0 new messages