Jump to content
Mads

Open G Zip Tools on Linux RT

Recommended Posts

Ok guys, I managed to organize a nice iMac in order to be able to compile and test a shared library of the OpenG ZIP Toolkit. However I have run into a small roadblock. I downloaded the LabVIEW 2014 for Mac Evaluation version and despite that it tells me that it is the 32 bit version, does it contain the 64 version of the import library in the cintools directory.

 

Therefore I would like to ask if someone could send me the lvexports.a file from the cintools directory from an earlier LabVIEW for Mac (Intel) installation, so that I can compile and test the shared library in the Evaluation version on this iMac. I'm afraid that even a regular LabVIEW 2014 for Mac installation might contain a 64 bit library in both installation, so the lvexports.a file from around LabVIEW 2010 up to 2013 would be probably safer, as those versions were 32 bit only and therefore more likely will also contain a 32 bit library file

Share this post


Link to post
Share on other sites

Just wanted to pop in and say thanks for the updated library with better (Linux) RT support. I've written my own GZip compression VI based on the DEFLATE and CRC32 VIs in the library and I was hoping to be able to use it on the RT / Linux RT sbRIOs. I'm using it for compressing JSON data to send over the network.

 

I've posted the VI over on the NI Community (awaiting moderation) in case anyone else needs a GZip compression VI.

 

Thanks! :)

Share this post


Link to post
Share on other sites

I've posted the VI over on the NI Community (awaiting moderation) in case anyone else needs a GZip compression VI.

 

Nice, thanks! Mind re-posting them here with a more friendly license?

Share this post


Link to post
Share on other sites

I already replied on NI and would like to ask here for help. Using Sam_Sharps method i try to decopress a zipped stream of and run out of memory, which seems strange as the string is only about some about 1 MB long.

 

Do I need to work on parts of the string? I see there is a calculation for the compression and the memory allocated to the containing the uncompressed string. How can this be so large for such a small stream?

 

What I did is similar to this:

 

post-53992-0-02930800-1456829076.png

Edited by hofzge

Share this post


Link to post
Share on other sites

Please provide some sample data and VIs. As you refer to the GZIP VIs on the NI thread you need to make sure you have a proper GZIP stream you want to deflate. If you rather have a ZIP file stream you will need the ZIP functions in the ZLIB library instead. The Inflate algorithm simply assumes that the incoming data stream is a properly compressed (deflate) stream and if it is something else it certainly can get upset and cause all kinds of possible problems.

Share this post


Link to post
Share on other sites

Sorry for being so cryptic: What i try to replace is this:

  1. # Converts from base64 to binary   
  2. function ConvertFrom-Base64($string)    
  3. {   
  4.    $bytes  = [system.Convert]::FromBase64String($string);   
  5.    $decoded = [system.Text.Encoding]::UTF8.GetString($bytes);    
  6.    return $decoded;   
  7. }   
  8.   
  9. # Does buffered read of all bytes from a stream   
  10. # returns a char array   
  11. function ReadAllBytes($stream)    
  12. {   
  13.     $buffer = New-Object byte[](4096)      
  14.     $ms = New-Object System.IO.MemoryStream   
  15.   $bytesRead = 0   
  16.   do   
  17.     {   
  18.         $bytesRead = $stream.Read($buffer, 0, $buffer.Length)   
  19.     if ($bytesRead -gt 0)   
  20.     {   
  21.       $ms.Write($buffer, 0, $bytesRead)   
  22.     }   
  23.   } while ($bytesRead -gt 0)   
  24.   return [system.Text.Encoding]::UTF8.GetChars($ms.ToArray())   
  25. }   
  26.   
  27. # Removes 'Zipped:', Converts from base64 and unzips   
  28. function FromBase64AndUnzip($string)   
  29. {   
  30.     $string = $string.Replace("Zipped:""")   
  31.     $dataBytes = [system.Convert]::FromBase64String($string)   
  32.     $memStream = New-Object System.IO.MemoryStream $dataBytes, 0, $dataBytes.Count   
  33.     $memStream.Position = 0   
  34.     $gzipStream = New-Object System.IO.Compression.GzipStream $memStream, ([iO.Compression.CompressionMode]::Decompress)   
  35.     $uncompressed = ReadAllBytes($gzipStream)   
  36.     return New-Object String(($uncompressed), 0, $uncompressed.length)   
  37. }  

From what i understand this is in fact a gzip stream. Am I wrong?

Edited by hofzge

Share this post


Link to post
Share on other sites

Well I see a GZipStream in there, but not knowing the actual language you use it is hard to judge what specifics that may imply. Are you sure you did proper preparation of the byte stream, namely first removing the "Zipped:" string from the stream and then doing the correct Base64 decoding before trying to pass the resulting byte stream to the GZIP function?

Share this post


Link to post
Share on other sites

Well I see a GZipStream in there, but not knowing the actual language you use it is hard to judge what specifics that may imply. Are you sure you did proper preparation of the byte stream, namely first removing the "Zipped:" string from the stream and then doing the correct Base64 decoding before trying to pass the resulting byte stream to the GZIP function?

Thanks - being an idiot i forgot to convert from Base64 to String and this helped.

Share this post


Link to post
Share on other sites

I am using the ZLIB Library in my project. Originally it was used in 32 bit LabVIEW. Now I am porting it for 64 bit LabVIEW, and I am having issues with ZLIB.

Apparently, the DLL is not valid in 64 bit LabVIEW.

Has this been updated?

Specifically,  the ZLIB CRC32__ogtk.vi will not execute. The Call Library Node is pointing to an invalid library, and when I browse to the Library in the 64 Bit NI folder (C:\Program Files\National Instruments\LabVIEW 2014\user.lib\_OpenG.lib\lvzip\lvzlib.dll)  I get the error "The Library is not valid for the current platform. For example, you are running 64-bit LabVIEW and the library might be a 32-bit library.

I installed this via VI Package Manager for the 64 bit operating system.

Share this post


Link to post
Share on other sites
1 hour ago, Dan B said:

I am using the ZLIB Library in my project. Originally it was used in 32 bit LabVIEW. Now I am porting it for 64 bit LabVIEW, and I am having issues with ZLIB.

Apparently, the DLL is not valid in 64 bit LabVIEW.

Has this been updated?

Specifically,  the ZLIB CRC32__ogtk.vi will not execute. The Call Library Node is pointing to an invalid library, and when I browse to the Library in the 64 Bit NI folder (C:\Program Files\National Instruments\LabVIEW 2014\user.lib\_OpenG.lib\lvzip\lvzlib.dll)  I get the error "The Library is not valid for the current platform. For example, you are running 64-bit LabVIEW and the library might be a 32-bit library.

I installed this via VI Package Manager for the 64 bit operating system.

Follow the link I gave you in the other thread. It is the droid you are looking for.

Share this post


Link to post
Share on other sites
1 hour ago, ShaunR said:

Follow the link I gave you in the other thread. It is the droid you are looking for.

Got it. Everything works now, and my program is now primed for 64 bit use.

It's strange this isn't in the VI Manager as the most recent release, but whatever works.

Share this post


Link to post
Share on other sites
On 1.8.2016 at 10:30 PM, ShaunR said:

Follow the link I gave you in the other thread. It is the droid you are looking for.

Hello ShaunR,

 

can you post the Link of the thread here? I have the same problem as Dan B.

Thank you.

Share this post


Link to post
Share on other sites

Hi guys

I'm trying to use the lvzip library on a cRIO-9039 target... but I have a problem.
I'm using LabView 2017 + RT + FPGA modules installed. I installed the lvzip-4.1.0-b2 library from the link above, went smoothly.
When I try to run the main VI on the RT target, I got an error from the first attached image. I'm using the "ZLIB Extract All Files To Dir" VI (second attached image). If I disable the VI, the deploy & run is succesfull, with no errors.
Any ideas how to solve this? Should I manually install some files/libraries on the target? If yes then how can I do it i.e. any manual/thread available about this?

Thanks & regards!
Alex

 

zip01.png

Zip02.png

Share this post


Link to post
Share on other sites

Yes you need to install the shared library too. If you run VIPM to install the package you should have gotten a prompt somewhere along the install that asked you to allow installation of an additional setup program. This will install the NI Realtime extensions for the LVZIP library.

After that you need to go into NI MAX and go to your target and select to install additional software. Deselect the option to only show recommended modules and then there should be a module for the OpenG ZIP library. Install it and the shared library should be on your controller.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks, this worked!
I initially run the library installation on a non-admin acount. So that's why it skipped the part with installing the setup program.

1. Always install the libraries under administrator acount.
2. Enable the Secure Shell Server under NI MAX (attached screen).

Scr01.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.