Can't build bjam with cygwin gcc?

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't build bjam with cygwin gcc?

John Maddock
An assertion fails when trying to build with cygwin gcc, anyone any ideas?

John.

###
### Using 'gcc' toolset.
###
rm -rf bootstrap
mkdir bootstrap
gcc -o bootstrap/jam0 command.c compile.c debug.c execunix.c expand.c
fileunix.c
 glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c
mak
e1.c newstr.c option.c parse.c pathunix.c pathvms.c regexp.c rules.c scan.c
sear
ch.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c
pwd
.c class.c native.c w32_getreg.c modules/set.c modules/path.c
modules/regex.c mo
dules/property-set.c modules/sequence.c modules/order.c execnt.c filent.c
./bootstrap/jam0 -f build.jam --toolset=gcc --toolset-root= clean
assertion "!strcmp( l->string, "c:\\foo\\bar" )" failed: file "expand.c",
line 7
23
build.sh: line 13:  3876 Aborted                 (core dumped) $@

_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

Rene Rivera
John Maddock wrote:
> An assertion fails when trying to build with cygwin gcc, anyone any ideas?
>
> assertion "!strcmp( l->string, "c:\\foo\\bar" )" failed: file "expand.c",

Yes! :-)

There's code in the var_expand_unit_test that tries to verify the
functionality of expanding paths. In the case of Cygwin it wants to
check that something like "/cygdrive/c/foo/bar" is translated to
something like "c:\foo\bar". The problem comes in that the "/cygdrive"
part is a user configurable path on Cygwin. I wrote code that tries to
decipher what that 'cygdrive' is, as there doesn't seem to be any Cygwin
call to get that value. Unfortunately, or fortunately from my POV, I
don't have Cygwin to test with. So any help in getting that code working
is appreciated ;-)



--
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - Grafik/jabber.org
_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

John Maddock
> There's code in the var_expand_unit_test that tries to verify the
> functionality of expanding paths. In the case of Cygwin it wants to
> check that something like "/cygdrive/c/foo/bar" is translated to
> something like "c:\foo\bar". The problem comes in that the "/cygdrive"
> part is a user configurable path on Cygwin. I wrote code that tries to
> decipher what that 'cygdrive' is, as there doesn't seem to be any
> Cygwin call to get that value. Unfortunately, or fortunately from my
> POV, I don't have Cygwin to test with. So any help in getting that
> code working is appreciated ;-)

Patch below, note that using the $PATH to get at the /cygdrive name is a
non-starter as /usr/bin is the first value in there (for me at least).

OK to commit?

John.

Index: expand.c
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/jam_src/expand.c,v
retrieving revision 1.12
diff -u -r1.12 expand.c
--- expand.c    6 Dec 2005 20:18:22 -0000       1.12
+++ expand.c    27 Jan 2006 11:06:30 -0000
@@ -685,16 +685,7 @@

     # ifdef OS_CYGWIN
     char cygpath[256];
-    {
-        const char * P = getenv("PATH");
-        const char * slash = 0;
-        slash = strchr(P+1,'/');
-        assert(slash != 0);
-        strncpy(cygpath,P,slash-P+1);
-        cygpath[slash-P+1] = '\0';
-        assert(strlen(cygpath) < 246);
-        strcat(cygpath,"c/foo/bar");
-    }
+    cygwin_conv_to_posix_path("c:\\foo\\bar", cygpath);
     # else
     char cygpath[] = "/cygdrive/c/foo/bar";
     # endif

_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

Rene Rivera
John Maddock wrote:
> Patch below, note that using the $PATH to get at the /cygdrive name is a
> non-starter as /usr/bin is the first value in there (for me at least).
>
> OK to commit?

Yes :-)

--
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - Grafik/jabber.org
_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

John Maddock
> Yes :-)

OK done.

John.
_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

Mark Evans-2
In reply to this post by Rene Rivera
Has there been any progress on this issue?  I am getting this assertion failure with the latest nightly build on CYGWIN which was installed using the default /cygdrive/c .  Can I edit out the assertion as a workaround or what?

Regards,
Mark

Rene Rivera <[hidden email]> wrote:
John Maddock wrote:
> An assertion fails when trying to build with cygwin gcc, anyone any ideas?
>
> assertion "!strcmp( l->string, "c:\\foo\\bar" )" failed: file "expand.c",

Yes! :-)

There's code in the var_expand_unit_test that tries to verify the
functionality of expanding paths. In the case of Cygwin it wants to
check that something like "/cygdrive/c/foo/bar" is translated to
something like "c:\foo\bar". The problem comes in that the "/cygdrive"
part i! s a user configurable path on Cygwin. I wrote code that tries to
decipher what that 'cygdrive' is, as there doesn't seem to be any Cygwin
call to get that value. Unfortunately, or fortunately from my POV, I
don't have Cygwin to test with. So any help in getting that code working
is appreciated ;-)



--
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - Grafik/jabber.org
_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build


_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

Mark Evans-2
In reply to this post by John Maddock
To answer my own question, I backed out changes that were made to jam_src/expand.c since the last "stable" build to work around this problem.  The changes were for unit testing and don't jive with cygwin.

The value of the string l->string at the point of failure, at:

assertion "!strcmp( l->string, "c:\\foo\\bar" )" failed: file "expand.c", line 723

is "C:\\cygwin\\usr\\c\\foo\\bar".  Back to the drawing board.  :-)

Cheers,
Mark

Mark Evans <[hidden email]> wrote:
Has there been any progress on this issue?  I am getting this assertion failure with the latest nightly build on CYGWIN which was installed using the default /cygdrive/c .  Can I edit out the assertion as a workaround or what?

Regards,
Mark

Rene Riv! era <[hidden email]> wrote:
John Maddock wrote:
> An assertion fails when trying to build with cygwin gcc, anyone any ideas?
>
> assertion "!strcmp( l->string, "c:\\foo\\bar" )" failed: file "expand.c",

Yes! :-)

There's code in the var_expand_unit_test that tries to verify the
functionality of expanding paths. In the case of Cygwin it wants to
check that something like "/cygdrive/c/foo/bar" is translated to
something like "c:\foo\bar". The problem comes in that the "/cygdrive"
part is a user configurable path on Cygwin. I wrote code that tries to
decipher what that 'cygdrive' is, as there doesn't seem to be any Cygwin
call to get that value. Unfortunately, or fortunately from my POV, I
don't have Cygwin to test with. So any help in getting that code working
is apprec! iated ;-)



--
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - Grafik/jabber.org
_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build



_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

Rene Rivera
In reply to this post by Mark Evans-2


Mark Evans wrote:
> Has there been any progress on this issue? I am getting this assertion
failure with the latest nightly build on CYGWIN which was installed using the
default /cygdrive/c . Can I edit out the assertion as a workaround or what?

John checked in a fix a few days ago. Do you have his fix? It looks like this:

-    {
-        const char * P = getenv("PATH");
-        const char * slash = 0;
-        slash = strchr(P+1,'/');
-        assert(slash != 0);
-        strncpy(cygpath,P,slash-P+1);
-        cygpath[slash-P+1] = '\0';
-        assert(strlen(cygpath) < 246);
-        strcat(cygpath,"c/foo/bar");
-    }
+    cygwin_conv_to_posix_path("c:\\foo\\bar", cygpath);


--
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq
_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

Mark Evans-2
This CYGWIN build that failed was from the latest nightly build downloaded this morning (30Jan2006).

Rene Rivera <[hidden email]> wrote:


Mark Evans wrote:
> Has there been any progress on this issue? I am getting this assertion
failure with the latest nightly build on CYGWIN which was installed using the
default /cygdrive/c . Can I edit out the assertion as a workaround or what?

John checked in a fix a few days ago. Do you have his fix? It looks like this:

- {
- const char * P = getenv("PATH");
- const char * slash = 0;
- slash = strchr(P+1,'/');
- assert(slash != 0);
- strncpy(cygpath,P,slash-P+1);
- cygpath[slash-P+1] = '\0';
- assert(strlen(cygpath) < 246);
- strcat(cygpath,"c/foo/bar");
- }
+ cygwin_conv_to_posix_path("c:\\foo\\bar", cygpath);


--
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq
_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build


_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

Daniel Einspanjer
In reply to this post by John Maddock
On 2006-01-26 12:07:31 Rene Rivera said:
> There's code in the var_expand_unit_test that tries to verify the
> functionality of expanding paths. In the case of Cygwin it wants to
> check that something like "/cygdrive/c/foo/bar" is translated to
> something like "c:\foo\bar". The problem comes in that the "/cygdrive"
> part is a user configurable path on Cygwin. I wrote code that tries to
> decipher what that 'cygdrive' is, as there doesn't seem to be any Cygwin
> call to get that value. Unfortunately, or fortunately from my POV, I
> don't have Cygwin to test with. So any help in getting that code working
> is appreciated ;-)

Please pardon me if this post is not helpful, but I as I was digging through the archives here trying to get up to speed with Boost.Build V2, I saw your comment about not knowing how to detect cygdrive.  I just happened to be looking at the code for the cygwin version of mount and I was wondering if maybe this snippit might be useful:

From /usr/src/cygwin- 1.5.19-4/winsup/utils/mount.cc

/* show_cygdrive_info: Show the user and/or cygdrive info, i.e., prefix and
   flags.*/
static void
show_cygdrive_info ()
{
  /* Get the cygdrive info */
  char user[MAX_PATH];
  char system[MAX_PATH];
  char user_flags[MAX_PATH];
  char system_flags[MAX_PATH];
  cygwin_internal (CW_GET_CYGDRIVE_INFO, user, system, user_flags,
           system_flags);

  /* Display the user and system cygdrive path prefix, if necessary
     (ie, not empty) */
  const char *format = "%-18s  %-11s  %s\n";
  printf (format, "Prefix", "Type", "Flags");
  if (strlen (user) > 0)
    printf (format, user, "user", user_flags);
  if (strlen (system) > 0)
    printf (format, system, "system", system_flags);

  exit (0);
}


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

John Maddock
In reply to this post by Mark Evans-2
>> The value of the string l->string at the point of failure, at:
>>
>> assertion "!strcmp( l->string, "c:\\foo\\bar" )" failed: file
>> "expand.c", line 723
>>
>> is "C:\\cygwin\\usr\\c\\foo\\bar".  Back to the drawing board.  :-)

I don't understand that, it's certainly building OK for me at present.

Can you check that:

In expand.c line 688:

after the call to cygwin_conv_to_posix_path the variable "cygpath" should
contain "/cygdrive/c/foo/bar"

and then in expand.c line 665:

the variable out->value should be "/cygdrive/c/foo/bar", and after the call
to cygwin_conv_to_win32_path "result" should contain "c:\\foo\\bar".

John.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

Mark Evans-2
I downloaded yesterday the code below that fails on cygwin.  The first #ifndef  is at line 675 (which does not line up with what you said was at line 688).  The true path of the first #ifdef OS_CYGWIN makes an unreasonable assumption about the value of the user's PATH variable.  My path variable starts with "/usr/bin:" as set by me in my .bashrc file.  It could have started with ".:/usr/bin:". I don't understand the author's expectation here.

----------------------------------------
#ifndef NDEBUG
void var_expand_unit_test()
{
    LOL lol[1];
    LIST* l, *l2;
    LIST *expected = list_new( list_new( L0, newstr( "axb" ) ), newstr( "ayb" ) );
    LIST *e2;
    char axyb[] = "a$(xy)b";
    char azb[] = "a$($(z))b";
    char path[] = "$(p:W)";
  &n! bsp;
    # ifdef OS_CYGWIN
    char cygpath[256];
    {
        const char * P = getenv("PATH");
        const char * slash = 0;
        slash = strchr(P+1,'/');
        assert(slash != 0);
        strncpy(cygpath,P,slash-P+1);
        cygpath[slash-P+1] = '\0';
        assert(strlen(cygpath) < 246);
        strcat(cygpath,"c/foo/bar");
    }
    # else
    char cygpath[] = "/cygdrive/c/foo/bar";
    # endif
       
    lol_init(lol);
    var_set("x! y", list_new( list_new( L0, newstr( "x" ) ), newstr( "y" ) ), VAR_SET );
    var_set("z", list_new( L0, newstr( "xy" ) ), VAR_SET );
    var_set("p", list_new( L0, newstr( cygpath ) ), VAR_SET );

    l = var_expand( 0, axyb, axyb + sizeof(axyb) - 1, lol, 0 );
    for ( l2 = l, e2 = expected; l2 && e2; l2 = list_next(l2), e2 = list_next(e2) )
        assert( !strcmp( e2->string, l2->string ) );
    assert(l2 == 0 && e2 == 0);
    list_free(l);
   
    l = var_expand( 0, azb, azb + sizeof(azb) - 1, lol, 0 );
    for ( l2 = l, e2 = expected; l2 && e2; l2 = list_next(l2), e2 = list_next(e2) )
        assert( !strcmp( e2->string, l2->string ) );
    assert(l2 == 0 &! amp;& e2 == 0);
    list_free(l);

    l = var_expand( 0, path, path + sizeof(path) - 1, lol, 0 );
    assert(l != 0);
    assert(list_next(l) == 0);
    # ifdef OS_CYGWIN
    assert( !strcmp( l->string, "c:\\foo\\bar" ) );
    # else
    assert( !strcmp( l->string, cygpath ) );
    # endif  
    list_free(l);

    list_free(expected);
   
    lol_free(lol);
}
#endif
----------------------------------

OS_CYGWIN is defined in jam.h -

John Maddock <[hidden email]> wrote:
>> The value of the string l->string at the po! int of failure, at:
>>
>> assertion "!strcmp( l->string, "c:\\foo\\bar" )" failed: file
>> "expand.c", line 723
>>
>> is "C:\\cygwin\\usr\\c\\foo\\bar". Back to the drawing board. :-)

I don't understand that, it's certainly building OK for me at present.

Can you check that:

In expand.c line 688:

after the call to cygwin_conv_to_posix_path the variable "cygpath" should
contain "/cygdrive/c/foo/bar"

and then in expand.c line 665:

the variable out->value should be "/cygdrive/c/foo/bar", and after the call
to cygwin_conv_to_win32_path "result" should contain "c:\\foo\\bar".

John.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

Rene Rivera
Mark Evans wrote:
> I downloaded yesterday the code below that fails on cygwin. The first
>
#ifndef is at line 675 (which does not line up with what you said was at
line 688). The true path of the first #ifdef OS_CYGWIN makes an
unreasonable assumption about the value of the user's PATH variable. My
path variable starts with "/usr/bin:" as set by me in my .bashrc file.
It could have started with ".:/usr/bin:". I don't understand the
author's expectation here.

The authors expectation, being me, is wrong/stupid/shortsighted :-)
Hence why John fixed the code:

<http://sourceforge.net/mailarchive/forum.php?thread_id=9578656&forum_id=9097>
<http://cvs.sourceforge.net/viewcvs.py/boost/boost/tools/build/jam_src/expand.c?r1=1.12&r2=1.13>

You have the broken code. So what did you mean by "downloaded yesterday"?


--grafik
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Can't build bjam with cygwin gcc?

Mark Evans-2
Rene,

Thanks for the URL -- I haven't seen that page!  I was using the "nightly build"  option at http://www.boost.org/tools/build/v2/ .  LOL - As for stupid, short-sighted, etc., I'm captain of that ship, mate.

Cheers,
Mark


Rene Rivera <[hidden email]> wrote:
Mark Evans wrote:
> I downloaded yesterday the code below that fails on cygwin. The first
>
#ifndef is at line 675 (which does not line up with what you said was at
line 688). The true path of the first #ifdef OS_CYGWIN makes an
unreasonable assumption about the value of the user's PATH variable. My
path variable starts with "/usr/bin:" as set by me in my .bashrc file.
It could have started with ".:/usr/bin:". I don't understand the
author's expectation here.

The authors expectation, being me, is wrong/stupid/shortsighted :-)
Hence why John fixed the code:




You have the broken code. So what did you mean by "downloaded yesterday"?


--grafik
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build