VMware Communities
TheronT
Contributor
Contributor

Regression: errors from mingw gcc in Windows guest starting with 6.5.0

I already filed a bug report on this, but am posting this to the forum in case it's helpful to anyone else. I use a linux host and a windows guest so that I can compile code on both platforms at once. The code in question is compiled using GNU's MinGW environment on Windows so that I can use gcc on both linux and Windows (keeps the number of #ifdefs way down). I access the code on Windows using shared folders so that the same source tree can be compiled on linux and Windows without having to copy files back and forth.

I was very disappointed to see that in Workstation 6.5.0 there was some regression that suddenly caused gcc to start spewing out hundreds of error messages. When the problem didn't go away in 6.5.1 I took the time to track down the issue. The regression seems to be how Workstation handles files that don't exist. Specifically, when you call the open() function in Windows (part of the Windows POSIX layer) on a path that includes a directory that doesn't exist, errno is set to EINVAL. In prior versions of Workstation (and when compiling on a local disk without shared folders), errno is set to ENOENT. It seems that gcc is looking at errno and treating ENOENT as a "soft" error that causes it to keep looking in other directories for missing header files -- whereas EINVAL causes gcc to fail.

If you have the MingGW environment set up, you will notice the problem with this source file:

#include <sys/time.h>
int main() { struct timeval t; } 

And then try to compile it with:

gcc -I my_includes test_file.c

You'll get an error message saying "my_includes/sys/time.h: Invalid argument"

Here's a standalone program that reproduces the problem. With a linux host, it runs fine on Workstation 6.5.x. It runs on all versions of Workstation when not using shared folders. It fails when run with Workstation 6.5.0 or 6.5.1 when run from a shared folder directory.

#undef NDEBUG
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <windows.h>

int main()
{
    /* This seems to work correctly in all versions of Workstation 6 */
    int fd = open("SomeFileThatDoesntExist", O_RDONLY);
    int err = errno;

    assert(err == ENOENT);

    /* This case works correctly when not using shared folders, or
       when using Workstation 6.0.x.  With Workstation 6.5.0 and
       6.5.1, errno will be set to 22 (EINVAL).  This is a regression. */
    fd = open("SomeDirThatDoesntExist/File", O_RDONLY);
    err = errno;

    assert(err == ENOENT);

    return 0;
}

Tags (2)
Reply
0 Kudos
1 Reply
continuum
Immortal
Immortal

Are you using the "VMware shared folders feature" ? - forget it - thats too buggy for serious use. Try with regular filesharing via Samba instead

___________________________________

description of vmx-parameters:

VMware-liveCD:


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos