-
Notifications
You must be signed in to change notification settings - Fork 3
Description
If I see the environment variables CGO_CFLAGS, CGO_LDFLAGS, and LD_LIBRARY_PATH then my program will NOT compile. I get the following error:
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/home/opc/libstapsdt/out/libstapsdt.a(libstapsdt.o): In function providerLoad': libstapsdt.c:(.text+0x63e): undefined reference to dlopen'
libstapsdt.c:(.text+0x65b): undefined reference to dlerror' libstapsdt.c:(.text+0x6ae): undefined reference to dlsym'
libstapsdt.c:(.text+0x6b7): undefined reference to dlerror' /home/opc/libstapsdt/out/libstapsdt.a(libstapsdt.o): In function providerUnload':
libstapsdt.c:(.text+0x74e): undefined reference to dlclose' libstapsdt.c:(.text+0x757): undefined reference to dlerror'
/home/opc/libstapsdt/out/libstapsdt.a(shared-lib.o): In function createElf': shared-lib.c:(.text+0x11): undefined reference to elf_version'
shared-lib.c:(.text+0x30): undefined reference to elf_begin' /home/opc/libstapsdt/out/libstapsdt.a(shared-lib.o): In function createElfHeader':
shared-lib.c:(.text+0xb8): undefined reference to elf64_newehdr' /home/opc/libstapsdt/out/libstapsdt.a(shared-lib.o): In function createElfProgramHeaders':
shared-lib.c:(.text+0x122): undefined reference to elf64_newphdr' /home/opc/libstapsdt/out/libstapsdt.a(shared-lib.o): In function dynElfSave':
shared-lib.c:(.text+0xad9): undefined reference to elf_ndxscn' shared-lib.c:(.text+0xbbe): undefined reference to elf_ndxscn'
shared-lib.c:(.text+0xf14): undefined reference to elf_ndxscn' shared-lib.c:(.text+0x10ff): undefined reference to elf_ndxscn'
shared-lib.c:(.text+0x1122): undefined reference to elf_update' shared-lib.c:(.text+0x1402): undefined reference to elf_update'
shared-lib.c:(.text+0x16ec): undefined reference to elf_ndxscn' shared-lib.c:(.text+0x1763): undefined reference to elf_ndxscn'
shared-lib.c:(.text+0x17f7): undefined reference to elf_ndxscn' shared-lib.c:(.text+0x186c): undefined reference to elf_ndxscn'
shared-lib.c:(.text+0x18e1): undefined reference to elf_ndxscn' shared-lib.c:(.text+0x198d): undefined reference to elf_flagphdr'
shared-lib.c:(.text+0x19a1): undefined reference to elf_update' /home/opc/libstapsdt/out/libstapsdt.a(shared-lib.o): In function dynElfClose':
shared-lib.c:(.text+0x1bbe): undefined reference to elf_end' /home/opc/libstapsdt/out/libstapsdt.a(section.o): In function sectionInit':
section.c:(.text+0x4d): undefined reference to elf_newscn' section.c:(.text+0x85): undefined reference to elf_newdata'
section.c:(.text+0xbf): undefined reference to elf64_getshdr' /home/opc/libstapsdt/out/libstapsdt.a(hash-table.o): In function hashTableFromSymbolTable':
hash-table.c:(.text+0xae): undefined reference to `elf_hash'
collect2: error: ld returned 1 exit status
When I remove those environment variables then my program will compile. I have to set the environment variables for the program to run. You just can't have them set when compiling the program.