Skip to content

Commit

Permalink
Merge pull request #251 from fluxcd/pkg-config-openssl
Browse files Browse the repository at this point in the history
Respect PKG_CONFIG_PATH from the environment
  • Loading branch information
squaremo authored Nov 2, 2021
2 parents d293394 + 6c07b5a commit cb53e35
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
34 changes: 34 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,40 @@ $ brew install cmake [email protected] libssh2 pkg-config
$ LIBGIT2_FORCE=1 make libgit2
```

#### openssl and pkg-config

You may see this message when trying to run a build:

```
# pkg-config --cflags -- libgit2
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openssl', required by 'libgit2', not found
pkg-config: exit status 1
```

On some macOS systems `brew` will not link the pkg-config file for
openssl into expected directory, because it clashes with a
system-provided openssl. When installing it, or if you do

```console
brew link [email protected]
Warning: Refusing to link macOS provided/shadowed software: [email protected]
If you need to have [email protected] first in your PATH, run:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.profile

For compilers to find [email protected] you may need to set:
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
```

.. it tells you (in the last part of the message) how to add `openssl`
to your `PKG_CONFIG_PATH` so it can be found.

### Linux

```console
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ ${CACHE}/imagepolicies_${REFLECTOR_VER}.yaml:

test: $(LIBGIT2) test-api test_deps generate fmt vet manifests api-docs ## Run tests
LD_LIBRARY_PATH=$(LIBGIT2_LIB_PATH) \
PKG_CONFIG_PATH=$(LIBGIT2_LIB_PATH)/pkgconfig/ \
PKG_CONFIG_PATH=$(LIBGIT2_LIB_PATH)/pkgconfig/:$(PKG_CONFIG_PATH) \
go test ./... -coverprofile cover.out

test-api: ## Run api tests
cd api; go test ./... -coverprofile cover.out

manager: $(LIBGIT2) generate fmt vet ## Build manager binary
PKG_CONFIG_PATH=$(LIBGIT2_LIB_PATH)/pkgconfig/ \
PKG_CONFIG_PATH=$(LIBGIT2_LIB_PATH)/pkgconfig/:$(PKG_CONFIG_PATH) \
go build -o bin/manager main.go

run: $(LIBGIT2) generate fmt vet manifests # Run against the configured Kubernetes cluster in ~/.kube/config
Expand Down Expand Up @@ -133,7 +133,7 @@ fmt: ## Run go fmt against code
cd api; go fmt ./...

vet: $(LIBGIT2) ## Run go vet against code
PKG_CONFIG_PATH=$(LIBGIT2_LIB_PATH)/pkgconfig \
PKG_CONFIG_PATH=$(LIBGIT2_LIB_PATH)/pkgconfig:$(PKG_CONFIG_PATH) \
go vet ./...
cd api; go vet ./...

Expand Down

0 comments on commit cb53e35

Please sign in to comment.