This repository was archived by the owner on Dec 29, 2025. It is now read-only.
Commit 5bdf0c2
authored
Fix compile error on macOS (#116)
I was getting this error on macOS:
```
ld: library 'c++' not found
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```
Took a while to track down the issue, but it turned out this warning at
the end of `cmake` was key:
```
CMake Warning at src/CMakeLists.txt:40 (target_link_libraries):
Target "clickhouse_fdw" requests linking to directory
"/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk". Targets may link
only to libraries. CMake is dropping the item.
```
This is fine, except that that CMake doesn't remove the option this
directory points to. The option is stored by `pg_config`; you can see it
here:
``` console
pg_config --ldflags
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk -L/opt/homebrew/opt/readline/lib -Wl,-dead_strip_dylibs
```
What we need to do is remove both the macOS SDK and `-isysroot`. So add
a section to `CMakeLists.txt` that uses `REGEX REPLACE` to remove the
complete option from the output of `pg_config` on macOS.1 parent cc928fd commit 5bdf0c2
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| |||
0 commit comments