0

I wanted to start working with polybench https://web.cse.ohio-state.edu/~pouchet.2/software/polybench/, but there is an error that I couldn't find a way around. when I compile a module such as correlation the following error appears

/root/myCodes/polybench/datamining/correlation/correlation.c:135: undefined reference to `polybench_alloc_data'
/usr/bin/ld: /root/myCodes/polybench/datamining/correlation/correlation.c:136: undefined reference to `polybench_alloc_data'
/usr/bin/ld: /root/myCodes/polybench/datamining/correlation/correlation.c:137: undefined reference to `polybench_alloc_data'
/usr/bin/ld: /root/myCodes/polybench/datamining/correlation/correlation.c:138: undefined reference to `polybench_alloc_data'
collect2: error: ld returned 1 exit status

Build finished with error(s).

the reference is to polybench.h and is declared as follows:

# define POLYBENCH_ALLOC_1D_ARRAY(n1, type) \
  (type(*)[n1 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data ((n1 + POLYBENCH_PADDING_FACTOR), sizeof(type))
# define POLYBENCH_ALLOC_2D_ARRAY(n1, n2, type)     \
  (type(*)[n1 + POLYBENCH_PADDING_FACTOR][n2 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data (((n1 + POLYBENCH_PADDING_FACTOR) * (n2 + POLYBENCH_PADDING_FACTOR)), sizeof(type))
# define POLYBENCH_ALLOC_3D_ARRAY(n1, n2, n3, type)     \
  (type(*)[n1 + POLYBENCH_PADDING_FACTOR][n2 + POLYBENCH_PADDING_FACTOR][n3 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data (((n1 + POLYBENCH_PADDING_FACTOR) * (n2 + POLYBENCH_PADDING_FACTOR) * (n3 + POLYBENCH_PADDING_FACTOR)), sizeof(type))
# define POLYBENCH_ALLOC_4D_ARRAY(n1, n2, n3, n4, type)         \
  (type(*)[n1 + POLYBENCH_PADDING_FACTOR][n2 + POLYBENCH_PADDING_FACTOR][n3 + POLYBENCH_PADDING_FACTOR][n4 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data (((n1 + POLYBENCH_PADDING_FACTOR) * (n2 + POLYBENCH_PADDING_FACTOR) * (n3 + POLYBENCH_PADDING_FACTOR) * (n4 + POLYBENCH_PADDING_FACTOR)), sizeof(type))
# define POLYBENCH_ALLOC_5D_ARRAY(n1, n2, n3, n4, n5, type)     \
  (type(*)[n1 + POLYBENCH_PADDING_FACTOR][n2 + POLYBENCH_PADDING_FACTOR][n3 + POLYBENCH_PADDING_FACTOR][n4 + POLYBENCH_PADDING_FACTOR][n5 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data (((n1 + POLYBENCH_PADDING_FACTOR) * (n2 + POLYBENCH_PADDING_FACTOR) * (n3 + POLYBENCH_PADDING_FACTOR) * (n4 + POLYBENCH_PADDING_FACTOR) * (n5 + POLYBENCH_PADDING_FACTOR)), sizeof(type))

And the polybench_alloc_data is declared as follows

extern void* polybench_alloc_data(unsigned long long int n, int elt_size);
extern void polybench_free_data(void* ptr);
A.Gh
  • 1
  • 1
  • Welcome to SO. Please show your command that you use to compile. You are probably missing to provide required library. – Gerhardh Apr 07 '22 at 07:44
  • I even moved the polybench.h into include directory, but no luck. I used gcc and clang compilers and try compiling using 'ctrl+Shift+B' – A.Gh Apr 07 '22 at 08:09

0 Answers0