I need to install Torch with a static png and jpeg libs, both of which were built with -fPIC. When the Torch install gets to the image package, it fails, telling me that the static libs needed to be recompiled with -fPIC.
This is on AWS Linux, btw. I want to include static versions of libpng and libjpeg because I will need to port the installation to CentOS and RHEL and will not be able to install any dependencies. My static libs are in /usr/local/lib.
Any ideas? Do I need to change something in the image package's rockspec or CMakeLists.txt? Nothing I've tried has made a difference.
cmake -E make_directory build && cd build && cmake .. -DLUALIB= -DLUA_INCDIR="/mnt/ken/torch/install/include" -DLUA_LIBDIR="/mnt/ken/torch/install/lib" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/mnt/ken/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/mnt/ken/torch/install/lib/luarocks/rocks/image/1.1.alpha-0" && make
-- Found Torch7 in /mnt/ken/torch/install
-- Compiling with OpenMP support
WARNING: Could not find JPEG libraries, JPEG wrapper will not be installed
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/ken/torch/pkg/image/build
[ 33%] Building C object CMakeFiles/image.dir/image.c.o
Linking C shared module libimage.so
[ 33%] Built target image
Scanning dependencies of target png
[ 66%] Building C object CMakeFiles/png.dir/png.c.o
Linking C shared module libpng.so
/usr/bin/ld: /usr/local/lib/libpng.a(png.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpng.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libpng.so] Error 1
make[1]: *** [CMakeFiles/png.dir/all] Error 2
make: *** [all] Error 2
Error: Build error: Failed building.