LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-11-2012, 12:37 PM   #1
opul
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Rep: Reputation: Disabled
lib3ds undefined reference


Hi

I want to compile a program PTAMM that, among other things, also needs lib3ds. After I had build those libraries and started to make the program I got this error;

Model3ds.cc.text+0x502): undefined reference to `lib3ds_mesh_calculate_vertex_normals'
Model3ds.o: In function `PTAMM::Model3DS::_Load()':
Model3ds.cc.text+0xeb6): undefined reference to `lib3ds_file_open'
collect2: ld returned 1 exit status
make: *** [PTAMM] Error 1

The header for this function is lib3ds.h and is in /usr/local.
During the configure of lib3ds it showed it missed g77 and xlf but I guess it then went for f77 as shown below;

checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for xlf... no
checking for f77... f77
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether f77 accepts -g... yes

If that's the problem then I wonder how to get g77 and xlf.
Some other forums spoke about the gcc-4 and higher could be the problem. But there wasn't really a solution given. I did install gcc-3.4 though, but it resides along side gcc-4 (de-installing gcc via synaptic manager seems dangerous), so I guess it doesn't change a whole lot.

What would be the best way to go about this?
 
Old 08-12-2012, 05:21 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Quote:
checking for f77... f77
Means : Found a ///bin/f77 ( /usr/bin/f77 ? ).
g77 is a link to f77. Or a copy of f77.
And besides that : There's no fortran code in lib3ds. It's all c.
It's just a default configure file :
Will look for a fortran77 compiler also when there are no fortran files in the program.


Not all the libraries work well on all OS.
And you cannot use all versions of the libraries.
( A "latest version" may fail.)
Example that compiles OK on CentOS 6.3 64bits :
TooN-2.0 lib3ds-20080909 libcvd-20100511 gvars3-20120724 PTAM.

Which OS are you using ? Name, <version>, <architecture> please.

.
 
Old 08-12-2012, 08:58 AM   #3
opul
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
I'm using Ubuntu 10.10 on, I guess, an i386 architecture (32 bit intel)

So the mentioning of no g77 and xlf shouldn't be a problem? It just switches compilers or something?

I've now tried both versions of lib3ds I could find, with first of lib3ds-20080909 and then lib3ds-1.3.0. But still to no avail.
 
Old 08-12-2012, 09:23 AM   #4
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 647

Rep: Reputation: 189Reputation: 189
Quote:
Originally Posted by opul View Post
Code:
Model3ds.cc:(.text+0x502): undefined reference to `lib3ds_mesh_calculate_vertex_normals'
Model3ds.o: In function `PTAMM::Model3DS::_Load()':
Model3ds.cc:(.text+0xeb6): undefined reference to `lib3ds_file_open'
collect2: ld returned 1 exit status
make: *** [PTAMM] Error 1
Those are linker errors: the linker cannot find references to the listed symbols (lib3ds_mesh_calculate_vertex_normals and
lib3ds_file_open) inside the libraries specified during the build and so bails out, aborting the build.
Have you properly installed lib3ds prior the PTAMM build? If so, run ldconfig first to update shared library information and check the library presence with
Code:
ldconfig -p | grep lib3ds
 
Old 08-12-2012, 10:02 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Ubuntu 10.10 :

How about : sudo apt-get install lib3ds-dev

It is a patched version of lib3ds-1.3.0 :
With the 980 kB patch, lib3ds_1.3.0-5.diff
http://packages.ubuntu.com/natty/lib3ds-dev


.

Last edited by knudfl; 08-12-2012 at 10:05 AM.
 
Old 08-12-2012, 03:02 PM   #6
opul
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thanks for the pointers, I tried ldconfig -p | grep lib3ds. this gives;

Code:
opie@ubuntu:~/workspace/PTAMM$ ldconfig -p | grep lib3ds
	lib3ds-2.so.0 (libc6) => /usr/local/lib/lib3ds-2.so.0
	lib3ds-1.so.3 (libc6) => /usr/local/lib/lib3ds-1.so.3
	lib3ds-1.so.3 (libc6) => /usr/lib/lib3ds-1.so.3
	lib3ds-1.so (libc6) => /usr/lib/lib3ds-1.so
So i guess this is linked. header files reside in /usr/include/lib3ds

Also tried the dev update and a re-install via synaptic, but that didn't help either.

There also is a test program I compiled and run, ubuntu-3dstest, that put out the right numbers;
Code:
Expecting: 0.065576; Value returned by lib3ds: 0.065576
If the values do not match try compiling lib3ds with the -O0 flag, or with a version of g++ prior to 4.0
So that should be ok too.

I saw somewhere that lib3ds was incompatible with gcc-4 optimization feature causing vertex data problems, so setting in the makefile CFLAGS to -O0 would help, but it didn't
 
Old 08-13-2012, 02:06 AM   #7
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 647

Rep: Reputation: 189Reputation: 189
Quote:
Originally Posted by opul View Post
Thanks for the pointers, I tried ldconfig -p | grep lib3ds. this gives;

Code:
opie@ubuntu:~/workspace/PTAMM$ ldconfig -p | grep lib3ds
	lib3ds-2.so.0 (libc6) => /usr/local/lib/lib3ds-2.so.0
	lib3ds-1.so.3 (libc6) => /usr/local/lib/lib3ds-1.so.3
	lib3ds-1.so.3 (libc6) => /usr/lib/lib3ds-1.so.3
	lib3ds-1.so (libc6) => /usr/lib/lib3ds-1.so
So i guess this is linked. header files reside in /usr/include/lib3ds
Why there are so many lib3ds? Have you manually compiled and installed it, other than installing lib3ds from the repository? Maybe PTAMM is picking up the one in /usr/lib (presumably, the one from the repo) instead of the one in /usr/local. Try looking for PTAMM build configuration flags to specify the location of lib3ds manually.
 
Old 08-13-2012, 04:08 AM   #8
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
PTAMM compiles OK on a 32bits reference OS,
e.g. CentOS 6.3 - 32 and Ubuntu 10.04 - 32.

And : The Ubuntu lib3ds packages did not work, sorry.
Please remove the two packages.

Lib3ds files :
Code:
ls /usr/lib/lib3ds*
/usr/lib/lib3ds-2.so.0      /usr/lib/lib3ds.a   /usr/lib/lib3ds.so
/usr/lib/lib3ds-2.so.0.0.0  /usr/lib/lib3ds.la
I.e. I'd suggest to configure TooN, lib3ds, libcvd, gvars3 with :
./configure --prefix=/usr/

Links http://www.robots.ox.ac.uk/~bob/rese...rch_ptamm.html
http://www.robots.ox.ac.uk/~bob/software/index.html
http://www.robots.ox.ac.uk/~bob/soft...amm/manual.pdf

.

Last edited by knudfl; 08-13-2012 at 10:13 AM.
 
Old 08-13-2012, 08:40 AM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Ubuntu 10.10 - 32 : 1) sudo apt-get install libxmu-dev \
libdc1394-22-dev libreadline6-dev liblapack-dev libcv-dev libfltk1.1-dev \
libgl1-mesa-dev libglu1-mesa-dev libtiff4-dev libpng12-dev libjpeg62-dev

2) TooN-2.0, lib3ds-20080909, libcvd-20100511, gvars3-20120724 :
./configure --prefix=/usr

3) cd PTAM/ && make :
The binaries "CameraCalibrator" and "PTAM" are created.

.
 
Old 08-14-2012, 01:34 AM   #10
opul
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
The problem was a different link required for lib3ds, the .so files lie both in /usr/lib and in /usr/local/lib but the last ones don't seemed to work so well.

I changed in the make file to:
LINKFLAGS = -L /usr/lib/ -l3ds -L /usr/local/lib/ -lcvd -lGVars3

The link to lib3ds had to go to the front so it would look there first.

After a make clean it worked
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined reference, why? george_mercury Programming 4 05-07-2009 12:15 AM
Undefined reference to: ashlesha Programming 5 11-08-2006 01:07 PM
undefined reference? Sharky01252 Programming 3 11-07-2006 11:36 AM
Undefined Reference ChemicalBurn Programming 2 02-14-2005 03:01 AM
undefined reference mp4-10 Programming 3 01-25-2005 12:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration