Hi Alejandro,
I was able to compile and run your test program on Win32
$ cl -I../../lib/include -EHsc -MD -c main.cpp
$ cl main.obj libtaucs.lib libmetis.lib mkl_intel_c.lib
mkl_intel_thread.lib mkl_core.lib libiomp5md.lib -link
-LIBPATH:../../ms/lib/bin
$ ./main.exe
Solution success.
0
2
0
4
What linking problems do you have? There could be many reasons for this.
It could depends on BLAS that you use. In the example above I have used
Intel MKL. In Intel MKL for example the function names are in uppercase
and without the underscore.
Please just describe what you have done and what an error message do you
receive.
Best wishes,
Evgenii
Attached are the TAUCS headers that I am using for Windows and Linux.
Thanks,
Alejandro.
-----Mensaje original-----
De: matrixpr...@googlegroups.com
[mailto:matrixpr...@googlegroups.com] En nombre de Evgenii Rudnyi
Enviado el: Sunday, October 12, 2008 1:34 AM
Para: matrixpr...@googlegroups.com
Asunto: [matrixprogramming] Re: Problem running TAUCS in Microsoft Visual
C++ 6.0
I have changed the settings and now you can upload the files. There were
cases when spammers uploaded files with inappropriate content and I have
disabled the access but now the upload it allowed.
However, the simpler solution would be to use
extern "C" {
#include <taucs.h>
}
in the code. This way you do not need to change the headers. Well, I
have to check if I have modified my headers or not, I do not remember it
right now.
> I use Microsoft Visual C++ 6.0. The code above compiles well but when
> linking I get the following linkage error for all the three cases 1),
> 2) and 3):
>
> --------------------Configuration: test - Win32
> Debug--------------------
> Linking...
> test4.obj : error LNK2001: unresolved external symbol _taucs_linsolve
> Debug/test.exe : fatal error LNK1120: 1 unresolved externals
> Error executing link.exe.
>
> test.exe - 2 error(s), 0 warning(s)
>
>
> Any idea what the problem is about?
Well, it could be that VC does not use the TAUCS library. Alternatively
the name in the object file does not correspond to the name in the library.
First make sure that you have made setting in VC to link with the TACUS
library. I do not know how to do it from GUI as I do not use it. From
the command line is as follows
cl test.obj libtaucs.lib
and then to make sure the cl finds the library. But if it does not, it
makes an error message in this case.
If the problem persists, check the object names. I do it with nm from
cygwin:
$ nm main.obj | grep -i taucs_linsolve
U _taucs_linsolve
It says that the object file needs this function.
$ nm libtaucs.lib | grep -i taucs_linsolve
obj//win32//taucs_linsolve.obj:
...
00000000 T _taucs_linsolve
It says that the function is in the library.
If VC does search functions in the library and you get the message
above, then these two command should produce somewhat different names.
Evgenii
It is actually the same linking error - unresolved symbol
_taucs_linsolve. Additionally there are two warnings during compile but
they have nothing to do with this.
What happens is that the linker cannot find this symbol during linking.
Why? I can imagine only the two reasons that I have mentioned. The
linker is a pretty simple tool.
A good introduction to linking is a paper
David M. Beazley, Brian D. Ward, and Ian R. Cooke,
The Inside Story On Shared Libraries and Dynamic Loading,
Computing in Science & Engineering, September/October 2001, N 5, p. 90-97.
Evgenii
Interesting. This is exactly how I have compile your example. I have to
check the headers that I use though.
>> Well, it could be that VC does not use the TAUCS library. Alternatively
>> the name in the object file does not correspond to the name in the library.
>>
>> First make sure that you have made setting in VC to link with the TACUS
>> library. I do not know how to do it from GUI as I do not use it. From
>> the command line is as follows
>>
>> cl test.obj libtaucs.lib
>>
>
> I have specified where the libraries and the headers are. There is a
> makefile
> which is created automatically in which I have checked that the
> directories
> are specified.
Could you post the makefile? I guess that it in the NMAKE format but
this should be readable.
You can also try such a command from the command line. It helps to
understand what happens.
>
>> and then to make sure the cl finds the library. But if it does not, it
>> makes an error message in this case.
>>
>
> Maybe, no idea. The only thing I know is that the directories are
> specified
> as I explained above.
If you are sure that the linker checks the library, then what is left is
to check names of symbols in the library. I do not see the third option.
>> If the problem persists, check the object names. I do it with nm from
>> cygwin:
>>
>> $ nm main.obj | grep -i taucs_linsolve
>> U _taucs_linsolve
>>
>> It says that the object file needs this function.
>>
>> $ nm libtaucs.lib | grep -i taucs_linsolve
>> obj//win32//taucs_linsolve.obj:
>> ...
>> 00000000 T _taucs_linsolve
>>
>> It says that the function is in the library.
>>
>> If VC does search functions in the library and you get the message
>> above, then these two command should produce somewhat different names.
>>
>
> I also have installed Cygwin in my PC. I will try it to see if the
> problem persists.
> Just one doubt. If I use Cygwin to build the application, then will it
> run just over
> Cygwin? or can I run it directly on Win32?
Cygwin by itself just brings a Unix-like shell. It is also possible to
do it from cmd but its DOS language is very limited.
It does not matter if you call cl from Cygwin or cmd, the result will be
the same. Cygwin does not change the work of Win32 applications.
I guess there should be also some tools in Visual Studio to check the
names in the libraries and object files. However it is necessary to find
them.
If you use gcc in Cygwin, then it by default links with cygwin1.dll.
Well, its goal is to treat Unix calls. With -mno-cygwin, one uses MINGW
and obtains an application that does not depend on cygwin1.dll. But then
there should be no Unix calls.
I have some short document on how to compile UMFPACK
http://matrixprogramming.com/UMFPACK/
Here there are all three cases under Cygwin: compiling with gcc,
compiling with mingw, and then compiling with VC.
On my list to make a similar thing for TAUCS but this has not been done
yet.
I have the libraries for TAUCS for these three cases and I can give you
them if you want. Well, the library for VC assume that the BLAS names
are uppercase and without underscore (Intel MKL or AMD ACML).
Evgenii
I do use Microsoft VC++ directly - see the message that I have just sent
as a reply to your another message. But I do it from the command line
and I do not know GUI. As I have written, cygwin is just a shell that I
like. With cygwin the work on Linux and Windows looks the same. Anyway,
the scripting capabilities of CMD is a disaster.
Evgenii
...
> CPP_PROJ=/nologo /MLd /W3 /Gm /GX /ZI /Od /I "C:\Documents and Settings
> \ALEJANDRO\Desktop\taucs_test\taucs_original" /D "WIN32" /D "_DEBUG" /
This is to find headers.
...
> LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib
> comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
> odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib
> winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
> oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /
> subsystem:console /incremental:yes /pdb:"$(OUTDIR)\test.pdb" /debug /
> machine:I386 /nodefaultlib:"LIBCMT.LIB" /out:"$(OUTDIR)\test.exe" /
> pdbtype:sept /libpath:"C:\Documents and Settings\ALEJANDRO\Desktop
> \taucs_test\taucs_original"
This is to find a library. This is the equivalent to -L for gcc. However
you have not told cl what library to search. There are only default
libraries but the TAUCS library is not listed. You need equivalent to -l
for gcc and for cl it is just the library name.
This is why I like the command line. To learn GUI on what dialog boxes I
should click is too complicated.
Evgenii
I have looked at the library that you have sent me. nm shows that it
does not have the symbol _taucs_linsolve indeed. Actually its size is
very small (10 Kb). Something went wrong during its compilation.
I have copied my TAUCS libraries to
http://matrixprogramming.com/TAUCS/
in readme.txt I have written shortly about them. I am not sure if they
will help you. Well, the VC library expects to have the BLAS calls
uppercase and without underscore (Intel MKL or AMD ACML). The mingw DLL
should be compatible but I guess that cl will expect the import library.
And the cygwin library depends on cygwin1.dll. Anyway all three
libraries have _taucs_linsolve.
I still plan to document the way I have compiled TAUCS, similar to
UMFPACK, but it is unclear when I will have time.
Best wishes,
Evgenii
http://www.tau.ac.il/~stoledo/taucs/2.2/taucs_full.zip
1) unzip taucs_full.zip
2) configure
3) nmake
That's it. I have got the library and the examples have been also
successfully linked with the supplied libraries in taucs_full.zip.
cd bin\win32
direct -mesh2d 400 -log stdout -snmf
Well, MS VC has made warnings about some functions. For example
progs\\iter.c(369) : warning C4996: 'fscanf': This function or variable
may be unsafe. Consider using fscanf_s instead. To disable deprecation,
use _CRT_SECURE_NO_WARNINGS. See online help for details.
It could be that in VC 2008 they have disabled them and then it could be
necessary to modify the TAUCS code to compile it. If you write what
errors there were there, I could think of a workaround.
Evgenii
You need to make sure that cl and nmake are on the path before you run
configure. I guess you can achieve it with so called Visual Studio
Command Line that sets all the variables required to run it from the
command line.
Evgenii
I would appreciate it. Please not that it could be necessary to type
configure.bat
not configure. This batch file first runs nmake to compile configurator
and then runs it.
> If you want and have time you can test it by yourself using
> the MS VC 2008 express edition which is the one I used.
I am afraid that I am not ready to install MS VC 2008. My installation
of MS VC 2005 is working just fine and I am happy with this now.
Evgenii
What can be done to troubleshoot it is to try manually
cl configurator\taucs_config.c
I guess this should work. It could be safer
cd configure
cl taucs_config.c
Then it is possible just to run exe manually and it should create all
the make files.
Well, if the above works, then it is possible to find what MS MS Visual
C 2008 does not like in the original command by trial and error.
The next year I will change my notebook and then probably install MVC
2008. I do not like to change compilers too often but on the other hand
we have to follow the trend.
I have actually started with MVC only this year, before I have used gcc.
The first major surprise was the use of manifests. My application is a
command line tool and when I have seen that it does not work on another
computer, well, it'd better I do not write what I thought at that
moment. The second major surprise was that even with -O2 MS VC++ uses
safe iterators and the standard C++ library is incredible slow in this
case. They are nuts.
Let us see what challenges MS VC 2008 will bring to us.
Evgenii