fpco / inline-c

284 stars 51 forks source link

`ld: sectionForAddress(0x1DD10) address not in any section file` error #135

Open roberth opened 2 years ago

roberth commented 2 years ago

Today I refactored some code and forgot to remove the C.context and C.include calls from a file when I moved all the inline-c/inline-c-cpp invocations to another module. The build then failed on darwin with:

ld: sectionForAddress(0x1DD10) address not in any section file 'dist/build/hercules-ci-agent-worker/hercules-ci-agent-worker-tmp/Hercules/Agent/Worker.o' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)

The solution was to remove C.context and C.include from the module that didn't need them anymore.

Ideally inline-c could raise an error when it's not actually used in a module. I don't know if that's feasible. Perhaps the error itself can be prevented? It doesn't happen on Linux. This may be a GHC bug.

Seems like a low priority bug.