Ticket #53 (reopened defect)

Opened 2 years ago

Last modified 1 year ago

on cygwin, installed CS binaries don't work

Reported by: acb@… Owned by: mdmkolbe
Priority: major Milestone:
Component: general Version: V0.99
Keywords: Cc:

Description

Migrated from SFbug:1441054.

Original description:
On cygwin, with the latest pseudo-stable version of CS (cs-pseudo-stable-2006-01-27), every exec gives the message: WARNING: could not load plugin 'crystalspace.kernel.vfs' * This likely means that the plugins could not be found. If you're a user: Check the working directory the application starts from - usually, it is the same as the directory with the executable. If in doubt, contact the vendor. If you're a developer: Check if the CRYSTAL environment var points to the correct location - usually the directory CS was built in. WARNING: could not load plugin 'crystalspace.kernel.vfs' Cannot load iVFS plugin

when invoked from the install directory, regardless of the setting of the CRYSTAL environment variable.

I dug into the code a bit, and discovered that it could be made to work by deleting line 46 of libs/csutil/scf.cpp (#define NEW_PLUGIN_PATHS). Aparently on cygwin, the method csInstallationPathsHelper::GetPluginPaths() does not work.

After the line is deleted, everything is recompiled and reinstalled, the installed executables work as expected.


Original comments:

Date: 2006-04-28 10:20
Sender: jorrit
Logged In: YES 
user_id=1703

Eric, do you have any clue about this?
Date: 2006-03-22 22:58
Sender: acb
Logged In: YES 
user_id=14072

All right -- I've looked at the code a bit more and it
does
look like it needs to be fixed during the build process
(otherwise the vfs.cfg file will be incorrect; the
/sw/CS/etc/crystalspace/vfs.cfg file after my
hacky-comment-out-the-FixSeparators() call attempted
workaround has these entries:

VFS.Win32.CS_SHAREDIR = /sw/CSMINE/share/crystalspace
VFS.Win32.CS_DATADIR = /sw/CSMINE/share/crystalspace/data
VFS.Win32.CS_CONFIGDIR = /sw/CSMINE/etc/crystalspace
VFS.Win32.CS_MAPDIR = /sw/CSMINE/share/crystalspace/data/maps


which cause nothing but problems, since the vfs.cfg sets for
example VFS.Mount.scripts = $(CS_SHAREDIR)$/bindings$/,
which results in /sw/CSMINE/share/crystalspace\bindings. 

If $/ is going to be '\' on cygwin, then the paths
need to
be fixed before they get into the vfs.cfg file.

Looks to me like there needs to be a translation of the
variables set in mk/jam/install.jam from cygwin paths to
native windows paths...
appdatadir,appdocdir,appconfdir,appincdir, and plugindir get
set in mk/jam/install.jam. I.e. mk/jam/install.jam currently
sets plugindir on line 31 of mk/jam/install.jam:

plugindir ?= [ ConcatDirs $(libdir) $(PACKAGE_NAME) ] ;

I think things would work better if they were to set to how
cygwin_conv_to_win32_path() would interpret what they're
set
to now (for cygwin). I think that would pretty much take
care of the problem (CS_PLUGINDIR is set to $(plugindir) in
libs/csutil/Jamfile, and those vfs.cfg use these variables
too in plugins/filesys/vfs/Jamfile).

What do you think? Does this sound like a viable approach to
solve the problem?
Date: 2006-03-14 23:13
Sender: acb
Logged In: YES 
user_id=14072

If the call to FixSeparators() in the constructor to Entry()
is removed, that's exactly what happens:
csPathsUtilities::ExpandPath() calls
cygwin_conv_to_win32_path() (see line 116
of libs/csutil/win32/winsyspath.cpp) to get the native
windows path.
Date: 2006-03-14 22:09
Sender: res2002
Logged In: YES 
user_id=360881

Paths are intended to be native, even on Cygwin. So maybe
CS_PLUGINDIR should contain a native path, or perhaps should
somehow get converted to native at some point.
Date: 2006-03-09 23:05
Sender: acb
Logged In: YES 
user_id=14072

OK -- I sank a big deeper into csutil code, and I think I
found the root cause (after much trial and error)!

When the function csPathsList::AddUnique is called on a
cygwin path (that originated with CS_PLUGINDIR), it
constructs a new Entry() (line 88 of
libs/csutil/syspath.cpp). The problem is that the
Entry(char*,char*,bool) constructor called FixSeparators()
on the passed string. This results in the CS_PLUGINDIR value
of '/sw/CS/lib/crystalspace' becoming
'\sw\CS\lib\crystalspace'. The problem with this is that
later cygwin_conv_to_win32_path() is used on this (line 116
of libs/csutil/win32/winsyspath.cpp), and
cygwin_conv_to_win32_path() turns
"/sw/CS/libs/crystalspace/" into
"d:/cygwin/sw/CS/libs/crystalspace" just fine, but it turns
"\sw\CS\libs\crystalspace\" into the non-existing path
"d:\sw\CS\libs\crystalspace".

I commented out the call to FixSeparators() in the
constructor to Entry(), and this also seemed to solve the
installed-binaries-don't-work problem (when I executed
executables in the installed directory, they are now able to
find plugins in the install path, etc.). Not sure if this is
the best fix or not (I don't know if this FixSeparators() is
needed at any point)

Attachments

full-path.patch (7.1 kB) - added by mdmkolbe 2 years ago.
Full Patch
path.patch (4.7 kB) - added by mdmkolbe 2 years ago.
csPathList part of the Patch
vfs.patch (1.4 kB) - added by mdmkolbe 2 years ago.
VFS part of the Patch
configdir.patch (1.2 kB) - added by mdmkolbe 2 years ago.
CS_CONFIGDIR part of the Patch

Change History

Changed 2 years ago by thebolt

  • owner changed from admin to mdmkolbe

Changed 2 years ago by mdmkolbe

  • status changed from new to assigned

I have been able to reproduce the error.

I think part of the problem is that FixSeparators() doesn't have a well defined meaning. If CS has a path like "/usr/local/bin" then converting it to "\usr\local\bin" is meaningless. The operation should be some thing like MakePathNative() which would convert "/usr/local/bin" with cygwin_conv_to_win32_path(). (I haven't tested this solution yet.)

Changed 2 years ago by mdmkolbe

Full Patch

Changed 2 years ago by mdmkolbe

csPathList part of the Patch

Changed 2 years ago by mdmkolbe

VFS part of the Patch

Changed 2 years ago by mdmkolbe

CS_CONFIGDIR part of the Patch

Changed 2 years ago by mdmkolbe

I have written up a solution to this problem but would like others to review it before I commit it.

The solution consists of three parts:

  • a set of changes to ensure that paths in csPathList are expanded from Cygwin paths to Windows paths (attachment:path.patch),
  • a set of changes to ensure that paths in VFS are expanded from Cygwin paths to Windows paths (attachment:vfs.patch), and
  • a set of changes to ensure that CS_CONFIGPATH is checked for vfs.cfg on Cygwin (attachment:configdir.patch).

I separated out the parts of the patch for easier reading (see previous links), but the main patch (attachment:full-path.patch) subsumes the others.

Changed 2 years ago by mdmkolbe

With r25596 I have committed attachment:path.patch and attachment:configdir.patch which mostly fix this problem.

I am currently testing some modifications of attachment:vfs.patch that res2k recommended.

Without vfs.patch Cygwin installs should otherwise work correctly except some Cygwin paths get put in vfs.cfg at install time and VFS doesn't understand Cygwin paths on Win32. Once I put in the amended vfs.patch VFS will understand both Cygwin and Win32 paths for mount points.

Changed 2 years ago by mdmkolbe

  • status changed from assigned to closed
  • resolution set to fixed

With r25604 and r25606, this problem should be fully resolved.

Changed 2 years ago by acb@…

  • status changed from closed to reopened
  • resolution deleted

Just tried to verify that running on cygwin from an installed directory works, but it doesn't seem to:

checked out version 25776 (svn update this morning), then configured with --prefix=/sw/CS-25776, and did a make install.

Trying to run /sw/CS-25776/bin/walktest with the CRYSTAL env var set to /sw/CS-25776 results in this:

$ CRYSTAL=/sw/CS-25776 /sw/CS-25776/bin/walktest -verbose
SCF_NOTIFY: scanning plugin directory: D:\cygwin\sw\CS-25776\bin (context `app'; recursive no)
WARNING: could not load plugin 'crystalspace.kernel.vfs'
Failed to initialize config!
 (A common cause is the CRYSTAL environment variable not being set correctly.)
Error initializing system!
Cleaning up...
Error saving configuration '/config/walktest.cfg'.
 * This likely means that the plugins could not be found. 
 If you're a user: Check the working directory the application starts from -
  usually, it is the same as the directory with the executable.
  If in doubt, contact the vendor.
 If you're a developer: Check if the CRYSTAL environment var points to the
  correct location - usually the directory CS was built in.

Changed 1 year ago by sunshine

  • reporter changed from fossi to acb@users.sourceforge.net

Add/Change #53 (on cygwin, installed CS binaries don't work)

Author



Action
as reopened
 
Note: See TracTickets for help on using tickets.