.NET Core: undefined symbol: GOMP_parallel while loading RAW image
Prerequisites
- [x] I have written a descriptive issue title
- [x] I have verified that I am using the latest version of Magick.NET
- [x] I have searched open and closed issues to ensure it has not already been reported
Description
We're building a .NET Core app that converts images to Pyramid TIFFs. Most images work, but the RAW test files we have don't. The app crashes with the following error:
./magick_test: symbol lookup error: /opt/magick_test/Magick.NET-Q8-x64.Native.dll.so: undefined symbol: GOMP_parallel
After a lot of trial and error, we found that calling new MagickImage([string]) caused the above error, while new MagickImage([FileStream]) works all the time.
Steps to Reproduce
Run the following code with this test image.
The error will show up in linux, but not windows.
static void Main(string[] args)
{
string inputPath = @"/path/to/raw.cr2";
string outputPath = @"/path/to/ptif.tif";
//FileStream fileStream = new FileStream(pathToFile, FileMode.Open);
using (MagickImage magickImage = new MagickImage(inputPath))
{
magickImage.Format = MagickFormat.Ptif;
magickImage.Settings.SetDefine(MagickFormat.Tiff,
"ignore-layers",
true);
magickImage.Settings.SetDefine(MagickFormat.Tiff,
"tile-geometry",
"256x256");
magickImage.Settings.Compression = CompressionMethod.JPEG;
magickImage.Settings.ColorSpace = ColorSpace.RGB;
magickImage.Write(outputPath);
}
}
System Configuration
- Magick.NET version: 7.10.2 (NuGet)
- Environment (Operating system, version and so on): Ubuntu 16.04.5 LTS, .NET Core 2.2
Is it possible to create a docker image that I can use to reproduce this issue?
I don't know how useful will this be but:
Uses new MagickImage([string]):
docker run adrianlibnova/tests:latest /opt/magick_test_error/magick_test /opt/TEST.CR2 /opt/out.ptif
Uses new MagickImage([FileStream]):
docker run adrianlibnova/tests:latest /opt/magick_test_error/magick_test /opt/TEST.CR2 /opt/out.ptif
The test file is inside the docker image. The source code is exactly as my issue, but i'm using args[] instead of fixed paths.
I was actually looking for a DockerFile so I can see what is happening and inspect the host easier.
Thanks for helping me out and providing the test repo. It turns out that libraw (that is used for CR2 libraries) was build with OpenMP enabled. Just pushed a patch to fix this.
What I don't understand is why did it work with a FileStream and not the path? Is it not processing the raw using the FS method? Could it be processing an embedded thumbnail instead?
It probably has to do with the code path that will be used. When you use the FileStream it will create a temporary file and pass that to the libraw library. But that file will not have the CR2 extension. I am guessing that a different code path was chosen based on the extension. Could take a deeper look at this but OpenMP should definitely be disabled in the libraw library.