Imagination PowerVR SDK Blog

libPVRTexLib.a on MacOS


#1

Hi guys,





I would like to use libPVRTexLib to perform texture compression in an in-house tool, however when I try to link it, I’m seeing a number of errors such as:





Code:
"std::basic_istream<char, std::char_traits<char> >& std::basic_istream<char, std::char_traits<char> >::_M_extract<unsigned int>(unsigned int&)", referenced from:
      pvrtexlib::readPPM(char const*, pvrtexlib::Pixel<unsigned char>**, unsigned int&, unsigned int&)in libtrainzresource.a(pvrtcMW.o)

"_fopen$UNIX2003", referenced from:
      pvrtexlib::CPVRTexture::writeToFile(char const*, unsigned int) constin libtrainzresource.a(CPVRTexture.o)



These appear to indicate a mismatch of the standard libraries between your prebuilt library and my project, but unfortunately your documentation does not indicate what compilers/settings might be necessary here.



Could you provide any clues towards fixing this?



thanks,



chris


#2

This is something that should probably be added to the documentation, along with an example.

In my test makefile for this library I have the following lines:

Code:
LIBS =

        -L/usr/lib

        -lpthread

        -lstdc++ -m32

        $(DEVRELDIR)/UtilitiesSrc/PVRTexLib/PVRTexLibPublic/MacOS/libPVRTexLib.a

        -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5





CFLAGS += -c -m32 -DHAVE_GL_H -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5


I use the -mmacosx-version-min flag to give compatiblity with Leopard - I suspect that might have something to do with the issue - are you running 10.6?  Also, the -m32 ensures 32bit mode (64bit support is not available yet).

Please post again if this doesn't help you.


#3

Thanks for the quick reply.





I am running Xcode 3.2.3 on 10.6.4.





My project settings include:





Code:
SDKROOT = macosx10.5
VALID_ARCHS = i386
GCC_VERSION = 4.2
MACOSX_DEPLOYMENT_TARGET = 10.5



The resultant buildline in xcode looks like this (filepaths abbreviated substantially to protect the guilty and to make it readable):



Code:
setenv MACOSX_DEPLOYMENT_TARGET 10.5
/Developer/usr/bin/g++-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -L/XXXX -F/XXXX -filelist /XXXX.LinkFileList -mmacosx-version-min=10.5 -lssl -lz -lcrypto /XXXX.a /XXXX.a -o /XXXX



Any further thoughts?



cheers,



chris

#4


Hello,

I have the same problem, I want to use the library in my engine - http://www.esenthel.com/
And was successfull with 32-bit under Windows, but on Mac I have the same linker errors as in first post.
I use xcode 3.2.3 on mac os x 10.6

I use mac os 10.5 sdk for building the project, with 32-bit (i386) architecture.

The linker errors are:

Code:
"std::basic_istream<char, std::char_traits<char> >& std::basic_istream<char, std::char_traits<char> >::_M_extract<unsigned int>(unsigned int&)", referenced from:


      pvrtexlib::readPPM(char const*, pvrtexlib::Pixel<unsigned char>**, unsigned int&, unsigned int&)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::readPPM(char const*, pvrtexlib::Pixel<unsigned char>**, unsigned int&, unsigned int&)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::readPPM(char const*, pvrtexlib::Pixel<unsigned char>**, unsigned int&, unsigned int&)in EsenthelEngine.a(pvrtcMW.o)


  "_fopen$UNIX2003", referenced from:


      pvrtexlib::CPVRTexture::writeToFile(char const*, unsigned int) constin EsenthelEngine.a(CPVRTexture.o)


      pvrtexlib::SaveKTX(pvrtexlib::CPVRTextureHeader const&, pvrtexlib::CPVRTextureData const&, CPVRTString const&)in EsenthelEngine.a(ktx_io.o)


      readFile(CPVRTString const&, SafeArray<unsigned char>&)in EsenthelEngine.a(Utilities.o)


      pvrtexlib::ConsoleLog::setStraightToFile(bool)  in EsenthelEngine.a(ConsoleLog.o)


      pvrtexlib::ConsoleLog::setOutputFile(CPVRTString)       in EsenthelEngine.a(ConsoleLog.o)


      pvrtexlib::ConsoleLog::writeToFile()      in EsenthelEngine.a(ConsoleLog.o)


      pvrtexlib::ConsoleLog::appendToFile()      in EsenthelEngine.a(ConsoleLog.o)


      pvrtexlib::writeToIncludeFile(pvrtexlib::CPVRTextureHeader const&, pvrtexlib::CPVRTextureData const&, char const*, char const*)in EsenthelEngine.a(pvr_io.o)


      pvrtexlib::SavePVR(pvrtexlib::CPVRTextureHeader const&, pvrtexlib::CPVRTextureData const&, CPVRTString const&)in EsenthelEngine.a(pvr_io.o)


      pvrtexlib::SaveDDS(pvrtexlib::CPVRTextureHeader const&, pvrtexlib::CPVRTextureData const&, char const*)in EsenthelEngine.a(dds_io.o)


      pvrtexlib::SaveNGT(pvrtexlib::CPVRTextureHeader const&, pvrtexlib::CPVRTextureData const&, CPVRTString const&)in EsenthelEngine.a(ngt_io.o)


      pvrtexlib::fileExist(char*) in EsenthelEngine.a(etc_conversion.o)


      _bitmap_write_window in EsenthelEngine.a(bitmap.o)


      _bitmap_read in EsenthelEngine.a(bitmap.o)


  "std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)", referenced from:


      pvrtexlib::readPPM(char const*, pvrtexlib::Pixel<unsigned char>**, unsigned int&, unsigned int&)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::readPPM(char const*, pvrtexlib::Pixel<unsigned char>**, unsigned int&, unsigned int&)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::readPPM(char const*, pvrtexlib::Pixel<unsigned char>**, unsigned int&, unsigned int&)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::readPPM(char const*, pvrtexlib::Pixel<unsigned char>**, unsigned int&, unsigned int&)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::readPPM(char const*, pvrtexlib::Pixel<unsigned char>**, unsigned int&, unsigned int&)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::readPPM(char const*, pvrtexlib::Pixel<unsigned char>**, unsigned int&, unsigned int&)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::writePPM(char const*, pvrtexlib::Pixel<unsigned char> const*, unsigned int, unsigned int, bool)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::writePPM(char const*, pvrtexlib::Pixel<unsigned char> const*, unsigned int, unsigned int, bool)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::writePPM(char const*, pvrtexlib::Pixel<unsigned char> const*, unsigned int, unsigned int, bool)in EsenthelEngine.a(pvrtcMW.o)


  "std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<unsigned long>(unsigned long)", referenced from:


      pvrtexlib::readPPM(char const*, pvrtexlib::Pixel<unsigned char>**, unsigned int&, unsigned int&)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::readPPM(char const*, pvrtexlib::Pixel<unsigned char>**, unsigned int&, unsigned int&)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::writePPM(char const*, pvrtexlib::Pixel<unsigned char> const*, unsigned int, unsigned int, bool)in EsenthelEngine.a(pvrtcMW.o)


      pvrtexlib::writePPM(char const*, pvrtexlib::Pixel<unsigned char> const*, unsigned int, unsigned int, bool)in EsenthelEngine.a(pvrtcMW.o)


OTHER_LFFLAGS= -L/usr/lib -lpthread -lstdc++ -m32 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -framework Carbon -framework Cocoa -framework OpenGL -framework OpenAL -framework Cg -lz

OTHER_CFLAGS = -fshort-wchar -ffriend-injection -c -m32 -DHAVE_GL_H -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5

Also I have a big request for 64-bit support, for both Windows and Mac.

And it would be nice to have the library on Windows as .lib only and not .dll

Thanks

Grzegorz

Esenthel2010-09-01 17:39:42

#5

Thanks for reporting this issue. It’s being looked into (along with 64bit builds) and a fix should be available in an update in the future.