Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix "Couldn't lookup symbols" error when linking external Swift libra…
…ries on Linux. Addresses google#4. On Linux, the REPL fails with "Couldn't lookup symbols" errors when: - Linking an external Swift shared library (produced by `swift build`) and importing the corresponding Swift module. - Importing the `TensorFlow` and `Python` modules, without manually linking `libswiftPython.so` and `libswiftTensorFlow.so`. A manual workaround involves specifying the `-lswiftPython` and `-lswiftTensorFlow` flags (in that specific order) when invoking the REPL. Also, `Python` and `TensorFlow` must be imported before the external Swift module to avoid the error. Conditionally adding the linker flags here seems to solve the issue. This is robust assuming that toolchain artifacts are not manipulated (so that somehow `Python.swiftmodule` exists while `libswiftPython.so` doesn't). PiperOrigin-RevId: 195572160
- Loading branch information