Terus
Terus

Reputation: 127

metallib: Error reading module: Invalid bitcode signature

I have following Filter.metal file

#include <metal_stdlib>
using namespace metal;
#include <CoreImage/CoreImage.h> // includes CIKernelMetalLib.h

extern "C" { namespace coreimage {

    float4 myColor(sample_t s) {

        return s.grba;
    }

}}

I am trying to compile it with:

xcrun metal -fcikernel Filter.metal -o Filter.air
xcrun metallib -cikernel Filter.air -o Filter.metallib

But I get this Error:

metallib: Error reading module: Invalid bitcode signature

I am trying to create a custom CIFIlter and I followed this: https://medium.com/@shu223/core-image-filters-with-metal-71afd6377f4 tutorial.

The command lines I got from https://developer.apple.com/metal/MetalCIKLReference6.pdf.

How can I compile my file without this error?

Upvotes: 2

Views: 1192

Answers (1)

Terus
Terus

Reputation: 127

The response from Bug reporter was:

Apple Developer Relations
October 29 2018, 4:08 AM

Engineering has the following feedback for you:

The documentation is incorrect here. One should add a “-c” to force an AIR file, i.e.,

xcrun metal -fcikernel MyKernels.metal -c -o MyKernels.air

We are now closing this bug report.

If you have questions or comments about the resolution, please update your bug report with that information so we can respond.

Upvotes: 6

Related Questions