Bug 76293 - port graphics/togl VERY broken
Summary: port graphics/togl VERY broken
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Pav Lucistnik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-15 21:00 UTC by Mike
Modified: 2013-03-17 02:45 UTC (History)
0 users

See Also:


Attachments
togl-1.6-port-patch (8.01 KB, application/octet-stream)
2005-02-17 06:32 UTC, mspam
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike 2005-01-15 21:00:28 UTC
as it stands, the port is completely unusable...

some (not all) problems:
1) makefile uses $(shell) but port is built with make instead of gmake
causes error at the end of 'build':
wrong # args: should be "pkg::create -name packageName -version packageVersion?-load {filename ?{procs}?}? ... ?-source {filename ?{procs}?}? ..."
2) empty -Xlinker -rpath passed to link command
3) port installs example .so files without example .tcl files, rendering them completely useless
4) example .tcl files are not patched to point to wish<VERSION>
5) of example files provided, "double" fails to run, "gears" produces
garbled/random output, "texture" dumps core.

marked as 'critical' because port is completely useless as is

How-To-Repeat: cd /usr/ports/graphics/togl
make
cd work/Togl-1.6/
wish8.4 ./texture.tcl 
wish8.4 ./gears.tcl
wish8.4 ./double.tcl
Comment 1 Michael Nottebrock 2005-01-15 23:00:09 UTC
Since the port is currently unmaintained, it would be best if you'd submit 
patches, there's little chance the port will get fixed otherwise, 'critical' 
severity nonwithstanding.
Comment 2 Volker Stolz freebsd_committer freebsd_triage 2005-01-20 13:32:30 UTC
State Changed
From-To: open->closed

I fixed the GNUMake issue, added a deprecation note and put 
the port on death-row with about 6 months grace. 
Thanks for your submission!
Comment 3 mspam 2005-02-17 06:32:26 UTC
On Sun, 16 Jan 2005, Michael Nottebrock wrote:

> Since the port is currently unmaintained, it would be best if you'd submit
> patches, there's little chance the port will get fixed otherwise, 'critical'
> severity nonwithstanding.

per request, patch is attached; please apply.
thanks

Mike
Comment 4 Volker Stolz freebsd_committer freebsd_triage 2005-03-04 22:53:47 UTC
State Changed
From-To: closed->open

Reopen: New patch
Comment 5 Thierry Thomas freebsd_committer freebsd_triage 2005-03-14 22:27:15 UTC
State Changed
From-To: open->feedback


There is a problem with this patch: 

@@ -95,7 +97,8 @@ 
+CFLAGS += $(COPTS) $(INCLUDES) $(TK_FLAGS) ${PTHREAD_FLAGS} 

-LFLAGS = $(LIBDIRS) 
-+LFLAGS = $(LIBDIRS) ${PTHREAD_LIBS} 
++# need -lpthread here because -pthread does not link library into .so 
++LFLAGS = $(LIBDIRS) ${PTHREAD_LIBS} -lpthread 

It builds and runs fine on FreeBSD-5.3, but ld aborts on Freebsd-4.11 
because -lpthread does not exists: 

===>  Configuring for togl-1.6_1 
===>  Building for togl-1.6_1 
cc -O -pipe -march=pentiumpro -c -fPIC -DPC_LINUX -DDEBUG -DUSE_TCL_STUBS -DUSE_TK_STUBS -I/usr/X11R6/include -I/usr/local/include/tcl8.4 -I/usr/local/include/tk8.4   togl.c 
cc -shared -L/usr/local/lib -L/usr/local/lib -L/usr/X11R6/lib -Xlinker -rpath -Xlinker /usr/local/lib -pthread -lpthread togl.o -ltclstub84 -ltkstub84 -lGLU -lGL -L/usr/X11/lib -lX11 -lXmu -lXext -lXt -lm -o togl.so  
/usr/libexec/elf/ld: cannot find -lpthread 
gmake: *** [togl.so] Erreur 1 
*** Error code 2 

Stop in /usr/ports/graphics/togl. 

Could you please fix this problem? 



Comment 6 Thierry Thomas freebsd_committer freebsd_triage 2005-03-14 22:27:15 UTC
Responsible Changed
From-To: freebsd-ports-bugs->thierry


Take it.
Comment 7 Thierry Thomas freebsd_committer freebsd_triage 2005-03-19 23:01:08 UTC
Le Sam 19 mar 05 à 22:03:18 +0100, Mike <mspam@www.ideaway.net>
 écrivait :
> I'm afraid I do not have access to a single 4.x machine with
> X libraries installed, and I can not install these because
> the machines I have access to are all production machines.
> 
> The reason why the -lpthread is needed (at least in 5.x) is
> because the -pthread flag only tells gcc to link to the
> library when building an executable - ldd on the resulting
> libraries reveals they are not linked to the pthread library;
> for some reason (unknown to me) when this happens, the
> resulting libraries simply do not work with opengl.  If -lpthread
> is used to link, ldd reveals that the .so is linked to the
> pthreads library, and the libraries work appropriately.
> 
> I wish I could provide a patch for 4.x, but I can not.
> I found this port extremely helpful (despite the fact
> that it took a lot of banging head against the wall to get
> it to work) and therefore do not wish for it to dissapear,
> as I believe it is a valuable resource to others.  
> Thanks for your interest in getting this fixed.

Hello,

I have removed this -lpthread, and togl builds fine. Then I can build
and run the examples provided in /usr/local/share/examples/togl without
error.

Could you please explain me how you encounter a problem in this case?

BTW, my /usr/local/lib/tcl8.4/tclConfig.sh reports

# Flag, 1: we built Tcl with threads enables, 0 we didn't
TCL_THREADS=0

Regards,
-- 
Th. Thomas.
Comment 8 Thierry Thomas freebsd_committer freebsd_triage 2005-03-20 08:00:51 UTC
Le Dim 20 mar 05 à  0:26:29 +0100, Mike <mspam@www.ideaway.net>
 écrivait :
> 
> the problem (that I experienced) is not with the build; the libraries
> compile and link fine - however they do not work when they are used.
> 
> for example, after building (without -lpthread), running ./gears.tcl
> produces a gl canvas that is filled with random garbage.  (other than
> that, the application works "fine")  at this point ldd on gears.so gives:
> ./gears.so:
>         libGLU.so.1 => /usr/X11R6/lib/libGLU.so.1 (0x28162000)
>         libGL.so.1 => /usr/X11R6/lib/libGL.so.1 (0x281d5000)
>         libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x28245000)
>         libXmu.so.6 => /usr/X11R6/lib/libXmu.so.6 (0x28304000)
>         libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x28318000)
>         libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x28325000)
>         libm.so.3 => /lib/libm.so.3 (0x2836e000)
>         libstdc++.so.4 => /usr/lib/libstdc++.so.4 (0x28388000)
>         libXxf86vm.so.1 => /usr/X11R6/lib/libXxf86vm.so.1 (0x2845a000)
>         libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x2845f000)
>         libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x28467000)
> 
> after relinking the library (gears.so) with -lpthread, running ./gears.tcl
> resulting in a correctly working app with 3 golored gears spinning.
> ./gears.so:
>         libpthread.so.1 => /usr/lib/libpthread.so.1 (0x28162000)
>         libGLU.so.1 => /usr/X11R6/lib/libGLU.so.1 (0x28186000)
>         libGL.so.1 => /usr/X11R6/lib/libGL.so.1 (0x281f9000)
>         libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x28269000)
>         libXmu.so.6 => /usr/X11R6/lib/libXmu.so.6 (0x28328000)
>         libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x2833c000)
>         libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x28349000)
>         libm.so.3 => /lib/libm.so.3 (0x28392000)
>         libstdc++.so.4 => /usr/lib/libstdc++.so.4 (0x283ac000)
>         libXxf86vm.so.1 => /usr/X11R6/lib/libXxf86vm.so.1 (0x2847e000)
>         libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x28483000)
>         libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x2848b000)
> 
> as you can see, the only difference is that after linking with -lpthread
> the link remains, as opposed to before (when building with just -pthread)
> 
> I do not know why the opengl library needs pthreads - but based
> on this experiment I simply assume that it does.  the fact that your
> tcl reports non-threaded is also correct - that is the default way of
> building it - the pthreads is not needed for tcl, it just (for some
> strange reason) is needed for opengl to actually put the correct
> image on the screen (at least on my system)
> 
> 5.3-STABLE FreeBSD 5.3-STABLE #4: Thu Dec 16 22:50:37 EST 2004
> 
> please let me know if the above does not make sense, I will try to
> explain what i mean better.

You explained it clearly, but I have no such problem here:

- ./gears.tcl runs fine, even if built without lpthread

- which OpenGL do you run? I don't use a "standard" OpenGL, but the
nvidia drivers

./gears.so:
	libGLU.so.1 => /usr/X11R6/lib/libGLU.so.1 (0x28183000)
	libGL.so.1 => /usr/X11R6/lib/libGL.so.1 (0x281ff000)
	libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x28268000)
	libXmu.so.6 => /usr/X11R6/lib/libXmu.so.6 (0x28337000)
	libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x2834d000)
	libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x2835c000)
	libm.so.3 => /lib/libm.so.3 (0x283ae000)
	libstdc++.so.4 => /usr/lib/libstdc++.so.4 (0x283c8000)
	libGLcore.so.1 => /usr/X11R6/lib/libGLcore.so.1 (0x284a5000)
	libnvidia-tls.so.1 => /usr/X11R6/lib/libnvidia-tls.so.1 (0x28a9c000)
	libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x28a9e000)
	libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x28aa7000)

- don't you have related entries in your /etc/libmap.conf?

Regards,
-- 
Th. Thomas.
Comment 9 Thierry Thomas freebsd_committer freebsd_triage 2005-03-20 10:24:34 UTC
Le Dim 20 mar 05 à 10:59:01 +0100, Mike <mspam@www.ideaway.net>
 écrivait :
> my system is stock freebsd...
> 
> /usr/X11R6/lib/libGL.a was installed by package xorg-libraries-6.8.1_1
> /usr/X11R6/lib/libGLU.so was installed by package xorg-libraries-6.8.1_1
> 
> i have no libmap.conf, all libraries are from base+xorg ports.
> 
> i assume this is mesa opengl...  there are some random pages
> out there that google returns that hint that
> a) opengl needs pthreads on some platforms
> b) freebsd is one of those platforms
> I have found nothing concrete...  all i know is that, as i said, my
> systems running 5.x are pretty "stock", and if I compile togl without
> -lpthread all i get is a box with random gabrage/noise in it.

I don't like this -lpthread, but since I cannot reproduce this
behaviour with my nvidia driver, I prefer release this PR: it will be
better handled by a committer running a standard OpenGL.

Regards,
-- 
Th. Thomas.
Comment 10 Thierry Thomas freebsd_committer freebsd_triage 2005-03-20 10:45:25 UTC
State Changed
From-To: feedback->open


Back to the pool: to be handled by a committer running a 
standard OpenGL, without nvidia driver. 



Comment 11 Thierry Thomas freebsd_committer freebsd_triage 2005-03-20 10:45:25 UTC
Responsible Changed
From-To: thierry->freebsd-ports-bugs


Back to the pool: to be handled by a committer running a 
standard OpenGL, without nvidia driver.
Comment 12 Pav Lucistnik freebsd_committer freebsd_triage 2005-06-02 09:17:43 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pav

Looks like I'm dealing with this
Comment 13 Pav Lucistnik freebsd_committer freebsd_triage 2005-06-03 13:29:54 UTC
State Changed
From-To: open->closed

Relevant parts of  your patch committed