OpenCilk / cheetah

Source for the OpenCilk runtime system, based on Cheetah.
Other
21 stars 16 forks source link

get_workerwarn_msg breaks the linker #4

Closed qqi0O0 closed 3 years ago

qqi0O0 commented 4 years ago

I ran into the following error message:

/usr/bin/ld.gold: error: hidden symbol 'get_workerwarn_msg' is not defined locally

After removing lines https://github.com/OpenCilk/cheetah/blob/release/runtime/cilk2c.c#L56-L61, the error went away and I was able to compile without issues.

qqi0O0 commented 4 years ago

Example that triggers the error:

main.c:

#include <stdio.h>
#include <stdlib.h>
#include <cilk/cilk.h>

int main() {
  printf("Hello world\n");
}

Makefile:

CC := /path/to/clang
CFLAGS := -fopencilk -flto
LDFLAGS := -flto -fuse-ld=gold -fopencilk -L/path/to/cheetah/runtime -static-libopencilk

main: main.o
    $(CC) $(LDFLAGS) -o main main.o

main.o: main.c
    $(CC) $(CFLAGS) -o main.o -c main.c

clean:
    rm -f main main.o

I build clang using the instructions from https://github.com/OpenCilk/infrastructure/blob/release/INSTALLING, with the difference that I added a flag -DLLVM_BINUTILS_INCDIR=/usr/include to the cmake command in lines https://github.com/OpenCilk/infrastructure/blob/release/tools/build#L79-L84. /usr/include contains the file plugin-api.h.

This is on Ubuntu.