Bug 169064

Summary: dynamic link sometimes causes non-working image
Product: [Fedora] Fedora Reporter: Tom Holroyd <tomh>
Component: xorg-x11Assignee: X/OpenGL Maintenance List <xgl-maint>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 4   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-22 17:57:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
test program that fails none

Description Tom Holroyd 2005-09-22 17:44:37 UTC
Description of problem:

When I leave off some of the -lXblah arguments, the dynamic linker manages to
find everything OK, but depending on position, the program segfaults or
otherwise doesn't work.  When I fully specify the link order, it still sometimes
doesn't work, if the order is wrong.  I have found an order that always works,
but there's still some strange position dependent bug.  I haven't tried linking
statically.

Version-Release number of selected component (if applicable):

I've tried this on two very different boxes, both x86, running FC4 that was
completely up to date (yum update done prior to all tests, and xorg-x11 has had
a few changes recently so I made sure I was getting the latest, as of 9/22).

How reproducible:

Very, but unpredictably, depending on link order.

Steps to Reproduce:
1.  Sample program below.
2.  Compile and link; experiment with library order, like leave most of them
off, or just try something like -lGLw -lGL -lXt -lX11 -lXm; some combinations
work, some don't.  I get segfaults, or invalid X requests, depending on how it
links.  Even re-running it can change what I get (different dynamic link order).
  
Actual results:

segfault

Expected results:

no segfault

Additional info:

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <math.h>

#include <X11/Intrinsic.h>

static String fallbackResources[] = {
  NULL
};

XtAppContext app = NULL;
Widget toplevel = NULL;

int
main(int argc, char *argv[])
{
  toplevel = XtAppInitialize(&app, "moo", NULL, 0, &argc, argv,
    fallbackResources, NULL, 0);
  return 0;
}

Comment 1 Tom Holroyd 2005-09-22 17:44:38 UTC
Created attachment 119156 [details]
test program that fails

Comment 2 Tom Holroyd 2005-09-22 17:48:46 UTC
More information about the link order.  We've tried this now on a total of 4
different boxes.

The basic workaround is to move '-lXm' to the left of '-lGLw'.

Apparently there are some functions with the same name in there someplace.

Comment 3 Mike A. Harris 2005-09-22 17:57:11 UTC
Your report is technical/developer support request rather than a bug report.

The xorg.org mailing list is a more appropriate location
to seek assistance for developing X applications.

Setting status to NOTABUG.