codon
codon copied to clipboard
Generating .so error : /usr/bin/ld: cannot find -lz
Hello, I have a special but simple test case: `@export def show_array(): @python def plot_random_matrix_100x100(): import numpy as np import matplotlib.pyplot as plt
arr = np.random.random((100,100, 3))
plt.imshow(arr)
plt.show()`
- I am not sure I used the syntax correctly - basically I want this function to be callable from a C++ application.
- It uses numpy and matplotlib internally, hence the @python is needed.
I get the following error: /usr/bin/ld: cannot find -lz gcc returned with error code 1
Please help.
Can you try installing zlib
? If you're on Ubuntu: sudo apt-get install zlib1g-dev
.
Sure, will try that and let you know. But, is the way I try to use the functionality in C/C++ correct? I am basically trying to use matplotlib from C++ via codon.
Now I get this error (after installing zlib)
/usr/bin/ld: test_codon.so.o: relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC collect2: error: ld returned 1 exit status error: process for 'gcc' exited with status 1
Also tried passing -fPIC to build command: codon build -fPIC -o test_codon.so mpl_test.codon
Seems this is the wrong way.