Bug 2347

Summary: Review request: nvidia-texture-tools - Collection of image processing and texture manipulation tools
Product: Package Reviews Reporter: pcpa <paulo.cesar.pereira.de.andrade>
Component: Review RequestAssignee: RPM Fusion Package Review <rpmfusion-package-review>
Status: RESOLVED WONTFIX    
Severity: normal CC: rpmfusion-package-review
Priority: P5    
Version: Current   
Hardware: All   
OS: GNU/Linux   
namespace:
Bug Depends on: 584    
Bug Blocks: 2342    

Description pcpa 2012-05-31 01:08:42 CEST
The NVIDIA Texture Tools is a collection of image processing and texture
manipulation tools, designed to be integrated in game tools and asset
conditioning pipelines.

The primary features of the library are mipmap and normal map generation,
format conversion and DXT compression.

DXT compression is based on Simon Brown's squish library. The library also
contains an alternative GPU-accelerated compressor that uses CUDA and is
one order of magnitude faster.

Spec URL: http://fedorapeople.org/~pcpa/nvidia-texture-tools.spec
SRPM URL: http://fedorapeople.org/~pcpa/nvidia-texture-tools-2.0.8-2.fc18.src.rpm

The package is blocked in FE-LEGAL due to possible patent infringement
on s3tc, original fedora review request:
https://bugzilla.redhat.com/show_bug.cgi?id=823096

This package should help in providing a higher quality 0ad
package, that I also have as a review request, with positive
comments, at:
https://bugzilla.rpmfusion.org/show_bug.cgi?id=2342
and its noarch datafiles:
https://bugzilla.rpmfusion.org/show_bug.cgi?id=2343

Note that I made a minor change in this review request, renaming
the -tools subpackage to -progs, to have
nvidia-texture-tools-progs instead of
nvidia-texture-tools-tools with helper programs for
texture manipulation (required for tasks like manipulating
or creating new textures for game mods, custom maps, etc).
Comment 1 Nicolas Chauvet 2012-06-05 15:57:48 CEST
You depend on squish for this package.
(I will try to make a new snapshot).

The binaries should be located in the main package (library will be provided in a libs sub-package for multilibs compliance).

This package can be built with CUDA indeed, so it might worth to make a nonfree alternatives. (You can have a look on OpenEXR_Viewers-nonfree for example despite I don't know how to deal with alternate library in this case, and if relevant).
Comment 2 pcpa 2012-06-05 17:21:35 CEST
(In reply to comment #1)
> You depend on squish for this package.
> (I will try to make a new snapshot).
> 
> The binaries should be located in the main package (library will be provided in
> a libs sub-package for multilibs compliance).
> 
> This package can be built with CUDA indeed, so it might worth to make a nonfree
> alternatives. (You can have a look on OpenEXR_Viewers-nonfree for example
> despite I don't know how to deal with alternate library in this case, and if
> relevant).

[In a Mandriva cooker computer right now, but good enough to test]

I tried a quick build with a system wide squish, building and installing
the package from https://bugzilla.rpmfusion.org/show_bug.cgi?id=584

and a simple

%if %{with_system_squish}
sed -e 's/\(ADD_SUBDIRECTORY(squish)\)/#\1/' -i src/nvtt/CMakeLists.txt
%endif

in nvidia-texture-tools.spec, but it failed:

[...]
[ 79%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/cuda/CudaCompressDXT.cpp.o
cd /home/pcpa/rpm/BUILD/nvidia-texture-tools/build/src/nvtt && /usr/bin/c++   -Dnvtt_EXPORTS -DNVTT_EXPORTS -DNVTT_SHARED=1 -O2 -Wa,--compress-debug-sections -gdwarf-4 -fvar-tracking-assignments -frecord-gcc-switches -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fPIC  -march=athlon64 -fPIC -I/home/pcpa/rpm/BUILD/nvidia-texture-tools/src -I/home/pcpa/rpm/BUILD/nvidia-texture-tools/build/src -I/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt -I/usr/lib/qt4/include -I/home/pcpa/rpm/BUILD/nvidia-texture-tools/build/src/nvtt    -o CMakeFiles/nvtt.dir/cuda/CudaCompressDXT.cpp.o -c /home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/cuda/CudaCompressDXT.cpp
Linking CXX shared library libnvtt.so
cd /home/pcpa/rpm/BUILD/nvidia-texture-tools/build/src/nvtt && /usr/bin/cmake -E cmake_link_script CMakeFiles/nvtt.dir/link.txt --verbose=1
/usr/bin/c++  -fPIC -O2 -Wa,--compress-debug-sections -gdwarf-4 -fvar-tracking-assignments -frecord-gcc-switches -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fPIC  -march=athlon64   -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags -Wl,--hash-style=gnu -shared -Wl,-soname,libnvtt.so.2.0 -o libnvtt.so.2.0.8 CMakeFiles/nvtt.dir/nvtt.cpp.o CMakeFiles/nvtt.dir/Compressor.cpp.o CMakeFiles/nvtt.dir/nvtt_wrapper.cpp.o CMakeFiles/nvtt.dir/CompressDXT.cpp.o CMakeFiles/nvtt.dir/CompressRGB.cpp.o CMakeFiles/nvtt.dir/QuickCompressDXT.cpp.o CMakeFiles/nvtt.dir/OptimalCompressDXT.cpp.o CMakeFiles/nvtt.dir/CompressionOptions.cpp.o CMakeFiles/nvtt.dir/InputOptions.cpp.o CMakeFiles/nvtt.dir/OutputOptions.cpp.o CMakeFiles/nvtt.dir/cuda/CudaUtils.cpp.o CMakeFiles/nvtt.dir/cuda/CudaCompressDXT.cpp.o ../nvcore/libnvcore.so.2.0.8 ../nvmath/libnvmath.so.2.0.8 ../nvimage/libnvimage.so.2.0.8 -lsquish ../nvmath/libnvmath.so.2.0.8 ../nvcore/libnvcore.so.2.0.8 -ldl -lpng -lz -ljpeg -ltiff ../nvcore/poshlib/libposh.a 
CMakeFiles/nvtt.dir/CompressDXT.cpp.o: In function `nv::SlowCompressor::compressDXT1(nvtt::CompressionOptions::Private const&, nvtt::OutputOptions::Private const&)':
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:208: undefined reference to `squish::WeightedClusterFit::WeightedClusterFit()'
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:211: undefined reference to `squish::WeightedClusterFit::SetMetric(float, float, float)'
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:224: undefined reference to `squish::ColourSet::ColourSet(unsigned char const*, int, bool)'
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:225: undefined reference to `squish::WeightedClusterFit::SetColourSet(squish::ColourSet const*, int)'
CMakeFiles/nvtt.dir/CompressDXT.cpp.o: In function `nv::SlowCompressor::compressDXT1a(nvtt::CompressionOptions::Private const&, nvtt::OutputOptions::Private const&)':
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:245: undefined reference to `squish::WeightedClusterFit::WeightedClusterFit()'
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:246: undefined reference to `squish::WeightedClusterFit::SetMetric(float, float, float)'
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:268: undefined reference to `squish::ColourSet::ColourSet(unsigned char const*, int, bool)'
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:269: undefined reference to `squish::WeightedClusterFit::SetColourSet(squish::ColourSet const*, int)'
CMakeFiles/nvtt.dir/CompressDXT.cpp.o: In function `nv::SlowCompressor::compressDXT3(nvtt::CompressionOptions::Private const&, nvtt::OutputOptions::Private const&)':
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:289: undefined reference to `squish::WeightedClusterFit::WeightedClusterFit()'
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:291: undefined reference to `squish::WeightedClusterFit::SetMetric(float, float, float)'
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:308: undefined reference to `squish::ColourSet::ColourSet(unsigned char const*, int, bool)'
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:309: undefined reference to `squish::WeightedClusterFit::SetColourSet(squish::ColourSet const*, int)'
CMakeFiles/nvtt.dir/CompressDXT.cpp.o: In function `nv::SlowCompressor::compressDXT5(nvtt::CompressionOptions::Private const&, nvtt::OutputOptions::Private const&)':
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:328: undefined reference to `squish::WeightedClusterFit::WeightedClusterFit()'
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:329: undefined reference to `squish::WeightedClusterFit::SetMetric(float, float, float)'
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:353: undefined reference to `squish::ColourSet::ColourSet(unsigned char const*, int, bool)'
/home/pcpa/rpm/BUILD/nvidia-texture-tools/src/nvtt/CompressDXT.cpp:354: undefined reference to `squish::WeightedClusterFit::SetColourSet(squish::ColourSet const*, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/nvtt/libnvtt.so.2.0.8] Error 1
make[2]: Leaving directory `/home/pcpa/rpm/BUILD/nvidia-texture-tools/build'
make[1]: *** [src/nvtt/CMakeFiles/nvtt.dir/all] Error 2
make[1]: Leaving directory `/home/pcpa/rpm/BUILD/nvidia-texture-tools/build'
make: *** [all] Error 2
error: Código de saída mau de /var/tmp/rpm-tmp.30602 (%build)


Erros de construção do RPM:
    Código de saída mau de /var/tmp/rpm-tmp.30602 (%build)
[...]


Updating to use latest upstream release, squish 1.11 fails the same way.

Looking at the sources, I see not much changes in the history in
http://code.google.com/p/nvidia-texture-tools/source/browse/trunk/src/nvtt/squish/colourset.cpp
but a patch should not be trivial, for example, prototype in the
bundled nvidia-texture-tools:

ColourSet::ColourSet( u8 const* rgba, int flags, bool createMinimalSet/*=false*/ )

and in squish 1.11:

ColourSet::ColourSet( u8 const* rgba, int mask, int flags )

also, it actually did build up to there due to not removing the
bundled squish directory, otherwise, would fail due to missing
includes:

nvidia-texture-tools/src/nvtt/CompressDXT.cpp:

[...]
// squish
#include "squish/colourset.h"
//#include "squish/clusterfit.h"
#include "squish/fastclusterfit.h"
#include "squish/weightedclusterfit.h"
[...]

as squish-devel installs only %{_includedir}/squish/squish.h

Do you have contacts with upstream? It should be trivial to
upstream to write a proper patch, but I think it may be required
that squish-devel install more headers.

Apparently ubuntu ppa packages do not use a system squish:
https://launchpad.net/~wfg/+archive/0ad
https://launchpad.net/nvidia-texture-tools

The only squish I found is another unrelated package:
https://launchpad.net/squish
Comment 3 Kevin Kofler 2012-06-10 14:30:48 CEST
The proper way to handle alternative libraries is to use ld.so.conf.d, as used in freetype-freeworld, or in the optimized builds of atlas in Fedora, or for the NVidia libGL.
Comment 4 Nicolas Chauvet 2012-06-10 18:42:40 CEST
(In reply to comment #3)
> The proper way to handle alternative libraries is to use ld.so.conf.d, as used
We want to use system libsquish here and the error is probably related to a missing LDFLAGS or even an outdated squish version.
Comment 5 pcpa 2012-06-11 15:24:49 CEST
(In reply to comment #4)
> (In reply to comment #3)
> > The proper way to handle alternative libraries is to use ld.so.conf.d, as used
> We want to use system libsquish here and the error is probably related to a
> missing LDFLAGS or even an outdated squish version.

  The api in the bundled squish in nvtt is slightly different from the latest upstream squish. Also, nvtt wants to include headers that squish does not install, and have access to internal symbols that squish does not add to squish.h (only header it installs).
Comment 6 Nicolas Chauvet 2012-06-11 15:30:51 CEST
(In reply to comment #5)
...
>   The api in the bundled squish in nvtt is slightly different from the latest
Can you compare the three libsquish API (internal nvtt, current, latest upstream svn).
Thx
Comment 7 pcpa 2012-06-11 16:19:33 CEST
(In reply to comment #6)
> (In reply to comment #5)
> ...
> >   The api in the bundled squish in nvtt is slightly different from the latest
> Can you compare the three libsquish API (internal nvtt, current, latest
> upstream svn).
> Thx

  Already partially did in #2 when quoting the build error. Quoting just a small example

> bundled nvidia-texture-tools:
> 
> ColourSet::ColourSet( u8 const* rgba, int flags, bool
> createMinimalSet/*=false*/ )
> 
> and in squish 1.10 and 1.11:
> 
> ColourSet::ColourSet( u8 const* rgba, int mask, int flags )

arguments are likely reversed or names are reversed.

 As I also said, it failed in link because I did not remove the bundled squish before build, otherwise it would not compile due to not finding the proper headers, and then asked if anybody has contact to upstream, as it should be easy for upstream to make a patch, otherwise, need to read both codebases and try to make a reasonable patch.
Comment 8 Kevin Kofler 2012-06-13 11:57:56 CEST
My comment #3 about alternative libraries was not for squish, but in reply to comment #1, which mentioned having a nvidia-texture-tools-nonfree version of the library.
Comment 9 pcpa 2012-07-13 16:20:59 CEST
I still had an open review request in fedora, that I just closed, and will also close this one, message for fedora was:

The package builds code under a patent and is not eligible for fedora. I made a review request for the same package in rpmfusion, but there is a workaround to build 0ad without nvtt.