commit | bc6643bb26322aff66a3548bf05ac6e2f4912f1e | [log] [tgz] |
---|---|---|
author | bjacob <benoitjacob@google.com> | Mon Oct 16 16:55:11 2023 -0400 |
committer | GitHub <noreply@github.com> | Mon Oct 16 16:55:11 2023 -0400 |
tree | 5740193a324149889fb3788bf7e16fa4d6fbd3db | |
parent | 9d7a4babf893d1719b020fb810a08d973453f1ba [diff] |
Fix `ireeCompilerLoadBinary` on Apple: pass unprefixed symbol name to `dlsym` (#15201) This PR fixes this test failure on macOS: ``` ctest -R iree/compiler/bindings/c/loader_test --output-on-failure Test project /Users/benoitjacob/iree-build Start 449: iree/compiler/bindings/c/loader_test 1/1 Test #449: iree/compiler/bindings/c/loader_test ...***Failed 0.37 sec IREE COMPILER ERROR: Could not find symbol 'ireeCompilerGetAPIVersion' ERROR: Could not load library ``` The symbol names are indeed prefixed with leading `_` in the `.dylib` being loaded: ``` ~/iree-build nm /Users/benoitjacob/iree-build/lib/libIREECompiler.dylib | grep ireeCompilerGetAPIVersion 0000000000018270 T _ireeCompilerGetAPIVersion ``` But `dlsym`, which is being used to perform the lookup, still wants us to pass the unprefixed symbol name, as apparently it is doing the prefixing on its own. From [`man dlsym` (Apple)](https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dlsym.3.html): ``` NOTES Unlike other dyld API's, the symbol name passed to dlsym() must NOT be prepended with an underscore. ``` Also some echoes on that on mailing lists around: https://luajit.freelists.narkive.com/QJrHoi0u/os-x-leading-underscores-and-symbol-name-redirection Which refers to an earlier Apple `dlsym` man page (the link is now dead) that was more helpfully stating: ``` The symbol name passed to dlsym() is the name used in C source code. For example to find the address of function foo(), you would pass "foo" as the symbol name. ```
IREE (Intermediate Representation Execution Environment, pronounced as “eerie”) is an MLIR-based end-to-end compiler and runtime that lowers Machine Learning (ML) models to a unified IR that scales up to meet the needs of the datacenter and down to satisfy the constraints and special considerations of mobile and edge deployments.
See our website for project details, user guides, and instructions on building from source.
IREE is still in its early phase. We have settled down on the overarching infrastructure and are actively improving various software components as well as project logistics. It is still quite far from ready for everyday use and is made available without any support at the moment. With that said, we welcome any kind of feedback on any communication channels!
See our website for more information.
IREE is licensed under the terms of the Apache 2.0 License with LLVM Exceptions. See LICENSE for more information.