Open DarthMike opened 11 years ago
Note to self: remember to take a look at issue #19 when creating the Cmake setup for linux.
My CMake implementation is well on the way. The library libIndieLib builds for me, but with no DirectX support and Tests haven't been added yet. However I'm posting here because I'm having an issue. When I try to test libIndieLib, built with CMake, I get undefined references.
/tmp/cc6m8U90.o: In function main': main.cpp:(.text+0x11): undefined reference to
IndieLib::init(int)'
main.cpp:(.text+0x73): undefined reference to IND_Render::initRenderAndWindow(IND_WindowProperties&)' main.cpp:(.text+0x7c): undefined reference to
IndieLib::end()'
/tmp/cc6m8U90.o: In function IND_Render::IND_Render()': main.cpp:(.text._ZN10IND_RenderC2Ev[_ZN10IND_RenderC5Ev]+0x23): undefined reference to
IND_Timer::IND_Timer()'
collect2: error: ld returned 1 exit status
Yet, I can see that indielib.cpp and IND_Render.cpp are being built. Checking libIndieLib with nm also shows that these symbols are missing. Is this some issue you guys recognise?
@Smilex Great! CMake is a transition we definitely want to make.
Hm, I can just guess why is it you have these undefined refs. What platform are you compiling for?
Ubuntu Raring, Linux 64 bit arch
You should be able to recreate it by checking out my cmake branch.
This is my test code. Compiled with: g++ --std=c++11 -L"." -lIndieLib main.cpp
#include "../common/include/Indie.h"
int main()
{
IndieLib::init(IND_DEBUG_MODE);
IND_Render * render = new IND_Render;
IND_WindowProperties properties("Test",800,600, 32, false, false, true);
IND_Window * window = render->initRenderAndWindow( properties );
IndieLib::end();
return 0;
}
Hi,
Hmm, in thoose clases we use preprocessor macros. But you state thet the classes are buildt, so that shouldn't be a problem.
On 21/09/2013 20:21 "Ian T. Jacobsen" notifications@github.com wrote:
My CMake implementation is well on the way. The library libIndieLib builds for me, but with no DirectX support and Tests haven't been added yet. However I'm posting here because I'm having an issue. When I try to test libIndieLib, built with CMake, I get undefined references.
/tmp/cc6m8U90.o: In function main': main.cpp:(.text+0x11): undefined reference toIndieLib::init(int)' main.cpp:(.text+0x73): undefined reference to IND_Render::initRenderAndWindow(IND_WindowProperties&)' main.cpp:(.text+0x7c): undefined reference toIndieLib::end()' /tmp/cc6m8U90.o: In function IND_Render::IND_Render()': main.cpp:(.text._ZN10IND_RenderC2Ev[_ZN10IND_RenderC5Ev]+0x23): undefined reference toIND_Timer::IND_Timer()' collect2: error: ld returned 1 exit status
Yet, I can see that indielib.cpp and IND_Render.cpp are being built. Checking libIndieLib with nm also shows that these symbols are missing. Is this some issue you guys recognise?
— Reply to this email directly or view it on GitHub https://github.com/DarthMike/indielib-crossplatform/issues/128#issuec omment-24867926.
Hi Ian,
I did the buildsetting for the linux version (very poorly i might add) . I think it will help you if you take a look at the:
linux/tutorials/basic/01_Installing (makefile)
The code is placed at:
IndieLib/tutorials/basic/01_Installing/
The code in Cindielib.cpp and Cindielib.h is the code im referring to.
Hope it can help.
Regards.
Michael,
On 21/09/2013 22:51 "Ian T. Jacobsen" notifications@github.com wrote:
You should be able to recreate it by checking out my cmake branch.
This is my test code. Compiled with: g++ --std=c++11 -L"." -lIndieLib main.cpp
include "../common/include/Indie.h"
int main() { IndieLib::init(IND_DEBUG_MODE);
IND_Render * render = new IND_Render;
IND_WindowProperties properties("Test",800,600, 32, false, false, true); IND_Window * window = render->initRenderAndWindow( properties );
IndieLib::end();
return 0; }
— Reply to this email directly or view it on GitHub https://github.com/DarthMike/indielib-crossplatform/issues/128#issuec omment-24870388.
I'm checking on my side. Trying to understand and figure out what happens. By the way, very good work on setting CMake up! I want a pull request when it works :)
Ok, I'm using Tutorial 01 now for testing. Seems like there are undefined references to everything. Not sure what's going on
I can't get the files to configure. I get GLEW not found errors on OSX and Debian virtual machine.
Are you building static lib? It would be helpful if you can upload the output of nm to a file.
DarthMike: I'm building a shared lib. On Debian do "sudo apt-get install libglew-dev". The local source for GLEW doesn't work yet with CMake
http://www.cmake.org/pipermail/cmake/2004-April/004948.html The above link indicates that my linker errors might be because of the linker order. I'm wondering which libraries depend on each other in IndieLib?
Output of nm http://sprunge.us/beJR
Try building static lib. I think in the code, Defines.h for Linux, we miss a line like this:
#define LIB_EXP attribute ((visibility("default")))
Actually the same as OSX and iOS.
By building a static Indielib library this is not a problem.
I see in nm output, all Indielib symbols are defined. Buy you may be right, and there is static lib order issue. Thing is depencencies are quite independent to each other. So only GLEW and SDL may be related, as FreeImage is independent, so is TiXml
I get the same issues by building statically
Turns out that many of the dependencies for IndieLib aren't linked statically into the IndieLib library. I have now successfully built the first tutorial, with IndieLib built with CMake as a static library. I'll look into statically linking dependencies. Are there any dependencies that shouldn't be linked statically?
We currently link all dependencies statically. For iOS all libs need to be statically linked, so I changed it in other platforms as well.
SDL 2 has CMake build files in its git repository, and because of that I see no reason for me to do my own. Other than that, I'm building everything in statically.
So was the issue related to linking dependencies as shared libs? Was it anything else?
When building the tutorial, or just any application using IndieLib, you have to link most of the dependencies for IndieLib (SDL, GLEW, etc.) to your application as well.
@Smilex Hm that should not be the case. It depends how the dependencies are linked against indielib. They should be linked statically, regardless if we build an Indielib shared or static library.
The point of libs like indielib is to hide those dependencies. On current setups, client apps don't need to link against: SDL GLEW FreeImage
Unless they want to use those in their code, not by using Indielib.
I'm working on fixing it, but I'm quite busy at the moment.
It's been awhile, but I think I'm almost there. The cmake branch is now rebased on a new SDL-hg branch, which is SDL taken from their hg repo. This is because CMake files for SDL are in there. Everything seems to compile static libraries now, however I'm having some issues with GLEW.
libFreeImage.a(GetType.cpp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
I did push my progress so far, to my fork because I don't expect to have much time to work on this.
Ok IndieLib compiles. Just a few linker errors left
@Smilex great :)
@Smilex any chance, that you can post those linker errors here, just so we have an idea what's left when we pickup the code?
For FreeImage I was having build issues with libjpeg (missing io.h) and libtiff (missing unixio.h). First I tried figuring it out, but found that libopenjpeg also exists, so I decided to drop building libjpeg. libtiff had a very similiar issue, so I decided to drop it (with the plan of solving it later). So now when I try to build a tutorial with IndieLib, I get undefined references to libtiff, amongst other things, which doesn't come as a surprise, but that's where I'm at now. All of the issues seem isolated to FreeImage from a glance. Look at common/dependencies/FreeImage/CMakeLists.txt
indielib-crossplatform/IndieLib/tutorials/basic/01_Installing$ g++ -I../../../common/include -L../../../build CIndieLib.cpp Tutorial01.cpp -lIndieLib
../../../build/libIndieLib.so: undefined reference to `typeinfo for Iex::BaseExc'
../../../build/libIndieLib.so: undefined reference to `TIFFReadRGBAImage'
../../../build/libIndieLib.so: undefined reference to `LibRaw::dcraw_process()'
../../../build/libIndieLib.so: undefined reference to `LibRaw::unpack()'
../../../build/libIndieLib.so: undefined reference to `half::_eLut'
../../../build/libIndieLib.so: undefined reference to `jpeg_resync_to_restart'
../../../build/libIndieLib.so: undefined reference to `Imf::IStream::readMemoryMapped(int)'
../../../build/libIndieLib.so: undefined reference to `LibRaw_abstract_datastream::tempbuffer_close()'
../../../build/libIndieLib.so: undefined reference to `Imf::Header::~Header()'
../../../build/libIndieLib.so: undefined reference to `Imf::InputFile::readPixels(int, int)'
../../../build/libIndieLib.so: undefined reference to `Imf::OutputFile::setFrameBuffer(Imf::FrameBuffer const&)'
../../../build/libIndieLib.so: undefined reference to `Imf::OutputFile::OutputFile(Imf::OStream&, Imf::Header const&, int)'
../../../build/libIndieLib.so: undefined reference to `Imf::IStream::~IStream()'
../../../build/libIndieLib.so: undefined reference to `TIFFSetMode'
../../../build/libIndieLib.so: undefined reference to `jpeg_std_error'
../../../build/libIndieLib.so: undefined reference to `Imf::RgbaOutputFile::RgbaOutputFile(Imf::OStream&, Imf::Header const&, Imf::RgbaChannels, int)'
../../../build/libIndieLib.so: undefined reference to `jpeg_CreateDecompress'
../../../build/libIndieLib.so: undefined reference to `jpeg_start_compress'
../../../build/libIndieLib.so: undefined reference to `TIFFSetField'
../../../build/libIndieLib.so: undefined reference to `Imf::RgbaInputFile::readPixels(int, int)'
../../../build/libIndieLib.so: undefined reference to `jpeg_set_quality'
../../../build/libIndieLib.so: undefined reference to `Imf::RgbaInputFile::setFrameBuffer(Imf::Rgba*, unsigned long, unsigned long)'
../../../build/libIndieLib.so: undefined reference to `jpeg_read_header'
../../../build/libIndieLib.so: undefined reference to `TIFFClose'
../../../build/libIndieLib.so: undefined reference to `TIFFGetField'
../../../build/libIndieLib.so: undefined reference to `TIFFSetTagExtender'
../../../build/libIndieLib.so: undefined reference to `TIFFDefaultStripSize'
../../../build/libIndieLib.so: undefined reference to `TIFFTileSize'
../../../build/libIndieLib.so: undefined reference to `TIFFComputeStrip'
../../../build/libIndieLib.so: undefined reference to `typeinfo for Imf::IStream'
../../../build/libIndieLib.so: undefined reference to `TIFFCurrentDirectory'
../../../build/libIndieLib.so: undefined reference to `jpeg_destroy_decompress'
../../../build/libIndieLib.so: undefined reference to `Imf::OStream::~OStream()'
../../../build/libIndieLib.so: undefined reference to `half::_toFloat'
../../../build/libIndieLib.so: undefined reference to `Imf::InputFile::~InputFile()'
../../../build/libIndieLib.so: undefined reference to `Imf::InputFile::setFrameBuffer(Imf::FrameBuffer const&)'
../../../build/libIndieLib.so: undefined reference to `Imf::OutputFile::~OutputFile()'
../../../build/libIndieLib.so: undefined reference to `jpeg_save_markers'
../../../build/libIndieLib.so: undefined reference to `Iex::BaseExc::~BaseExc()'
../../../build/libIndieLib.so: undefined reference to `Imf::OutputFile::writePixels(int)'
../../../build/libIndieLib.so: undefined reference to `jpeg_destroy'
../../../build/libIndieLib.so: undefined reference to `TIFFWriteScanline'
../../../build/libIndieLib.so: undefined reference to `LibRaw::recycle()'
../../../build/libIndieLib.so: undefined reference to `jpeg_finish_compress'
../../../build/libIndieLib.so: undefined reference to `TIFFDataWidth'
../../../build/libIndieLib.so: undefined reference to `TIFFReadDirectory'
../../../build/libIndieLib.so: undefined reference to `typeinfo for Imf::OStream'
../../../build/libIndieLib.so: undefined reference to `Imf::globalThreadCount()'
../../../build/libIndieLib.so: undefined reference to `TIFFTileRowSize'
../../../build/libIndieLib.so: undefined reference to `TIFFReadEncodedStrip'
../../../build/libIndieLib.so: undefined reference to `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
../../../build/libIndieLib.so: undefined reference to `LibRaw::LibRaw(unsigned int)'
../../../build/libIndieLib.so: undefined reference to `LibRaw::unpack_thumb()'
../../../build/libIndieLib.so: undefined reference to `LibRaw::dcraw_clear_mem(libraw_processed_image_t*)'
../../../build/libIndieLib.so: undefined reference to `Imf::RgbaOutputFile::writePixels(int)'
../../../build/libIndieLib.so: undefined reference to `TIFFSetDirectory'
../../../build/libIndieLib.so: undefined reference to `TIFFFieldWithTag'
../../../build/libIndieLib.so: undefined reference to `TIFFGetFieldDefaulted'
../../../build/libIndieLib.so: undefined reference to `jpeg_destroy_compress'
../../../build/libIndieLib.so: undefined reference to `TIFFIsTiled'
../../../build/libIndieLib.so: undefined reference to `jpeg_write_marker'
../../../build/libIndieLib.so: undefined reference to `Imf::OStream::OStream(char const*)'
../../../build/libIndieLib.so: undefined reference to `Imf::Header::Header(Imath::Box<Imath::Vec2<int> > const&, Imath::Box<Imath::Vec2<int> > const&, float, Imath::Vec2<float> const&, float, Imf::LineOrder, Imf::Compression)'
../../../build/libIndieLib.so: undefined reference to `jpeg_finish_decompress'
../../../build/libIndieLib.so: undefined reference to `jpeg_set_defaults'
../../../build/libIndieLib.so: undefined reference to `Imf::RgbaOutputFile::setFrameBuffer(Imf::Rgba const*, unsigned long, unsigned long)'
../../../build/libIndieLib.so: undefined reference to `TIFFIsByteSwapped'
../../../build/libIndieLib.so: undefined reference to `Imf::Header::previewImage() const'
../../../build/libIndieLib.so: undefined reference to `_TIFFDataSize'
../../../build/libIndieLib.so: undefined reference to `Imf::Header::hasPreviewImage() const'
../../../build/libIndieLib.so: undefined reference to `Imf::Slice::Slice(Imf::PixelType, char*, unsigned long, unsigned long, int, int, double, bool, bool)'
../../../build/libIndieLib.so: undefined reference to `TIFFClientOpen'
../../../build/libIndieLib.so: undefined reference to `jpeg_start_decompress'
../../../build/libIndieLib.so: undefined reference to `Imf::Header::setPreviewImage(Imf::PreviewImage const&)'
../../../build/libIndieLib.so: undefined reference to `Imf::InputFile::header() const'
../../../build/libIndieLib.so: undefined reference to `TIFFMergeFieldInfo'
../../../build/libIndieLib.so: undefined reference to `Imf::PreviewImage::~PreviewImage()'
../../../build/libIndieLib.so: undefined reference to `Imf::IStream::isMemoryMapped() const'
../../../build/libIndieLib.so: undefined reference to `Imf::RgbaInputFile::~RgbaInputFile()'
../../../build/libIndieLib.so: undefined reference to `TIFFGetTagListEntry'
../../../build/libIndieLib.so: undefined reference to `LibRaw::open_datastream(LibRaw_abstract_datastream*)'
../../../build/libIndieLib.so: undefined reference to `Imf::ChannelList::begin() const'
../../../build/libIndieLib.so: undefined reference to `jpeg_write_scanlines'
../../../build/libIndieLib.so: undefined reference to `jpeg_write_m_header'
../../../build/libIndieLib.so: undefined reference to `TIFFReadEXIFDirectory'
../../../build/libIndieLib.so: undefined reference to `TIFFSetSubDirectory'
../../../build/libIndieLib.so: undefined reference to `Imf::Header::channels()'
../../../build/libIndieLib.so: undefined reference to `Imf::ChannelList::end() const'
../../../build/libIndieLib.so: undefined reference to `Imf::RgbaOutputFile::~RgbaOutputFile()'
../../../build/libIndieLib.so: undefined reference to `Imf::Header::dataWindow() const'
../../../build/libIndieLib.so: undefined reference to `Iex::throwErrnoExc(std::string const&)'
../../../build/libIndieLib.so: undefined reference to `TIFFScanlineSize'
../../../build/libIndieLib.so: undefined reference to `jpeg_CreateCompress'
../../../build/libIndieLib.so: undefined reference to `Imf::IStream::IStream(char const*)'
../../../build/libIndieLib.so: undefined reference to `TIFFReadTile'
../../../build/libIndieLib.so: undefined reference to `TIFFLastDirectory'
../../../build/libIndieLib.so: undefined reference to `jpeg_read_scanlines'
../../../build/libIndieLib.so: undefined reference to `Imf::RgbaInputFile::RgbaInputFile(Imf::IStream&, int)'
../../../build/libIndieLib.so: undefined reference to `jpeg_write_m_byte'
../../../build/libIndieLib.so: undefined reference to `Imf::ChannelList::insert(char const*, Imf::Channel const&)'
../../../build/libIndieLib.so: undefined reference to `half::convert(int)'
../../../build/libIndieLib.so: undefined reference to `Imf::InputFile::InputFile(Imf::IStream&, int)'
../../../build/libIndieLib.so: undefined reference to `LibRaw_abstract_datastream::make_byte_buffer(unsigned int)'
../../../build/libIndieLib.so: undefined reference to `typeinfo for LibRaw_abstract_datastream'
../../../build/libIndieLib.so: undefined reference to `jpeg_simple_progression'
../../../build/libIndieLib.so: undefined reference to `TIFFWriteDirectory'
../../../build/libIndieLib.so: undefined reference to `TIFFSwabArrayOfLong'
../../../build/libIndieLib.so: undefined reference to `vtable for LibRaw_abstract_datastream'
../../../build/libIndieLib.so: undefined reference to `Imf::Header::channels() const'
../../../build/libIndieLib.so: undefined reference to `Iex::BaseExc::what() const'
../../../build/libIndieLib.so: undefined reference to `LibRaw_abstract_datastream::tempbuffer_open(void*, unsigned long)'
../../../build/libIndieLib.so: undefined reference to `Imf::ChannelList::findChannel(char const*) const'
../../../build/libIndieLib.so: undefined reference to `LibRaw::dcraw_make_mem_thumb(int*)'
../../../build/libIndieLib.so: undefined reference to `TIFFGetTagListCount'
../../../build/libIndieLib.so: undefined reference to `LibRaw::dcraw_make_mem_image(int*)'
../../../build/libIndieLib.so: undefined reference to `Imf::PreviewImage::PreviewImage(unsigned int, unsigned int, Imf::PreviewRgba const*)'
../../../build/libIndieLib.so: undefined reference to `Iex::BaseExc::BaseExc(std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >&)'
../../../build/libIndieLib.so: undefined reference to `TIFFStripSize'
../../../build/libIndieLib.so: undefined reference to `Imf::Channel::Channel(Imf::PixelType, int, int, bool)'
collect2: error: ld returned 1 exit status
Moved issue to 0.7
got the cmake build up and running. have sucessfully build the static version of indielib , and build the tutorials and benchmark tests using the static build. The executables runs fine, and is about 8 mb big. All work is done in the CMAKE branch.
All non3D Tutorials Tests and Unittest are now up and running in CMAKE. Haven't had succes with building the tileless editor yet though. It is really cool to see Everything being buildt and linked by a single command =)
Using CMake will enable us to just edit one project config, thus easing the development when new features or even single files need to be added to compile targets.