Skip to content

Commit

Permalink
Added notes on linking on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
alkeldi committed Aug 23, 2020
1 parent b9231a4 commit 883327b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ By default the libraries and headers will be installed in `/usr/local/lib/` and

You have to make the system's runtime aware of the location of the new library to be able to run dynamically linked applications.
This might be as simple as running the following command if your `/etc/ld.so.conf` contains the install directory.

**Note: macOS doesn't support ldconfig.**
```
sudo ldconfig
```
Expand Down Expand Up @@ -157,6 +159,8 @@ Now we need to compile and link our program. Since `make` builds both the static
If we wish to statically link the library to our program we can pass the `-static` flag to the compiler
**Note:** On macOS, the **`-static`** flag is not very friendly (it requires that all the libraries are statically linked). So we can replace **`-static -lcollectc`** with the full path to the static library. Which is **`/usr/local/lib/libcollectc.a`** by default.
```
gcc hello.c -static -lcollectc -o hello
```
Expand Down

0 comments on commit 883327b

Please sign in to comment.