[Botan-devel] Trouble running configure on cygwin

Jack Lloyd lloyd at randombit.net
Fri Feb 18 11:31:54 EST 2011


Hi William,

An interesting case!

Can you try the attached patch? After applying, rerun configure.py
with the additional option --link-style=copy to force using a copy
instead of a link.

Thanks,
  Jack

On Fri, Feb 18, 2011 at 08:09:16AM -0800, William K. Foster wrote:
> Hi Jack,
> 
> I'll try that out, thanks.
> 
> I had already worked around with --os=cygwin and it runs into another issue
> with symlinks.  The file system I am building on is a samba mounted linux
> drive.  When Botan goes to create symbolic links for header files in (from
> memory) build/include/*.h the files appear to the build as regular file
> whose contents is some binary data including the tag <symlink>.  I'm
> guessing this is a Windows style symbolic link, but it needs to be a linux
> style symbolic link.
> 
> Thanks again.
> 
> -William
> 
> On Fri, Feb 18, 2011 at 5:32 AM, Jack Lloyd <lloyd at randombit.net> wrote:
> 
> > On Thu, Feb 17, 2011 at 05:04:41PM -0800, William K. Foster wrote:
> > > Hello,
> > >
> > > I am trying to build Botan v1.8.11 on Windows XP using Cygwin.
> > >
> > > The configure fails with the message:
> > >
> > >   Unknown OS "cygwin_nt-5.1"; available options: aix beos cygwin darwin
> > > dragonfly freebsd hpux irix linux mingw netbsd openbsd qnx solaris tru64
> > > windows
> > >
> > > Where does the 'cygwin_nt-5.1' come from and how do I correct it to just
> > be
> > > 'cygwin'?
> >
> > Hi William,
> >
> > The cygwin_nt-5.1 comes from what Python's platform module
> > reports the system to be.
> >
> > You can override the guess by passing --os=cygwin to configure.py
> >
> > The following patch should also fix it; it will be included in
> > the next release (if you could test and confirm it fixes the
> > problem, that it would be appreciated):
> >
> > --- configure.py        646ee5cb324b79ecddbb270259b4ced7f05fc35c
> > +++ configure.py        3cd55f8893b71cd6e869233f62e5c09129de243a
> > @@ -1059,6 +1059,10 @@ def main(argv = None):
> >     if options.os == "java":
> >         raise Exception("Jython detected: need --os and --cpu to set
> > target")
> >
> > +    if re.match('^cygwin_.*', options.os):
> > +        logging.debug("Converting '%s' to 'cygwin'", options.os)
> > +        options.os = 'cygwin'
> > +
> >     options.base_dir = os.path.dirname(argv[0])
> >     options.src_dir = os.path.join(options.base_dir, 'src')
> >
> >
> > Thanks,
> >  Jack
> > _______________________________________________
> > botan-devel mailing list
> > botan-devel at randombit.net
> > http://lists.randombit.net/mailman/listinfo/botan-devel
> >
-------------- next part --------------
#
# old_revision [25f4495c9b4fd94fc7a174762aee16414e05dae6]
#
# patch "configure.py"
#  from [3cd55f8893b71cd6e869233f62e5c09129de243a]
#    to [43fe483760e122c14dde97f0bff8ff5489ad9305]
#
============================================================
--- configure.py	3cd55f8893b71cd6e869233f62e5c09129de243a
+++ configure.py	43fe483760e122c14dde97f0bff8ff5489ad9305
@@ -161,6 +161,10 @@ def process_command_line(args):
                            action='store_true', default=False,
                            help=SUPPRESS_HELP)
 
+    build_group.add_option('--link-method',
+                           default=None,
+                           help=SUPPRESS_HELP)
+
     mods_group = OptionGroup(parser, 'Module selection')
 
     mods_group.add_option('--enable-modules', dest='enabled_modules',
@@ -937,15 +941,34 @@ def setup_build(build_config, options, t
 def setup_build(build_config, options, template_vars):
 
     """
+    Choose the link method based on system availablity and user request
+    """
+    def choose_link_method(req_method):
+
+        def useable_methods():
+            if 'symlink' in os.__dict__:
+                yield 'symlink'
+            if 'link' in os.__dict__:
+                yield 'hardlink'
+            yield 'copy'
+
+        for method in useable_methods():
+            if req_method is None or req_method == method:
+                return method
+
+        logging.info('Could not use requested link method %s' % (req_method))
+        return 'copy'
+
+    """
     Copy or link the file, depending on what the platform offers
     """
-    def portable_symlink(filename, target_dir):
+    def portable_symlink(filename, target_dir, method):
 
         if not os.access(filename, os.R_OK):
             logging.warning('Missing file %s' % (filename))
             return
 
-        if 'symlink' in os.__dict__:
+        if method == 'symlink':
             def count_dirs(dir, accum = 0):
                 if dir == '' or dir == os.path.curdir:
                     return accum
@@ -961,12 +984,15 @@ def setup_build(build_config, options, t
 
             os.symlink(source, target)
 
-        elif 'link' in os.__dict__:
+        elif method == 'hardlink':
             os.link(filename,
                     os.path.join(target_dir, os.path.basename(filename)))
 
+        elif method == 'copy':
+            shutil.copy(filename, target_dir)
+
         else:
-            shutil.copy(filename, target_dir)
+            raise Exception('Unknown link method %s' % (method))
 
     def choose_makefile_template(style):
         if style == 'nmake':
@@ -1027,8 +1053,13 @@ def setup_build(build_config, options, t
     logging.debug('Linking %d header files in %s' % (
         len(build_config.headers), build_config.full_include_dir))
 
+    link_method = choose_link_method(options.link_method)
+    logging.info('Using %s to link files into build directory' % (link_method))
+
     for header_file in build_config.headers:
-        portable_symlink(header_file, build_config.full_include_dir)
+        portable_symlink(header_file,
+                         build_config.full_include_dir,
+                         link_method)
 
 """
 Main driver


More information about the botan-devel mailing list