All Forums Tools
idontknow 25 posts Joined 07/07
15 Jul 2007
Updating Teradata Compiler and Linker Paths (cufconfig -f ) - HELP REQUIRED

I am trying to update both the compiler and linker paths used by Teradata to locate the current C/C++ compiler.From reading other posts I have determined that this is possible using the cufconfig utility from either the command line or database window, and from reading the Utilities Reference manual (and the help command from CMD - which is actually better than the manual!) I have found that the option I need to use is: cufconfig -f filenameI have tried various ways of defining the input file used to specify the updates (see below) but I am unable to use the utility to update the settings (for information I am unable to find any examples of this utilities usage).Example cufconfig.txt file I have written: CompilerPath "D:\Program Files\Microsoft Visual Studio 8\VC\bin\" LinkerPath "D:\Program Files\Microsoft Visual Studio 8\VC\bin\"(I have also tried without quotes and using equals symbols, etc!).Any advice would be greatly appreciated.Rob

joedsilva 505 posts Joined 07/05
16 Jul 2007

I think you need to include the executable names as well ...try something like this .....CompilerPath: D:\Program Files\Microsoft Visual Studio 8\VC\bin\CL.EXELinkerPath: D:\Program Files\Microsoft Visual Studio 8\VC\bin\LINK.EXE

idontknow 25 posts Joined 07/07
16 Jul 2007

joedsilva - Thanks for that information it worked like a treat.Unfortunately it didn't solve all my issues (I was trying to get stored procedures to work with the TD 6.1 Demo), although it certainly helped.I then managed to findout some additional registry key info and now it is all working well.For peoples help I have posted the new registry info below:Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1]"Source Directories"=";;""CLR Version"="v1.1.4322""InstallDir"="D:\\Program Files\\Microsoft Visual Studio 8\\Common7\\IDE"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\CLSID][HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\CLSID\{4D4D35A3-1391-4E17-813D-54D1B846096A}]"ThreadingModel"="Both""InprocServer32"="D:\\Program Files\\Microsoft Visual Studio 8\\Common7\\Packages\\Debugger\\jsee.dll"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Path]"MSO"="D:\\Program Files\\Common Files\\Microsoft Shared\\Office11\\MSO.DLL"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Registration]"UserName"="root""ProductID"="""PIDKEY"=""[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Setup][HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\Microsoft .NET Framework SDK (English) 1.1]"InstallSuccess"=dword:00000001[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VC]"ProductDir"="D:\\Program Files\\Microsoft Visual Studio 8\\VC\\""VC7CommonDir"="D:\\Program Files\\Microsoft Visual Studio 8\\Common7\\"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS]"VS7CommonBinDir"="""VS7CommonDir"="D:\\Program Files\\Microsoft Visual Studio 8\\Common7\\""ProductDir"="D:\\Program Files\\Microsoft Visual Studio 8\\"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS][HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\FRAMEWORKSDK]"7.1"="D:\\Program Files\\Microsoft.NET\\SDK\\"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VC7]"7.1"="D:\\Program Files\\Microsoft Visual Studio 8\\Vc7\\"

joedsilva 505 posts Joined 07/05
17 Jul 2007

Oops I thought you had that info already I am not sure if all those registry entries are required ... in our Demo systems [on Win XP], we normally use only these two ... and we have everything from SPs, UDFs and External SPs running fine ...contents of the .reg file .... (this is for folks using .NET v1.1)[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1]"InstallDir"="C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Common7\\IDE\\"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VC]"ProductDir"="C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\"And then copyC:\Program Files\Microsoft.NET\SDK\v1.1\Bin\nmake.exetoC:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\nmake.exe

trojancjs 17 posts Joined 03/07
19 Aug 2007

Hi Joe,Thanks for your help with this! Using these registry settings, the 'cufconfig' settings above, and by adding the path to NMAKE to my system's default path, I was able to start compiling UDFs using Visual Studio 2005 (VC8).One more question: When I compile UDFs, I can execute them in unprotected mode, but I can't execute them in protected mode. [I get an error from BTEQ and a message in Event Log - I'll find it and edit it in here].I had to create a 'tdatuser' user (with no password) and a 'tdatudf' group manually. Do you know if there are any settings surrounding this user/group that you guys had to set manually? Whether they have a special password, or any special Local Security Policy settings?I also tried messing around with CREATE AUTHORIZATION, but I was not successful ...PS: A note for others - using the VC8 compiler, I need to manually add 'libcmt.lib' or 'msvcrt.lib' to the list of libraries to be linked in with each UDF if that UDF makes standard C library function calls. I did this using the 'SL' EXTERNAL NAME option: 'SL!msvcrt!...'

joedsilva 505 posts Joined 07/05
20 Aug 2007

Chris, AFAIK, the tdatuser and the corresponding group should have got created when you installed the database itself. This is something that's done by the database setup program. And the user and group are created irrespective of whether you have a compiler installed or not.Do you recall any error messages from the setup process ?And to the best of my knowledge you can't create that user manually and link it to the database authorization. (may be the support guys knows some trick ...)CREATE AUTHORIZATION statements are useful only when you want the UDF to be executed as a particular user process and not the default user (which is tdatuser). But it doesn't aid in creating the default user itself.But you did a good hacker's job ;-) To quote the error messages description.( which you would get if you just disable the account where it has been created by TD ;-) and tried to execute a protected UDF )7566 The protected mode user is not defined;cannot execute UDF/XSP/UDM.For Whom: Site support representativeNote: The Database installation procedure is supposedto create the user ’tdatuser’ group ’tdatudf’ on all nodeson the Teradata system. The user is used to execute protectedmode UDFs/XSPs/UDMs.I would presume that due to some weird reasons (but you were able to create it manually so I can't imagine a good reason). The setup process could not create the default user ....

trojancjs 17 posts Joined 03/07
20 Aug 2007

Thanks for all of your help on this topic, Joe - I appreciate you taking the time. I'm going to try to reinstall the database, see what happens ...

rgs 106 posts Joined 02/07
20 Aug 2007

Make sure before you reinstall it to delete “tdatuser” and the group “tdatudf” before you reinstall. If it sees a “tdatuser” on the system already it will not install it again. It can’t have a blank password. It has a specific one and only the installation process can set that up. If it does install it do not play with any of the settings or it will probably stop working.

trojancjs 17 posts Joined 03/07
20 Aug 2007

Thank you for the advice, rgs. I did remove both the 'tdatuser' I created and the 'tdatudf' group, and both were created by the installer when I reinstalled the database. I don't know what happened the first time! I'll come back and post all of my settings for anyone else interested ... Thanks to all!

joedsilva 505 posts Joined 07/05
20 Aug 2007

And yeah it's always useful to back up those Amp*disk* files in tdconfig directory before the reinstall, just replacing those DB files after the install, get's you back on to your old database. (provided the original cause for re-install is not a bad AMP file system)Of course you need to recompile the UDFs because they are kept as external libraries.ALTER FUNCTION udfname RECOMPILE;ALTER FUNCTION udfname EXECUTE NOT PROTECTED; -- recompile makes udfs protected automatically.

dentwist 1 post Joined 11/07
20 Nov 2007

Thank you everyone. I had the same problem trying to create stored procedures in Teradata Demo v2R6.1 and these posts helped me to solve the problem. Strange that Teradata seems to need registry keys for[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1], whereas my Visual Studio 2005 installation has keys for [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0]. Adding the following 2 keys worked just fine:[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1]"InstallDir"="C:\Program Files\Microsoft Visual Studio 8\Common7\IDE"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VC]"ProductDir"="C:\Program Files\Microsoft Visual Studio 8\VC\"I also needed to use cufconfig -f to set the following (as per previous posts):CompilerPath: c:\Program Files\Microsoft Visual Studio 8\VC\bin\CL.EXELinkerPath: c:\Program Files\Microsoft Visual Studio 8\VC\bin\LINK.EXEThanks again.

emilwu 72 posts Joined 12/07
15 Dec 2007

what about visual studio express 2008?After setting the registry value cufconfig returns correct value, but the create procedure returns error 5863: Problem encountered during linking phase of OBJ code.

gnangoma-2184 4 posts Joined 12/05
15 Mar 2008

Hello,I hope that you were able to sort out your problem compiling and creating UDF using MS Visual Studio 2008. I was able to create the udf after following the instructions in this thread!! The tricky is just to replace version 8 by 9.0 when editing registry & cufconfig -f as follows instead of "C:\Program Files\Microsoft Visual Studio 8\VC" use"C:\Program Files\Microsoft Visual Studio 9.0\VC"Also make sure to use manually the libraries msvcrt.lib, libcmt.lib in your "create function file" i.e SL!msvcrt!SL!libcmt!The challenge I am having right now is that; even though I successfully created the functions, somehow when I call them in my SQL, i get the error message:*** Failure 7506 The library for UDF/XSP/UDM NSTEST.myFunction could not be found". Strange enough, I can find the library in the LDIR directory been successfully created.LDIR directory for me is at C:\Program Files\NCR\TDAT\tdconfig\udflib\tdbs_1038\Let me not hide another fact here, when I compiled I got a warning saying that. " *** Function has been created. *** Warning: 5607 Check output for possible warnings encountered in compiling and/or linking UDF/XSP/UDM/UDT. *** Total elapsed time was 9 seconds.Check output for possible compilation warnings---------------------------------------------------------------------------Microsoft (R) Program Maintenance Utility Version 9.00.21022.08Copyright (C) Microsoft Corporation. All rights reserved.

rayedmond 12 posts Joined 12/09
26 Jul 2011

How do you get the GDO changes to stick? As soon as I restart Teradata the changes are gone and I have to rerun cufconfig.

rayedmond 12 posts Joined 12/09
04 Aug 2011

Got this figured out. Once I got the right compiler MS VC++ Express 2008 (2010 is not yet supported on TD 13) cufconfig -i works.

ayman.guc 27 posts Joined 10/11
14 Jan 2012

It is VERY IMPORTANT TO MAKE SURE to run the Visual studio to initialise the environment variables first (only for first-time use after installation) before starting Teradata and creating your procedures...this is very important to complete the environment installations for the C compilers. When you start both the Microsoft Visual C++ 2008 Express Edition and the Visual Studio 2008 Command Prompt applications you will see initialization messages (the applications can be found under start >> all programs >> Microsoft Visual C++ 2008 Express Edition). When the initialization is done then you are ready to use the C compilers with Teradata

There is no need to edit registry files if you just want to compile stored procedures / UDFs in Teradata. You can see the post at http://forums.teradata.com/forum/enterprise/compiling-stored-proc-vc-not-installed-error#comment-18677  for more details.

You must sign in to leave a comment.