Teradata C++ UDF - teradata

I tried to create a function using object file and by using the following set of queries
REPLACE FUNCTION db_1.append(inputString VARCHAR(512))
RETURNS VARCHAR(512)
LANGUAGE CPP
NO SQL
EXTERNAL NAME 'CO!tokenise!/root/Desktop/tokenise.o!F!append'
PARAMETER STYLE TD_GENERAL;
I had built gcc from source and created a soft link of gcc executable and g++ to the /usr/bin directory.After inserting the object file I got the following error inside teradata.
*** Failure 5600 Error creating UDF/XSP/UDM/UDT: no compiler available.
Statement# 1, Info =0

Related

ranlib Error using Alire and GNAT with ASFML

i am learning how to use Alire using the Ada binding to SFML which is ASFML. So far I have downloaded
and installed ASFML using Alire and have successfully imported it into my test project. When I go to compile it, it does compile and bind but gets stuck on the Linker phase.
Here is the error:
gprbuild -d -PC:\Users\Amynu\testproj\testproj.gpr -XASFML_BUILD_MODE=optimize -XASFML_CONTRACTS=enabled -XASFML_STYLE_CHECKS=enabled -XASFML_RUNTIME_CHECKS=enabled -XASFML_COMPILE_CHECKS=enabled -XOS=Windows_NT -XTESTPROJ_BUILD_MODE=optimize -XTESTPROJ_CONTRACTS=disabled -XTESTPROJ_STYLE_CHECKS=disabled -XTESTPROJ_RUNTIME_CHECKS=disabled -XTESTPROJ_COMPILE_CHECKS=disabled
Compile
[Ada] testproj.adb
Bind
[gprbind] testproj.bexch
[Ada] testproj.ali
Link
[link] testproj.adb
c:/gnat/2021/bin/../libexec/gcc/x86_64-w64-mingw32/10.3.1/ld.exe: C:\Users\Amynu\testproj\alire\cache\dependencies\asfml_2.5.2_b775db19\lib\libasfml.a: error adding symbols: archive has no index; run ranlib to add one
collect2.exe: error: ld returned 1 exit status
gprbuild: link of testproj.adb failed
I have absolutely no idea what a "ranlib" is, I searched Alire but it's not a known crate or a library. I tried various options in Alire such as
alr with libranlib
and
alr get ranlib
To no avail. Is it an option within GNAT's command line? I did look into the GPR file for the project and that all looks alright. One the GPR's being auto generated by Alire when I build the project with
alr init --bin testproj
alr cd testproj
alr with libasfml
alr build
I did a Google search and found a lot of solutions connected to Unix and IBM(?) something about ranlib being outdated as most compilers use "rm" now? I couldn't find a solution to GNAT flagging the same error.
Am I just using an outdated audio library?
Thanks in advance for any help :)
Thank you guys! That solved the problem. Now I am stuck with a loads of "undefined references to..." I actually went through all the source files and got rid of all the warnings by addIng Constant to most variable names. I am guessing it's looking for a dependency that is missing?
Build Libraries [gprlib] asfml.lexch [link library] libasfml.dll c:/gnat/2021/bin/../libexec/gcc/x86_64-w64-mingw32/10.3.1/ld.exe: C:\Users\Amynu\testproj\alire\cache\dependencies\asfml_2.5.2_b775db19\obj\sf-audio-music.o:sf-audio-music.adb:(.text+0x32): undefined reference to `sfMusic_createFromFile'
And about 15 lines under that with the same error type. After looking into it, I had a look a the lines of code the error were referring to and found the errors are referencing what look like external files? Is their a part of ASFML that didn't download with the library?
I scoured the code for the first linker error and found line it's referring to.
with Interfaces.C.Strings;
package body Sf.Audio.Music is
use Interfaces.C.Strings;
--//////////////////////////////////////////////////////////
--/ Create a new music and load it from a file
--/
--/ #param Filename Path of the music file to open
--/
--/ #return A new sfMusic object (NULL if failed)
--/
--//////////////////////////////////////////////////////////
function CreateFromFile (Filename : String) return sfMusic_Ptr is
function Internal (Filename : chars_ptr) return sfMusic_Ptr;
pragma Import (C, Internal, "sfMusic_createFromFile");
Temp : chars_ptr := New_String (Filename);
R : sfMusic_Ptr := Internal (Temp);
begin
Free (Temp);
return R;
end CreateFromFile;
I cannot find the file it's trying to reference anywhere in the ASFML library. Was it left out?
So far, I have managed to successfully build ASFML in Alire with
alr get asfml
cd asfml
alr build asfml
This worked fine. Then I successfully imported into my project with
cd myproj
alr myproj with asfml
Again, do problems. Then I attempted to build it (after correcting the ranlib error) and I got the same load of linker errors. I don't understand why, as I successfully built the asfml library before I imported it wit Alire. Is it just a file I am missing, or do I have to explicitly tell the linker where the asfml file is?
Some of the errors.
Compile
[Ada] alicegame.adb
Build Libraries
[gprlib] asfml.lexch
[link library] libasfml.dll
c:/gnat/2021/bin/../libexec/gcc/x86_64-w64-mingw32/10.3.1/ld.exe: C:\Users\Amynu\alicegame\alire\cache\dependencies\asfml_2.5.2_b775db19\obj\sf-audio-music.o:sf-audio-music.adb:(.text+0x32): undefined reference to `sfMusic_createFromFile'
c:/gnat/2021/bin/../libexec/gcc/x86_64-w64-mingw32/10.3.1/ld.exe: C:\Users\Amynu\alicegame\alire\cache\dependencies\asfml_2.5.2_b775db19\obj\sf-audio-soundbuffer.o:sf-audio-soundbuffer.adb:(.text+0x22): undefined reference to `sfSoundBuffer_createFromFile'

Robotframework, AutoIt: Error message "No keyword with name 'Send' found"

I'm trying to get familiar with the robotframework using autoitlibrary to test Windows applications. I found some examples which use the Send command to type text into a notpad window.
That's what I've done so far:
*** Settings ***
Library AutoItLibrary
*** Variables ***
${app} C:/Program Files/Notepad++/notepad++.exe
*** Test Cases ***
Enter text
Run ${app}
Win Wait Active new 1 - Notepad++
Send This is just a test.
So, the Notepad++ window is opened, but then it failed with the No keyword with name 'Send' found. message. I suppose there is no Send command in the AutoItLibrary, but I also cannot find any other command which may do this job.
AutoIt is installed, and so is the wrapper by pip install robotframework-autoitlibrary.
There really exists a Send keyword in AutoIt, but supposedly not in the wrapper for robotframework.
And ideas to fix this?
UPDATE: Windows 10 (64bit in a VirtualBox), Python v3.7.6 (32bit), RF v3.1.2, RF-AutoItLibrary v1.2.4, AutoIt v3.3.14.5
The "Search Keywords" dialog in RIDE provides AutoItLibrary as a Source, but then list only a few commands. So I suppose the library is accessible, but incomplete.
import os, re, subprocess, sys
# Set path to Python directories.
programfiles = os.environ['programfiles']
if not programfiles:
exit('Failed to get programfiles')
python_dirs = [os.path.join(programfiles, 'Python35'),
os.path.join(programfiles, 'Python36'),
os.path.join(programfiles, 'Python37'),
os.path.join(programfiles, 'Python38')]
# Process each python directory.
for python_dir in python_dirs:
print('---')
# Set path to AutoItX3.dll.
autoitx_dll = os.path.join(python_dir, r'Lib\site-packages\AutoItLibrary\lib\AutoItX3.dll')
if not os.path.isfile(autoitx_dll):
print('File not found: "' + autoitx_dll + '"')
continue
# Set path to the makepy module.
makepy = os.path.join(python_dir, r'Lib\site-packages\win32com\client\makepy.py')
if not os.path.isfile(makepy):
print('File not found: "' + makepy + '"')
continue
# Generate cache using make.py.
command = [os.path.join(python_dir, 'python.exe'), makepy, autoitx_dll]
with subprocess.Popen(command, stderr=subprocess.PIPE, cwd=python_dir, universal_newlines=True) as p:
stderr = p.communicate()[1]
print(stderr.rstrip())
parameters = re.findall(r'^Generating to .+\\([A-F0-9\-]+)x(\d+)x(\d+)x(\d+)\.py$', stderr, re.M)
if len(parameters) == 1:
parameters = parameters[0]
print('Insert the next line into AutoItLibrary.__init__.py if not exist.\n'
' win32com.client.gencache.EnsureModule("{{{guid}}}", {major}, {minor}, {lcid})'
.format(guid=parameters[0],
major=parameters[1],
minor=parameters[2],
lcid=parameters[3]))
# Pause so the user can view the subprocess output.
input('Press the return key to continue...')
The generated cache done by win32com\client\makepy.py for AutoItLibrary from the setup.py is saved in the %temp%\gen_py folder. This is done only when setup.py is executed. If the %temp% directory is cleaned later, which removes the cache, then I notice keywords like Send may fail to be recognized by the robotframework.
One solution appears to be regenerating the cache. The code above will generate the cache by use of makepy.py. It may also print a message about inserting win32com.client.gencache.EnsureModule(...) into AutoItLibrary\__init__.py for any of the Python versions as needed. This will ensure the cache is available when AutoItLibrary
is imported.
Change paths in the code to suit your environment.
With further research:
AutoItLibrary currently has AutoItX 3.3.6.1 and latest AutoIt has AutoItX 3.3.14.5. Important to know as one version registered can overwrite the registration of the previous registration.
AutoItLibrary currently registers AutoIt3X.dll without the _x64 suffix on the name on x64 systems. I may reference AutoIt3_x64.dll to define difference between x86 and x64.
Any version of AutoIt3X.dll and AutoIt3_x64.dll uses the same ID codes and the last registered wins (based on bitness as both x86 and x64 registrations can co-exist).
The TypeLib class key registered ID is {F8937E53-D444-4E71-9275-35B64210CC3B} and is where win32com may search.
If AutoIt3X.dll and AutoIt3_x64.dll are registered, unregister any 1 of those 2 will remove the AutoItX3.Control class key. Without this key, AutoIt3X will fail as AutoItLibrary needs this key. To fix, register again e.g. regsvr32.exe AutoIt3X.dll as admin in the working directory of AutoIt3X.dll.
The methods of any same version of AutoItX will match i.e. AutoIt3X.dll and AutoIt3X_x64.dll only changes in bitness, not methods.
Inserting win32com.client.gencache.EnsureModule("{F8937E53-D444-4E71-9275-35B64210CC3B}", 0, 1, 0) into AutoItLibrary\__init__.py should ensure the cache is always available for any AutoItX version. The initial code can be used to generate the cache, though the suggested change in AutoItLibrary\__init__.py makes it obsolete as the cache is generated on import of AutoItLibrary. If the ID was not constant, then the initial code may inform you of the ID to use.
The cache is important as it has generated .py files with methods like e.g.:
def Send(self, strSendText=defaultNamedNotOptArg, nMode=0):
'method Send'
# etc...
which if missing, makes Send and many others, an invalid keyword in AutoItLibrary.
If AutoItX 3.3.14.5 is registered, the - leading methods are removed and the + leading methods are added as compared to AutoItX 3.3.6.1:
-BlockInput
-CDTray
-IniDelete
-IniRead
-IniWrite
-RegDeleteKey
-RegDeleteVal
-RegEnumKey
-RegEnumVal
-RegRead
-RegWrite
-RunAsSet
+RunAs
+RunAsWait
So if any of those methods causes error, then you may want AutoItX 3.3.6.1 registered instead. In the AutoItX history, 3.3.10.0 release is when those method changes happened.
Fix:
Check your python architecture ( is it 32 or 64 bit)
For 32:
Open cmd in "Run as administrator" mode
run the command pip install robotframework-autoitlibrary
Now clone the autoit library source code:
https://github.com/nokia/robotframework-autoitlibrary
in the root directory run the below command: python setup.py install using cmd in admin mode
to navigate to root directory use the command pushd <filepath>' instead ofcd ` if cd doesn't work in cmd opened in admin mode.
For 64:
Open cmd in "Run as administrator" mode
Now clone the autoit library source code:
https://github.com/nokia/robotframework-autoitlibrary
in the root directory run the below command: python setup.py install using cmd in admin mode
to navigate to root directory use the command pushd <filepath>' instead ofcd ` if cd doesn't work in cmd opened in admin mode.

.load pcre.so from command line

I'm running some command line sqlite3 queries (sqlite 2.8.17 Linux Mint 18.02) using regexp. This produces the error:
Error: no such function: REGEXP
I've already installed sqlite3-pcre. If I run sqlite3 interactively, I can successfully run my query after executing .load /usr/lib/sqlite3/pcre.so
Attempting to load the library on the command line produces an error:
sqlite3 my.db ".load /usr/lib/sqlite3/pcre.so;select * from foo where description REGEXP 'Some Expression'"
Error: /usr/lib/sqlite3/pcre.so;select.so: cannot open shared object file: No such file or directory
How do I include the .load with my command-line query? Can I put the library in an rc file somewhere?
Seemed obvious once I conceptualized the question about putting options in an rc file:
$ cat ~/.sqliterc
.load /usr/lib/sqlite3/pcre.so

frama-c mingw __restrict__ keyword

I am new to Frama-C. I would like to run it under Windows enviroments. My compiler is gcc,mingw.
I have tryied to run same examples from Value Analysis tutorial by I have a problem with library header files.
I've found that it's not possible to run frama-c because restrict keyword. It shows error in string.h file
void * __cdecl memcpy(void * __restrict__ _Dst,const void * __restrict__ _Src,size_t _Size) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
When I manually add #define restrict to all *.c files in SkeinProject
schneier.com/code/skein_NIST_CD_102610.zip
everything works correcly. By doing it by hand is not what I'm looking for.
Next step was to add argument -D__restrict__
frama-c -cpp-extra-args=-D__restrict__ -main=Init -val SHA3api_ref.c
[kernel] preprocessing with "gcc -C -E -I. -D__restrict__ SHA3api_ref.c"
../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/string.h:41:[kernel] user error: syntax error
[kernel] user error: skipping file "SHA3api_ref.c" that has errors.
[kernel] Frama-C aborted because of an invalid user input.
I've also generated precompiled *.i files but error still the same.
gcc -E -D__restrict__ SHA3api_ref.c >SHA3api_ref.i
frama-c -main=Init -val SHA3api_ref.i
../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/string.h:41:[kernel] user error: syntax error
[kernel] user error: skipping file "SHA3api_ref.i" that has errors.
[kernel] Frama-C aborted because of an invalid user input.
What can I do with it?
Your system headers contain non-standard syntax extensions that are not supported by Frama-C. This is normal, as the headers are often provided as part of a complete package with the compiler, so the headers and the compiler only need to work together, not to work with all the other programs that take C source code as input.
Generally speaking, you should always use the headers provided with Frama-C
instead of those from your system.
When using GCC or a compatible compiler such as Clang, this involves
passing the pre-processor the options -nostdinc and -I... where ...
stands for the place where Frama-C's headers were installed. This
location can be obtained from Frama-C with the option -print-share-path.
All in all, on a Unix system, it may look like:
frama-c -cpp-extra-args=-nostdinc -cpp-extra-args=-I`frama-c -print-share-path`/libc .....
Doing the same thing with Windows and MinGW follows the same idea but sometimes involves extra trouble due to the perpetual ambiguity between \ and / as directory separators.
Recently, Frank Dordowsky has been having trouble with using a very new GCC version to pre-process C files for Frama-C. That was only when using -pp-annot, but in any case, the solution was to switch to Clang as pre-processor.

Fail to link to standard library of Ocaml-java (or Cafesterol)

I am a new user of Ocaml-java (or Cafesterol) which compiles primtive Ocaml program to executable jar that is allowed run on JVM. However when I try to compile a test program into executable jar I got error info as follow:
>java -jar ~/ocaml-project/ocamljava-bin-1.4/bin/ocamljava.jar -standalone regexdna.ml -o regexdna.jar
File "regexdna.ml", line 1, characters 0-1:
Error: No implementations provided for the following modules:
Str referenced from regexdna.cmj
Unix referenced from regexdna.cmj
It seems module Str and Unix is missing from Ocaml-java. However, str.jar and unix.jar do exist under ~/ocaml-project/ocamljava-bin-1.4/lib/others/ when I install Ocaml-java, and within these jars we do have Str.class and Unix.class. (I suppose this directory is on the path of the standard library of Ocaml-java, so it should be included in default search path)
Can any Ocaml-java user tell me how Ocaml-java search for dependency libraries?
Quoting Xavier Clerc on this :
Well it should work, but you have to pass explicitly the referenced
library (just as in vanilla OCaml). Leading in your case to:
$ /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -jar ~/opt/ocamljava-2.0-early-access9/lib/ocamljava.jar str.cmja regexdna.ml
Note that I am using the latest ocamljava preview.

Resources