Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 336653 - gcc -R option warnings
Summary: gcc -R option warnings
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: x86 Other
: High minor (vote)
Assignee: Gentoo Prefix
URL: http://en.gentoo-wiki.com/wiki/Prefix...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-09 21:32 UTC by Al
Modified: 2011-04-06 18:13 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Al 2010-09-09 21:32:00 UTC
Evitable warnings occur. Eventually programs do not find their libraries.

Reproducible: Always

Steps to Reproduce:
Bootstrapping prefix on Cygwin: emerge --oneshot --ask bash




Actual Results:  
gcc: unrecognized option '-R/home/prefix/gentoo/usr/lib'
gcc: unrecognized option '-R/home/prefix/gentoo/lib'




So far this is only a cosmetical problem. Bash finds ncurses anyway:

/home/prefix/gentoo/bin/bash.exe
/home/prefix/gentoo/usr/bin/cygncurses5.dll

It may become a problem with other packages as rpath is not passed to the linker the official way (or not at all).

Reason: The -R option is an (unofficial) shortcut that only works in some environments. It's not at all documented in GCC's manpage.

Solution: -R should likely replaced by -Wl,-R, maybe -Wl,-rpath.

  '-R/home/prefix/gentoo/lib'
  '-Wl,-R,/home/prefix/gentoo/lib'
  '-Wl,-rpath,/home/prefix/gentoo/lib'

Program to fix: bootstrap-prefix.sh 

General fix: line 94

I think the default should be changed as -Wl,... is the regular flag to pass something to the linker and the -R flag is the unofficial shortcut.

Cygwin special: line 257

In Cygwin *.dll files are in the */bin directories: 

http://en.gentoo-wiki.com/wiki/Prefix/Cygwin#Standard_namings_and_locations

Maybe this would work (not tested yet):

ldflags_make_defaults="LDFLAGS=\"-L${ROOT}/usr/lib -L${ROOT}/lib -Wl,-R,${ROOT}/usr/lib -Wl,-R,${ROOT}/lib -Wl,-R,${ROOT}/usr/bin -Wl,-R,${ROOT}/bin \""

Workaround: Set LDFLAGS manually in *windows/cygwin1.7/x86/make.defauls.

Al
Comment 1 Jonathan Callen (RETIRED) gentoo-dev 2010-09-09 22:10:33 UTC
Can't be done. Cygwin simply doesn't *have* an RPATH/RUNPATH equivalent. All libraries must be in directories found on the $PATH (or in ".", which is implicitly on the path).
Comment 2 Al 2010-09-09 23:02:02 UTC
> Cygwin simply doesn't *have* an RPATH/RUNPATH equivalent. All
> libraries must be in directories found on the $PATH (or in ".", which is
> implicitly on the path).

It's very informative to send in a bug. :-) I confirm this by experiment: 

PATH=""
ldd .../bash.exe
bash: ldd: no such file or directory

Follows:

1.) Suggest -Wl,-R Flag as default setting.
2.) Suggest to unset -R-Flag for Cygwin.

Al
Comment 3 Al 2010-09-09 23:13:28 UTC
> It's very informative to send in a bug. :-) I confirm this by experiment: 
> 
> PATH=""
> ldd .../bash.exe
> bash: ldd: no such file or directory

Corrected experiment, similar result:

$ PATH=""
$ /usr/bin/ldd /home/prefix/gentoo/bin/bash.exe
  cygncursest.dll not found
  
Comment 4 Fabian Groffen gentoo-dev 2010-09-10 06:41:19 UTC
The -R syntax is used for Solaris compatability.  We should just drop it on Cygwin, I suppose.
Comment 5 Al 2010-09-10 08:57:30 UTC
(In reply to comment #4)
> The -R syntax is used for Solaris compatability.  We should just drop it on
> Cygwin, I suppose.
> 

Dropping on Cygwin is fine. 

I can only find the following source to argu -R Option is the special case and -Wl style the default for line 94:

http://gcc.gnu.org/ml/gcc-help/2000-03/msg00119.html

Al
Comment 6 Fabian Groffen gentoo-dev 2010-09-10 09:02:09 UTC
yeah, but during bootstrap you may not be using gcc, though
Comment 7 Al 2010-09-10 23:28:35 UTC
(In reply to comment #1)
> Can't be done. Cygwin simply doesn't *have* an RPATH/RUNPATH equivalent. All
> libraries must be in directories found on the $PATH (or in ".", which is
> implicitly on the path).
> 

Addon:

http://msdn.microsoft.com/en-us/library/7d83bc18%28VS.71%29.aspx
Comment 8 Fabian Groffen gentoo-dev 2011-04-06 18:13:06 UTC
-R is now only used on Solaris targets