mayingzhen / nvidia-texture-tools

Automatically exported from code.google.com/p/nvidia-texture-tools
Other
0 stars 0 forks source link

Patch to fix libsquish build with Clang #182

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Build shared NVTT lib with Clang, we pass these options to CMake: 
-DNVTT_SHARED=1 -DCMAKE_BUILD_TYPE=Release -DBINDIR=bin -DLIBDIR=lib -DGLUT=0 
-DGLEW=0 -DCG=0 -DCUDA=0 -DOPENEXR=0 -G "Unix Makefiles"
2.
3.

What is the expected output? What do you see instead?
It should build successfully, instead it fails with this error:
"/usr/bin/ld: squish/libsquish.a(weightedclusterfit.cpp.o): relocation 
R_X86_64_32S against `_ZTVN6squish18WeightedClusterFitE' can not be used when 
making a shared object; recompile with -fPIC
squish/libsquish.a: could not read symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)"

It seems a similar problem was fixed for GCC in revision 805, but Clang needs 
the -fPIC option too, so I've made a patch that detects Clang and uses the same 
fix. Using the patch, NVTT builds successfully with Clang and ccache+Clang.

Original issue reported on code.google.com by historic...@gmail.com on 14 Nov 2012 at 7:16

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by cast...@gmail.com on 5 Feb 2013 at 6:39