libwebp-dev support in Go app

557 views
Skip to first unread message

Eppie Vojt

unread,
Dec 30, 2020, 11:30:53 AM12/30/20
to NodeChef
I recently added a Go package to my project that requires libwebp-dev to function and, despite my best efforts, I can't get it to properly include the library.

I've tried updating my manifest.yml, adding an apt.yml file, using a bash script, and I still encounter a "fatal error: webp/encode.h: No such file or directory" problem.

I'm sure I'm missing something painfully obvious, as the NodeChef go hosting page notes "NodeChef supports startup bash scripts and the ability to declare ubuntu packages required in your runtime. For example you can declare you want "libmagickcore5-extra" in the container running your Go app and NodeChef will automatically install it for you."

What's the preferred method for including this?

For the sake of comprehensiveness, here's the error message I get when I deploy my project is:
Running: go install -tags cloudfoundry -buildmode pie .\\n# github.com\\\/kolesa-team\\\/go-webp\\\/decoder\\nvendor\\\/github.com\\\/kolesa-team\\\/go-webp\\\/decoder\\\/decoder.go:6:10: fatal error: webp\\\/decode.h: No such file or directory\\n #include <webp\\\/decode.h>\\n          ^~~~~~~~~~~~~~~\\ncompilation terminated.\\n# github.com\\\/kolesa-team\\\/go-webp\\\/encoder\\nvendor\\\/github.com\\\/kolesa-team\\\/go-webp\\\/encoder\\\/encoder.go:6:10: fatal error: webp\\\/encode.h: No such file or directory\\n #include <webp\\\/encode.h>\\n          ^~~~~~~~~~~~~~~\\ncompilation terminated.\\n       **ERROR** Unable to compile application: exit status 2\\n\\n  (!) Error: buildpack--nc-go-buildpack failed on compile\\n"}

Eppie Vojt

unread,
Dec 31, 2020, 2:32:36 PM12/31/20
to NodeChef
More details:

I've added the following bash script in the App Actions > Startup Bash & Packages section, which appears to successfully install libwebp-dev (I can find encode.h in /usr/include/webp/, which didn't exist previously)

#!/bin/bash
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo apt-get install -y libwebp-dev
sudo find / -print | grep -i 'encode.h'

Still, when I deploy my app, I continue to get the "fatal error: webp/encode.h: No such file or directory" message

The referenced line producing the fatal error is a C header include: #include <webp/encode.h>, which should find the webp directory in /usr/include

I'm deploying from the CLI with the following command (using actual app name, not myapp): nc deploy -i myapp -bp go

Not sure what I'm missing here...

Nodechef Team

unread,
Jan 8, 2021, 9:56:33 PM1/8/21
to NodeChef
For something like this, a Dockerfile will be the best approach.
Reply all
Reply to author
Forward
0 new messages