Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load shared library nironcompress (Macbook Pro Intel, Azure Function) #207

Closed
josdeweger opened this issue Dec 15, 2022 · 35 comments

Comments

@josdeweger
Copy link

josdeweger commented Dec 15, 2022

Version: Parquet.Net v4.1.2
Runtime Version: .NET 6
OS: MacOSX (Intel)

Expected behavior

Expected Parquet.NET to load all necessary dependencies

Actual behavior

I get the following error when running the function locally:

System.Private.CoreLib: Exception while executing function: MyFunctionName. IronCompress: Unable to load shared library 'nironcompress' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libnironcompress, 0x0001): tried: 'libnironcompress' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibnironcompress' (no such file), '/usr/lib/libnironcompress' (no such file, not in dyld cache), 'libnironcompress' (no such file), '/usr/local/lib/libnironcompress' (no such file), '/usr/lib/libnironcompress' (no such file, not in dyld cache).

Steps to reproduce the behavior

  1. Create the example from the getting started section
  2. Run it inside an Azure Function on MacOSX

Thank you for any help on this!

@aloneguid
Copy link
Owner

Do you mind attaching a sample project and instructions how to run it? Not sure I'm good with Azure Functions.

@josdeweger
Copy link
Author

josdeweger commented Dec 15, 2022

Thanks for the quick response. No problem, here you go! You only need to add a parquet file called example.parquet to the root of the project.

Run the function (vscode might be best for this, you might need the vscode Azure Functions extension for this), then hit the http endpoint that is outputted in the console with the tool of your choice (curl, Postman etc.).

The exception occurs here: await groupReader.ReadColumnAsync(dataFields[c])

@josdeweger
Copy link
Author

@aloneguid if there is anything I can do to help, let me know. Might need some directions in the solution though...

@aloneguid
Copy link
Owner

@josdeweger just looked at the attached zip, and inside ExampleParquetFunction.zip\ExampleParquetFunction\Example\bin\Debug\net6.0\bin\runtimes there's win-x64 folder which is weird - this is normally happening when compiled on Windows. Are you compiling and running on the same os?

@josdeweger
Copy link
Author

josdeweger commented Dec 19, 2022

@aloneguid That's unexpected indeed. I just removed the bin folder and built the project again on my macbook, with the same result:

image

@josdeweger
Copy link
Author

@aloneguid had a bit of time to look at this tonight. When I copy ExampleParquetFunction/Example/bin/Debug/net6.0/runtimes/osx-x64/native/libnironcompress.dylib to /usr/local/lib/libnironcompress.dylib it works. Maybe that tells you something

@josdeweger
Copy link
Author

tried again with my new Macbook Pro with M1 processor, same issue. Had to copy the dylib file manually to the local/lib folder to make it work

@rustyswayne
Copy link

@aloneguid I had a similar issue where I could correct create a parquet file when testing my Azure Function locally, but found it failed once I deployed the function application to run in Azure. I was able to resolve my issue but tweaking the configuration of the Azure Function application in Azure, changing the Platform from 32 bit to 64 bit.

Parquet Microsoft Azure

@aloneguid
Copy link
Owner

You can run any bitness or platform if data is uncompressed, gzip or brotli. Other codecs use native interop and hence call to native compression lib. Unfortunately those are not available in .net and I couldn't find any good implementations.

It should be improved soon though. Optionally we can have a compression callback if you have preferred library available on your platform.

@aloneguid
Copy link
Owner

Regarding windows, native compression does not support 32bit. Only 64 and arm.

@aloneguid
Copy link
Owner

Please try with v4.2.3. If the worst case it should give a better error message.

@amnontopel
Copy link

Any findings on this one? Seeing the same thing

@josdeweger
Copy link
Author

@aloneguid I gave v4.2.3 a try, unfortunately the problem was not resolved, but indeed the error message is a bit more clear:

[2023-01-19T13:22:19.378Z] Executed 'HttpTrigger' (Failed, Id=9fd4d649-2d0c-4c5d-878f-d71c05d49b9e, Duration=163ms)
[2023-01-19T13:22:19.378Z] System.Private.CoreLib: Exception while executing function: HttpTrigger. IronCompress: Unable to load nironcompress (Arm64/osx.13-arm64/). CD: /Users/josdeweger/dev/gefreubel/parquet/ExampleParquetFunction/Example/bin/Debug/net6.0. System.Private.CoreLib: Unable to load shared library 'nironcompress' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libnironcompress, 0x0001): tried: 'libnironcompress' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibnironcompress' (no such file), '/usr/lib/libnironcompress' (no such file, not in dyld cache), 'libnironcompress' (no such file), '/usr/local/lib/libnironcompress' (no such file), '/usr/lib/libnironcompress' (no such file, not in dyld cache).

@aloneguid
Copy link
Owner

@josdeweger do you mind trying in a console project with your set up? Just want to rule out it's not Azure Function related issue.

@josdeweger
Copy link
Author

@aloneguid I just gave it a try in a console app (removed the dylib file from local/lib), and it works without issues. So it might be Azure Function related

@aloneguid
Copy link
Owner

Thanks, that's interesting! I suspect Azure Functions is using a custom hosting runtime. I'll get a proper setup to investigate.

@josdeweger
Copy link
Author

awesome, let me know if I can be of any further assistence!

@cajuncoding
Copy link
Contributor

cajuncoding commented Jan 19, 2023

Yep I encountered this afree updating to new versions also. I use Parquet.Net exclusively in serverless background processes that run as Azure Functions.

I’ll try checking the bitness of my Function App as noted by @rustyswayne and report back if that resolves it…

@josdeweger Thanks for posting this issue and all the details in the thread! Saved me a lot of time trying to sort out what this error was all about! 🙏

@josdeweger
Copy link
Author

@aloneguid is doing all the work here, so kudo's to him!

@cajuncoding
Copy link
Contributor

cajuncoding commented Jan 19, 2023

Woot! 🙌

Yes I confirmed that updating my Azure Function (In-process / Windows deployed) app to 64 Bit resolved the issue, I'm not sure why this is an issue in Azure Functions per @aloneguid 's comments above and in the Github documentation for IronCompress Windows should have worked with 32-bit deployment, but at least this is an easy fix (and perhaps AzFunc (v4 runtime) needs to be added explicitly to this IronCompress compatibility Matrix):

image

For anyone else looking for how to update your Function App, the setting is located in:
Azure Function -> Configuration -> General Settings

image

Edited - 01/22/2023: Initially I thought this was Linux deployment but it's actually a Windows AzFunc deployment.

@amnontopel
Copy link

I was able to overcome this by copying the missing dll to the bin folder. However I am getting a differnt errorr now: "An attempt was made to load a program with an incorrect format". this is solved only if setting the target platform of the project as x64 which isn't an option in my case. any idea?

@aloneguid
Copy link
Owner

@amnontopel are you writing or reading files from the function?

@amnontopel
Copy link

amnontopel commented Jan 21, 2023 via email

@aloneguid
Copy link
Owner

As a workaround today you can set compression level to Gzip or Brotli, those are not using native calls so it works on any platform. Ik working on bringing the rest to more platforms, including web assembly.

@amnontopel
Copy link

amnontopel commented Jan 23, 2023 via email

@aloneguid
Copy link
Owner

ParquetWriter has CompressionMethod property.

@amnontopel
Copy link

amnontopel commented Jan 23, 2023 via email

@aloneguid
Copy link
Owner

No, encoding and compression are unrelated.

@amnontopel
Copy link

amnontopel commented Jan 23, 2023 via email

@aloneguid
Copy link
Owner

try with 4.3.4

@amnontopel
Copy link

amnontopel commented Jan 23, 2023 via email

@amnontopel
Copy link

amnontopel commented Jan 23, 2023 via email

@aloneguid
Copy link
Owner

Code and error please

@amnontopel
Copy link

amnontopel commented Jan 23, 2023 via email

@aloneguid
Copy link
Owner

I can't run above as it's hard to guess out of context what need to be done. The exception indicates that data type is not supported, so I'd check what exactly you are passing to the library. It does support non-string types for sure, including DateTime and int32. Exception message can be improved of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants