无法使用cgo在32位linux上进行构建

I am trying to build a application which will use 32bit Linux libraries via cgo (64bit version doesn't exist).

Trying to build as 64bit doesn't work with the 32bit libraries:

[performance goListen]> go build
# goListen
/usr/bin/ld: skipping incompatible /apps/install/tibco/tibrv/live/lib/libtibrv.so when searching for -ltibrv
/usr/bin/ld: skipping incompatible /apps/install/tibco/tibrv/live/lib/libtibrv.a when searching for -ltibrv
/usr/bin/ld: cannot find -ltibrv
collect2: ld returned 1 exit status

When I try to build it as 32bit it complains that there are no buildable source files:

[performance goListen]> GOARCH=386 go build
can't load package: package goListen: no buildable Go source files in /apps/sierra/shares/sierra_aps/godev/src/goListen

Here is my code - I know it won't work but I just want it to try and compile!

package main

/*
#cgo !windows CFLAGS: -I/apps/install/tibco/tibrv/live/include/tibrv
#cgo !windows LDFLAGS: -L/apps/install/tibco/tibrv/live/lib -ltibrv
#cgo windows CFLAGS: -ID:/Rendez-vous/include/tibrv
#cgo windows LDFLAGS: -LD:/Rendez-vous/lib -ltibrv
#include "tibrv.h"
*/
import "C"
import "fmt"

func main() {
    fmt.Println(C.tibrv_Open())
}

Any advice would be greatly appreciated.

Thanks to JimB who has it right in the comments:

You have to enable cgo explicitly when cross-compiling. – JimB

Specifically, this worked for me:

CGO_ENABLED=1 GOOS=linux GOARCH=386 go build