Advertisement

Porting library to Linux

Started by April 13, 2005 10:11 AM
10 comments, last by 255 19 years, 5 months ago
Well ever since i started working on a Game Framework library, i had 1 important goal in mind which was to make it cross-platform. This was one of the main reasons for me to choose C++/OGL from the start. Ive tried 2 times now and have just gotten frustrated by the way things screw up for me in Linux. I admit i have little to no knowledge about how linux works but even compiling the CodeBlocks ide seems to be an impossible task. I want to use the CodeBlocks ide because it can import MSVC dsp/sln files and appears to be a good ide. I dont know how to use the other linux ides because i dont know how to work with makefiles. I have made an effort to make sure that my code will compile with gcc by compiling it in DevC++ on windows, so i suppose that as long as i use the linux version of the libraries, i shouldnt have any problems compiling it in linux. I tried Mandrake earlier but dependancy problems drove me to delete the whole linux partition and give up. I just tried ubuntu and still seem to have problems compiling the wxwidgets library let alone the ide. Any advice/reccommendations on what i should do? Any other ide's out there which will make my work easier?
Well dependency problems shouldn't be a problem, both Mandrake and Ubuntu provide tools to deal with them (urpmi and apt-get). So compiling something should be something like this :

Unpack the archive
./configure
make
make install

If configure bails out with an error it should give you a pretty good idea what is missing. And then you use the distros package manager to deal with them.
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
Advertisement
Have you tried the tutorials section over at the Code::Blocks wiki?
It contains detailed info on building it under linux.

Yiannis.
Quote: I dont know how to use the other linux ides because i dont know how to work with makefiles.


Makefiles are a relatively easy concept.

Here are some tutorials:
http://www.eng.hawaii.edu/Tutor/Make/
http://www.gnu.org/software/make/manual/html_node/make_toc.html

In general it's a good idea to familiarize yourself with the command-line tools, as you will find them quite useful in combination with IDEs.
Free Mac Mini (I know, I'm a tool)
If you just want to get some work done as soon as possible, i suggest you get Code::Blocks (no makefiles needed) or KDevelop (handles all the make and autoconf stuff automatically and quite transparently).
Yeah i stumbled upon the wiki and applied the patch and it compiled fine after that. Next problem is i keep getting this error even though i have successfully compiled and installed wx_gtk2-2.4. Im sure it's something simple.

codeblocks.exe: error while loading shared libraries: libwx_gtk2-2.4.so: cannot open shared object file: No such file or directory
Advertisement
Quote: Original post by GamerSg
Yeah i stumbled upon the wiki and applied the patch and it compiled fine after that. Next problem is i keep getting this error even though i have successfully compiled and installed wx_gtk2-2.4. Im sure it's something simple.

codeblocks.exe: error while loading shared libraries: libwx_gtk2-2.4.so: cannot open shared object file: No such file or directory


Did you install that library ? (make install)


Another good IDE for C/C++ programming under Linux is Eclipse+CDT. In managed make mode, Eclipse will automatically generate the makefiles for you. In standard make mode, you are free to use your own makefiles.

If you want to use MSVC dsp files, you can give qmake a try.
http://doc.trolltech.com/3.0/qmake.html
It can convert dsp projects into qmake makefiles. However it is not compatible with GNU make.
I finally managed to compile and run CodeBlocks! Feels like i just achieved something so impossible. But now that im porting my stuff, i use 2 libraries which i need to compile from source myself.

1) Devil
2) GLFW

I have tried compiling Devil so far, firstly i realised that all the files for Devil were saved in some DOS format which required me to use Dos2Unix to make them work on linux, after that i am getting this error when running ./configure

checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... yes
checking whether byte ordering is bigendian... no
checking how to run the C preprocessor... gcc -E
checking for X... libraries /usr/X11R6/lib, headers /usr/X11R6/include
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... no
checking whether build environment is sane... yes

: command not foundevIL-1.6.7.zip_FILES/DevIL-1.6.7/libtools/missing: line 5:
: command not foundevIL-1.6.7.zip_FILES/DevIL-1.6.7/libtools/missing: line 10:
: command not foundevIL-1.6.7.zip_FILES/DevIL-1.6.7/libtools/missing: line 15:
: command not foundevIL-1.6.7.zip_FILES/DevIL-1.6.7/libtools/missing: line 20:
: command not foundevIL-1.6.7.zip_FILES/DevIL-1.6.7/libtools/missing: line 25:
/home/luv/Desktop/DevIL-1.6.7.zip_FILES/DevIL-1.6.7/libtools/missing: line 41: syntax error near u'expected token `in
'home/luv/Desktop/DevIL-1.6.7.zip_FILES/DevIL-1.6.7/libtools/missing: line 41: `case "$1" in
configure: WARNING: `missing' script is too old or missing

checking for gawk... no
checking for mawk... mawk
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for egrep... grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc static flag works... yes
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... GNU/Linux ld.so
appending configuration tag "F77" to libtool
checking whether to enable maintainer-specific portions of Makefiles... no
checking jpeglib.h usability... yes
checking jpeglib.h presence... yes
checking for jpeglib.h... yes
checking tiffio.h usability... yes
checking tiffio.h presence... yes
checking for tiffio.h... yes
checking png.h usability... yes
checking png.h presence... yes
checking for png.h... yes
checking lcms/lcms.h usability... no
checking lcms/lcms.h presence... no
checking for lcms/lcms.h... no
checking libmng.h usability... no
checking libmng.h presence... no
checking for libmng.h... no
checking GL/gl.h usability... no
checking GL/gl.h presence... no
checking for GL/gl.h... no
checking d3d8.h usability... no
checking d3d8.h presence... no
checking for d3d8.h... no
checking windows.h usability... no
checking windows.h presence... no
checking for windows.h... no
checking for jpeg_start_decompress in -ljpeg... yes
checking for jpeg_init_exif_field in -ljpeg... no
checking for TIFFReadRGBAImage in -ltiff... yes
checking for png_start_read_image in -lpng... yes
checking for sdl-config... no
checking for SDL - version >= 1.2.5... no
*** The sdl-config script installed by SDL could not be found
*** If SDL was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the SDL_CONFIG environment variable to the
*** full path to sdl-config.
checking for allegro-config... no

+----------------------------------------+
| IL library Supported formats |
+----------------------------------------+-------+
BMP DCX DDS WAD GIF ICO JPG LIF MDL PCD PCX PIC PIX PNG PNM PSD PSP PXR RAW SGI TGA TIF WAL XPM

+----------------------------------------+
| ILUT library Supported APIs |
+----------------------------------------+-------+
SDL


configure: creating ./config.status
config.status: creating Makefile
.infig.status: error: cannot find input file: \


Any help?


Do you really need to compile those libraries from source? You can get the prebuilt in RPM or DEB packages easily.

If not you should get the linux sources for DevIL and GLFW which you just untar and run the configure and make scripts.
The sources for Devil are the same for Windows/Mac/Linux. It also comes with a configure file which happened to be in DOS format, therefore i needed to use Dos2Unix to convert it. However upon running it i get those errors listed in my previous post.

Im using Ubuntu and the packet manager doesnt seem to have either of these libraries. It didnt even have the famous wxWidgets library which i also had problems compiling.

This topic is closed to new replies.

Advertisement