Building TexGen

General discussion about TexGen.

Moderators: Martin, Developers

David
Regular
Posts: 20
Joined: Tue Apr 12, 2011 4:03 pm

Building TexGen

Post by David »

Lousie,

I'm having some issues with a manual install of TexGen.

Some, possibly all, of the issues seem to do with linking to VTK. I CMake, compiled (MSVS 2008) and installed VTK with no errors or warnings.
When I use CMake on TexGen I point VTK_DIR to this install directory, and press Configure. No errors there.
When I Generate this I get the warnings that _Renderer is not linking to several items. For example:

Code: Select all

  Target "_Renderer" links to item
    C:/Program Files/VTK/lib/vtk-5.6/vtkGraphics
  which is a full-path but not a valid library file name. 
Other files it gives warnings for not linking to are: vktGraphics, vktFiltering, vktCommon, (notably) vktIO...
However all of these files, both .lib and .cmake versions are present in the directory it mentions.
As these appear to be only warnings, I continue to the TexGen build in Visual Studio, where it seems warnings turn to errors.
------

When I run the TexGen build, as explained in the documentation, I get the following errors:

Under TexGen Core Build:

Code: Select all

TetgenMesh.obj : error LNK2019: unresolved external symbol "public: void __thiscall tetgenio::save_faces(char *)" (?save_faces@tetgenio@@QAEXPAD@Z) referenced in function "public: void __thiscall TexGen::CTetgenMesh::SaveTetgenMesh(class TexGen::CTextile &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?SaveTetgenMesh@CTetgenMesh@TexGen@@QAEXAAVCTextile@2@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
...
C:\Documents and Settings\...\TexGen Binaries\Release\TexGenCore.dll : fatal error LNK1120: 5 unresolved externals
Build log was saved at "file://c:\Documents and Settings\...\TexGen Binaries\Core\TexGenCore.dir\Release\BuildLog.htm"
TexGenCore - 6 error(s), 24 warning(s) 
The other 5 other errors are TetgenMesh.obj trying to use save_faces, save_elements, tetrahedralize, save_poly, and save_nodes.

After this set of errors, I get the same 17 errors under each of "TexGenGUI"; "_Renderer"; "cotton" and "polyester". All of them clearly relate to VTK.

Code: Select all

Creating library C:\Documents and Settings\...\TexGen Binaries\Release\TexGenGUI.lib and object C:\Documents and Settings\...\TexGen Binaries\Release\TexGenGUI.exp
vtkIO.lib(vtkMetaImageReader.obj) : error LNK2019: unresolved external symbol "public: __thiscall vtkmetaio::MetaImage::MetaImage(void)" (??0MetaImage@vtkmetaio@@QAE@XZ) referenced in function "protected: __thiscall vtkMetaImageReader::vtkMetaImageReader(void)" (??0vtkMetaImageReader@@IAE@XZ)
...
C:\Documents and Settings\...\TexGen Binaries\Release\TexGenGUI.exe : fatal error LNK1120: 16 unresolved externals
Build log was saved at "file://c:\Documents and Settings\...\TexGen Binaries\GUI\TexGenGUI.dir\Release\BuildLog.htm"
TexGenGUI - 17 error(s), 1 warning(s) 
The other 16 errors all begin with vtkIO.lib(vtkMetaImageReader.obj) : error LNK2019: unresolved external symbol

Have you any idea what's the issue here?
Is it possibly in how I used CMake to make VTK? I think I followed instructions correctly.

Many thanks,
David
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: Exporting .dat and .odb files in Texgen

Post by louisepb »

Hi David,

First of all an apology. The problems you are encountering with tetgenio are because I have been experimenting with using a meshing program called tetgen and have overlooked the fact that I needed to document this in the instructions for building from source.

You have two options. 1.Download tetgen from http://tetgen.berlios.de/index.html . Build it as a library and add tetgenlib.lib (or whatever you name it) and tetgen.h to the Core project. You will also need to add tetgenlib.lib to the TexGenCore properties in Visual Studio. (Right click on TexGenCore in the Solution Explorer and then go to Configuration Properties->Linker->Input->Additional Dependencies and add tetgencore.lib to the list).
2. Remove all references to tetgen from the TexGen project: Remove TetgenMesh.cpp and .h from the project and remove #include TetgenMesh.h from Texgen.h.

The current version of TexGen is built with VTK 5.4. I'm not sure whether using 5.6 would generate the errors you are seeing. It looks like your VTK build hasn't built the vtkIO project. Can you check that you have VTK_USE_METAIO ticked in your VTK build?

Hope that helps. Let me know if you have further problems,

Louise
David
Regular
Posts: 20
Joined: Tue Apr 12, 2011 4:03 pm

Re: Exporting .dat and .odb files in Texgen

Post by David »

Ahh, that explains tetgen. I was half concerned it was a typo for texgen :P I'll first try without tetgen and see what happens.

I'll redo the build with VTK 5.4. As it takes a long time for VTK to compile, I'll ask first:

Where should VTK_USE_METAIO be "ticked"? I looked under ALL_BUILD > CMakeLists.txt and searched for VTK_USE_METAIO and found the following text:
OPTION(VTK_USE_METAIO "Build metaio" ON)

Which looks promising. The same line exists within the INSTALL > CMakeLists.txt.
I cannot find a similar line for vtkIO within the CMakeLists.
Also the folders vtkmetaio, and vtkIO (containing subfolders of source files and header files) both exist in the project tree.

Does that all sound good, or should I be looking somewhere else for their being "ticked"?

Thanks,
David
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: Exporting .dat and .odb files in Texgen

Post by louisepb »

I use the cmake-gui. In that case, using grouped view, by expanding the VTK tree you get a list of VTK_USE.... with check boxes. If you're not using that then the OPTION(VTK_USE_METAIO "Build metaio" ON) sounds like it's probably the right thing.

Louise
David
Regular
Posts: 20
Joined: Tue Apr 12, 2011 4:03 pm

Re: Exporting .dat and .odb files in Texgen

Post by David »

Hi, I installed vtk-5.4. I checked in the CMake file and the checkbox you mentioned was there and ticked.
Now I'm using CMake on TexGen and I'm still getting those errors upon pressing Configure . One thing I hadn't noticed before is that the _Renderer is looking for
C:/Documents and Settings/VTK Binaries2/bin/vtkGraphics
when the file vtkGraphics is under
C:/Documents and Settings/VTK Binaries2/bin/Release/vtkGraphics

Is this likely the source of the warnings? I tried the cheeky approach and copied all the libraries from /bin/Release into /bin but I get the same errors that it's "a full-path but not a valid library file name." Strange but I tried moving onto the TexGen compile and the problems with _Renderer have gone away.
Horray, probable success!

Though now compiling _Core gets 102 errors, all of the form:

Core_wrap.cxx
..\..\TexGen Source\Python\Core_wrap.cxx(104157) : error C2039: 'PLANEPARAMS' : is not a member of 'TexGen' 

Is this because of my removal of Tetgen? I'll try installing it anyway, in case I'm right.
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: Exporting .dat and .odb files in Texgen

Post by louisepb »

Hi David,

Problems with Core_wrap.cxx are likely to be caused by SWIG. Which version did you download? One of our students had problems with this a while ago and found that TexGen will not build with SWIG 2. You need to be using the version specified on the Compiling From Source page - I think it's 1.3. I think it's something to do with SWIG 2 being compatible with Python 3.

If you've got rid of errors that mention tetgen then that's no longer your problem.

Louise
David
Regular
Posts: 20
Joined: Tue Apr 12, 2011 4:03 pm

Re: Exporting .dat and .odb files in Texgen

Post by David »

I'm using SWIG 1.3.40. In the documentation it mentions SWIG 1.3.40, 1.3.35 and 1.3.31 in various places. Are all of them fine or a specific one?

I noticed that when compiling, immediately after getting the (same 102) errors it tells me that TexGen Source/Python/Core_wrap.cxx has been modified outside of the source editor and would I like to reload it? The compiler finishes in the background while this notification is up. I don't think I've got anything open like that and it asks me this again if I recompile TexGen without accessing any other programs.

David
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: Exporting .dat and .odb files in Texgen

Post by louisepb »

Hi,
I think that any variation on SWIG 1.3 should be ok. The message about being modified outside the source editor is normally due to changing something outside VS. I think that, at this point, it would be good to exit VS, regenerate the make file in CMake, run up VS again and then do a rebuild all. Sometimes things get out of sync and you end up chasing things which are just there because you've only done a partial rebuild. If you still have errors after that then you know that it's something that you actually have to deal with.

Louise
David
Regular
Posts: 20
Joined: Tue Apr 12, 2011 4:03 pm

Re: Exporting .dat and .odb files in Texgen

Post by David »

Could I get some more details on tetgen?
I've tried following the instructions given by doing the following:
To make a library I've opened a "Win 32 Console Application" in MSVS, called tetgen.
under Application Settings select Static Library.
Included tetgen.h, tetgen.cxx and predicates.cxx.

After this the tetgen compilation instructions say "Add the symbol ``TETLIBRARY'' to compile switches." - I've no idea what this means.
Ignoring that line and compiling gives me, in the tetgen/Debug folder a tetgen.lib

Going to the TexGen Core project - tetgen.h already exists in the TexGen Core project; how do I "add tetgen.lib" as you explain? When I try to do right click > Add > Existing Item, it gives me a message saying "a custom build rule to build libraries could not be found".

Also you mention adding tetgencore.lib to the dependencies list. Did you mean tetgen.lib, because I don't seem to have a tetgencore.lib?

Thanks, David
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: Exporting .dat and .odb files in Texgen

Post by louisepb »

Hi David,

Look in tetgen.h and you will find the following line: #define TETLIBRARY

Just uncomment it and then everything should work. After you have built the project you should have a file tetgen.lib (or whatever you've called it). Copy it into your project Release folder and then add it to the list in Properties as described in the previous post.

Just looking at your last mail it says that your file ends up in the /Debug folder. You need to make sure that the Debug/Release version of the library matches the TexGen build that you're doing. I normally have tetgen.lib and tetgend.lib for the two versions. You need to add them to the appropriate Debug/Release folder in TexGen and add the appropriate file to the properties for both projects.

Louise
David
Regular
Posts: 20
Joined: Tue Apr 12, 2011 4:03 pm

Re: Exporting .dat and .odb files in Texgen

Post by David »

Hi Louise,

I've managed to get it to compile without errors, at long last. For a while it was a simple typo that held me back (I typed "...\Release\tetgen.lib", rather than "..\Release\tetgen.lib") Anyway, rebuilding ALL_BUILD I get 17 succeeded :)

I then built INSTALL, as per the documentation, with no errors, and go to the install directory and open TexGenGUI.exe
The error "Unable to complete Python code with TAB, completer module not found." pops up. I press OK and it opens the GUI. There are immediately several errors in the Python Output:

Code: Select all

<1> from _Embedded import *
Traceback (most recent call last):
  File "gui", line 1, in <module>
ImportError: No module named TexGen.Completer
<1> from TexGen.Core import *
Traceback (most recent call last):
  File "gui", line 1, in <module>
ImportError: No module named TexGen.Core
<1> from TexGen.Renderer import *
Traceback (most recent call last):
  File "gui", line 1, in <module>
ImportError: No module named TexGen.Renderer
<1> from TexGen.Export import *
Traceback (most recent call last):
  File "gui", line 1, in <module>
ImportError: No module named TexGen.Export
<1> from TexGen.Abaqus import *
Traceback (most recent call last):
  File "gui", line 1, in <module>
ImportError: No module named TexGen.Abaqus
<1> import math
(Note that math correctly imports, possibly a good sign)
Unsurprisingly, I try Create Weave to make a simple plain weave but nothing shows up on the screen. It only adds the error:

Code: Select all

Traceback (most recent call last):
  File "gui", line 1, in <module>
NameError: name 'CTextileWeave2D' is not defined
Any advice on what's going wrong here?

Here's a list of the modules I'm using, including extra info about Python as it seems that's the problem:
CMake 2.8.5
Microsoft Visual Studio 2008 (MSVS 9)
Python 2.6
(In CMake) PYTHON_SITE_PACKAGES: C:/Program Files/Abaqus/6.10-1/Python/Lib
tetgen 1.4.3
SWIG 1.3.35
OpenCascade 6.5.1
vtk 5.4.2
wxWidgets 2.8.12

Thanks for all your help so far; I really feel like I'm getting somewhere at last. This is especially encouraging as my supervisor wants my 2nd year PhD transfer report soon and I'd love to be able to show him some TexGen/Abaqus linking.
David
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: Exporting .dat and .odb files in Texgen

Post by louisepb »

Hi David,

Do you have the TexGen site packages directory in your path? The messages you are getting are because Python can't find the TexGen packages. Check that you have a TexGen folder in the place you've specified and that it contains files Core.py, Renderer.py etc. Then make sure that this folder (including /TexGen) is set in your path.

Hope you get it working!

Louise
David
Regular
Posts: 20
Joined: Tue Apr 12, 2011 4:03 pm

Re: Building TexGen

Post by David »

I'm not sure which path you mean. Do you mean the install path?: C:\Program Files\TexGen

If so, inside that I have:
TexGenGUI.exe.manifest
TexGenGUI.exe
TexGenCore.dll
TexGen.xrc

(folder) Scripts
\2dweave.py
\cotton.py
\non-ortho.py
\3dweave.py
\example.py
\polyester.py

The files you mention (Core.py, Renderer.py) are in directory: C:\Program Files\Abaqus\6.10-1\Python\Lib\TexGen (as I specified in CMake, in accordance with the documentation)

So what do I move where? Or where do I tell TexGen that it's Python Libraries are in the Abaqus folder?
Thanks, David
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: Building TexGen

Post by louisepb »

Hi David,

You need to specify it in your system path. Not sure which version of Windows you're running ( assuming you're running Windows!). In XP you need to right click on My Computer in the startup menu and then choose Properties. On the System Properties dialog select the Advanced tab and the Environment Variables button. Look in the System variables list for Path. Select this and then select Edit. You should then be able to add your path to the end of the list.

When you run TexGen the system should then search in that folder for the TexGen Python package.

Louise
David
Regular
Posts: 20
Joined: Tue Apr 12, 2011 4:03 pm

Re: Building TexGen

Post by David »

Yeah, it is XP.
I'll mention, for anyone else reading this: the path in Environment Variables is called PYTHONPATH and I set it to "C:\Program Files\Abaqus\6.10-1\Python\Lib" (note: not \Lib\TexGen - that causes the error to remain)

All but 1 of them import fine except:

Code: Select all

Traceback (most recent call last):
  File "gui", line 1, in <module>
  File "C:\Program Files\Abaqus\6.10-1\Python\Lib\TexGen\Export.py", line 7, in <module>
    import _Export
ImportError: DLL load failed: The specified module could not be found. 
I've looked in the directory (Abaqus\Python\Lib\TexGen) and there is Export.py, as well as _Export.pyd and Export.pyc. The only thing I've noticed is _Export.pyd is only 86kb, a fair bit smaller than _Core.pyd and _Renderer.pyd.

That said, TexGen now loads and creates weaves and will export to Abaqus Dry Fibre file (.ori, .eld. inp all look fine). I don't know the program structure well enough to know when _Export is going to be a problem. I'll try running some stuff in Abaqus from Python scripts, and maybe that will all work fine. If this error is easy to solve, it'd be good to fix.

David
Post Reply