1754904 Members
3759 Online
108827 Solutions
New Discussion юеВ

compiling problem

 
SOLVED
Go to solution
John712_1
Regular Advisor

compiling problem

Hi there,

I am trying comple a very simple C programm, the program is very simple it creates a glut window and that's all. I compile it using gcc 4.1 and got some problems:
------------------------------
/opt/graphics/OpenGL/include/GL/glHPInt:33:error: thread-local storage not supported for this target
------------------------------
can anyone give some help to me, what's the problem? thanks in advance!

yz
10 REPLIES 10
Arunvijai_4
Honored Contributor

Re: compiling problem

Hi,

Check this out, http://lists.debian.org/debian-glibc/2006/02/msg00303.html

it could be a bug in GCC.. Try latest available version of GCC or try with HP Ansi C or aCC.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
John712_1
Regular Advisor

Re: compiling problem

thanks, Arun

I am using a hp c3000 system running hpux 11i v1, not a debian system. I think the gcc 4.1.0 is the latest. any suggestions on a stable gcc version? thanks
Steven E. Protter
Exalted Contributor

Re: compiling problem

Shalom yz,

The gcc is stable, I think this code has included an invalid reference to the file in the error.

Does the file exist?

If not, see about modifying your code to stop including it.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
John712_1
Regular Advisor

Re: compiling problem

thanks Steven,

the .h files included in my programm are:
#include
#include

nothing else.

I do not know if there really have a file called glHPInt, I will check it when I am home. thanks
Mike Stroyan
Honored Contributor
Solution

Re: compiling problem

The gl.h header file includes glHpInt.h, which uses macros to make faster calls to OpenGL functions. The macros call through an array of function pointers that is declared as thread local storage.

gcc can't cope with the __thread storage type. You can avoid the entire macro mechanism and use normal function calls by using "-D__glHpInt_h__" to ifdef away the body of
glHpInt.h.
John712_1
Regular Advisor

Re: compiling problem

Many thanks, Mike. It works! Brilliant! However, I got some other
problems:
------------------
/usr/ccs/bin/ld: Unsatisfied symbols:
glutInitWindowSize(code)
glutInitDisplayMode(code)
glutMainLoop(code)
glutCreateWindow(code)
glutInitWindowPosition(code)
glutInit(code)
collect2:ld returned 1 exit status
gmake: ***[glutw] Error 1
--------------------

So what's the problem? Many thanks in advance.

Yinghui Zhang
Arunvijai_4
Honored Contributor

Re: compiling problem

Hi,

You may need to link your program with OpenGL libraries. Check this out http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B6268AA

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Mike Stroyan
Honored Contributor

Re: compiling problem

It sounds like you just didn't link with libglut or linked with
it before the code that used it. It is available on HP-UX as
/opt/graphics/OpenGL/contrib/libglut/libglut.a which you can
use with -L/opt/graphics/OpenGL/contrib/libglut -lglut .
Because it is an archive library it must appear in the link line
after the file that calls the glut functions. If it is listed too
early then the linker won't know to pull in the required functions.

You can use -Wl,+n to ask the HP-UX linker to loop around retrying archive libraries to pick up missing symbols. I don't usually consider the +n option unless the libraries have circular dependencies. Getting the source files and libraries in the correct dependency order is more portable.

The version of glut shipped with HP-UX is quite old. If you have
code that uses newer glut features you will need to compile a newer
version. You can find that at
http://www.opengl.org/resources/libraries/glut/glut_downloads.php
John712_1
Regular Advisor

Re: compiling problem

Many thanks, Mike. It works! The strange thing is I have use
-L/opt/graphics/OpenGL/contrib/libglut/libglut.a -lglut
instead of
-L/opt/graphics/OpenGL/contrib/libglut -lglut.
Anyway, I got my glut window!
Many thanks.