Incompatibility with GCC4 optimization

Bug #3711 reported by Michael Sheldon on 2005-10-30
Affects Status Importance Assigned to Milestone
lib3ds (Ubuntu)

Bug Description

Lib3DS is currently incompatible with GCC4's optimization features, causing all vertex data to be given the value 0. This can be fixed by compiling without optimization (use the CFLAG -O0).

Changed in lib3ds:
assignee: nobody → motu
Trent Lloyd (lathiat) wrote :

Thanks for the report michael, don't suppose you have some kind of test case for this?

Nothing convenient, I could write a little test program if you like?

Trent Lloyd (lathiat) wrote :

Yeh that would be nice, it only has to be basic, I'd just like to try a couple things and with more up to date GCC and that sort of thing :)

Sorry for the delay; you can grab the test program from:

The correct output should look like:
Expecting: 0.065576; Value returned by lib3ds: 0.065576

The output when compiled against the Ubuntu version of lib3ds is more along the lines of:
Expecting: 0.065576; Value returned by lib3ds: 4.04892e-34

Remember that since lib3ds is statically linked you'll need to recompile the test program after any changes you make to lib3ds for them to take effect.


Trent Lloyd (lathiat) wrote :

Fixed this with a patch snarfed off the lib3ds mailing list in the latest upload.

Changed in lib3ds:
status: Unconfirmed → Fix Released

Dear Trent,

Thanks for all the help.

I am using PTAMM and I had compiled it 2-3 weeks back and there was no issue .However now upon compiling I get the following errors:

Model3ds.o: In function `PTAMM::Model3DS::_GenerateDisplayList(Lib3dsFile*, bool)': undefined reference to `lib3ds_mesh_calculate_vertex_normals'
Model3ds.o: In function `PTAMM::Model3DS::_Load()': undefined reference to `lib3ds_file_open'
collect2: ld returned 1 exit status
make: *** [PTAMM] Error 1

I came across ur forum and added the compile flags but still the problem persists ,I am really stumped because I am not able to get something 2 work which I had in the past ! .

Could u pls give me any suggestions which would help me

I downloaded the test file which u gave and I got the following output
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

which means things r fine ..

could u pls help me I would really appreciate it if you could give me ur valuable feedback

Kindest Regards

jcoates (jcoatz) wrote :

Same problem.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers