Re: Torcs Compilation Problem. Can't find libm

Bernhard Wymann <[email protected]>
Newsgroups gmane.games.torcs.general
Organization wytec
Message-ID <[email protected]>
Hi Charles

Ok, I can show you what I do in such cases:
1.
Cut out the failing program from config.log (attached), failing tests 
show the code in the config.log.

2.
Try to compile it on the command line with the given command from 
config.log (adopted to the filename where you have saved the code, for 
me this is now:
g++ -o conftest -g -O2 -Wall -fPIC -O2 -DUSE_RANDR_EXT 
-DGL_GLEXT_PROTOTYPES   -L test.cpp -lm

Result:
/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../lib64/crt1.o: In 
function `_start':
/home/abuild/rpmbuild/BUILD/glibc-2.14.1/csu/../sysdeps/x86_64/elf/start.S:109: 
undefined reference to `main'
collect2: ld returned 1 exit status

AHA!

3.
Fiddle with the command, I added -v to get more information:
g++ -o conftest -g -O2 -Wall -fPIC -O2 -DUSE_RANDR_EXT 
-DGL_GLEXT_PROTOTYPES   -L test.cpp -lm -v

Result:
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.6/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info 
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada 
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.6 
--enable-ssp --disable-libssp --disable-plugin 
--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' 
--disable-libgcj --disable-libmudflap --with-slibdir=/lib64 
--with-system-zlib --enable-__cxa_atexit 
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch 
--enable-version-specific-runtime-libs --program-suffix=-4.6 
--enable-linux-futex --without-system-libunwind --with-arch-32=i586 
--with-tune=generic --build=x86_64-suse-linux
Thread model: posix
gcc version 4.6.2 (SUSE Linux)
COMPILER_PATH=/usr/lib64/gcc/x86_64-suse-linux/4.6/:/usr/lib64/gcc/x86_64-suse-linux/4.6/:/usr/lib64/gcc/x86_64-suse-linux/:/usr/lib64/gcc/x86_64-suse-linux/4.6/:/usr/lib64/gcc/x86_64-suse-linux/:/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/
LIBRARY_PATH=/usr/lib64/gcc/x86_64-suse-linux/4.6/:/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/lib/:/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-o' 'conftest' '-g' '-O2' '-Wall' '-fPIC' '-O2' 
'-D' 'USE_RANDR_EXT' '-D' 'GL_GLEXT_PROTOTYPES' '-Ltest.cpp' '-v' 
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
  /usr/lib64/gcc/x86_64-suse-linux/4.6/collect2 --build-id 
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 
-o conftest 
/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../lib64/crt1.o 
/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../lib64/crti.o 
/usr/lib64/gcc/x86_64-suse-linux/4.6/crtbegin.o -Ltest.cpp 
-L/usr/lib64/gcc/x86_64-suse-linux/4.6 
-L/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../lib64 -L/lib/../lib64 
-L/usr/lib/../lib64 
-L/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/lib 
-L/usr/lib64/gcc/x86_64-suse-linux/4.6/../../.. -lm -lgcc_s -lgcc -lc 
-lgcc_s -lgcc /usr/lib64/gcc/x86_64-suse-linux/4.6/crtend.o 
/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../lib64/crtn.o
/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../lib64/crt1.o: In 
function `_start':
/home/abuild/rpmbuild/BUILD/glibc-2.14.1/csu/../sysdeps/x86_64/elf/start.S:109: 
undefined reference to `main'
collect2: ld returned 1 exit status

4.
Analyse carefully: ... -Ltest.cpp ... oh? -L is for giving linking 
directories, so this -L might be the cause (maybe this worked with old 
gcc versions or comes in for some weird reason on your system, maybe old 
autotools put this into the TORCS 1.2.4 configure script, I can just 
guess from here)?

5.
Try changed command:
  g++ -o conftest -g -O2 -Wall -fPIC -O2 -DUSE_RANDR_EXT 
-DGL_GLEXT_PROTOTYPES test.cpp -lm

Result:
Works like a charm

Now how to resolve this, possibilities:
- Edit directly "configure" (might be delicate, but just try)
- or regenerate configure script (cd into the torcs source directory, 
where configure is located, run the commands in sequence (this might 
fail because your autotools might not work with the old configure.in etc.):
aclocal
autoheader
automake
autoconf
- or use a more recent TORCS version (1.3.4)

Best regards

Bernhard


On 12/04/2012 10:25 PM, [email protected] wrote:
>
> First of all, my apologiesbecause I emailed about this same problem a
> few weeks ago.
> The thing isI didn't get very far and pretty much gave up.
> My problem is that the config.log file says it can't find find libm.
> I've found "libm.so.6" and "libm-2.15.so" under /lib/i386-linux-gnu.
>   - Are they part of the solution?  If so how do I get them in the
> configure process?
>   - Also, how can I use the config.log file myself if there are any
> problems later?  I don't wantto have to use this mailing list everytime
> I have a problem.
>
> The bigger problem here may be the fact that I'm completely new to
> ubuntu and this style of computing.  For instance I think I've only just
> figured out what repositories and dependencies are (I think), so please
> talk to me like I'm an absolute idiot if you're going to reply:)
>
>
> This is for a university project so any help would be very much appreciated.
>
> Thanks :)
> Charles
>
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
>
>
>
> _______________________________________________
> Torcs-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/torcs-users
>

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d

_______________________________________________
Torcs-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/torcs-users
test.cpp (text/x-c++src, 847 B)
/* confdefs.h.  */

#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE "torcs"
#define VERSION "1.2.4"
#ifdef __cplusplus
extern "C" void exit (int) throw ();
#endif
#define STDC_HEADERS 1
#define TIME_WITH_SYS_TIME 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
/* end confdefs.h.  */

/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char sin ();
int
main ()
{
sin ();
  ;
  return 0;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.