daokoder / dao-modules

Dao Standard Modules
http://daovm.net
12 stars 5 forks source link

Module "net" and "os.fs" do not compile with the latest MinGW #17

Closed daokoder closed 10 years ago

daokoder commented 10 years ago

With MinGW 4.0, SO_EXCLUSIVEADDRUSE is not defined for net; and ELOOP is not defined for os.fs.

@Night-walker, what version of MinGW did you use?

Night-walker commented 10 years ago

Again, I've been using MinGW 4.8.2 for months. 4.0 should be very old by now.

daokoder commented 10 years ago

4.8.2 is the version number for GCC, not MinGW. The GCC in my MinGW installation is 4.8.1-4, so not very old. I actually used mingw-get-setup.exe which was downloaded just a few hours ago to install it, and supposed it to be the latest. But how did you install it?

Night-walker commented 10 years ago

I can't remember for sure how I got it. I think I simply copied MinGW from Qt SDK distribution...

It is also quite strange that ELOOP is not defined, since I believe I didn't make changes to error handling in fs for a long time. Which means it definitely compiled with GCC 4.8.0 or even earlier. Even more strange is the absence of SO_EXCLUSIVEADDRUSE which is defined in winsock2.h and thus should have no relation to MinGW.

Night-walker commented 10 years ago

Downloaded a MinGW build with GCC 4.8.1. Both fs and net get built fine.

daokoder commented 10 years ago

So it has something to do with the system. I think we need workaround for this.

Night-walker commented 10 years ago

Updating Windows SDK? Using some other Windows in a VM? I'm afraid that otherwise we'll hit more such issues in the future.

daokoder commented 10 years ago

Updating Windows SDK? Using some other Windows in a VM? I'm afraid that otherwise we'll hit more such issues in the future.

We cannot expect all the users to have the right SDK or whatsoever to use Dao and its standard modules, right? I think standard modules should not be very picky on the system, SDKs or compilers.

Night-walker commented 10 years ago

First, users don't have to build Dao manually. Normally, there should be binaries/packages for all main platforms. It's just not needed at the moment. Some stuff may already refuse to build on Windows 8, for instance, but that doesn't mean that it won't be usable on that system.

Second, support for various platforms should not impede the code operability. It's better if some module doesn't build then if it malfunctions due to disabled code. Anyway, I add fixes for possible missing ELOOP (it's not 62 but 114 in errno.h I have) and SO_EXCLUSIVEADDRUSE, as it should be safe to do so in this very case. By the way, it must be because of MinGW in the end, as its distribution seems to include all the headers it uses including windows.h and winsock.h.

daokoder commented 10 years ago

First, users don't have to build Dao manually. Normally, there should be binaries/packages for all main platforms. It's just not needed at the moment. Some stuff may already refuse to build on Windows 8, for instance, but that doesn't mean that it won't be usable on that system.

We cannot provide binary package all the time (for example, between releases).

It's better if some module doesn't build then if it malfunctions due to disabled code.

Yes, only if it does not prevent other modules from building. The error I experienced clearly does this.

By the way, it must be because of MinGW in the end, as its distribution seems to include all the headers it uses including windows.h and winsock.h

Then it's really strange that yours can build, while mine cannot.

Night-walker commented 10 years ago

MinGW is not really a reliable choice. Anyway, the issue is resolved. At least by now.

daokoder commented 10 years ago

Anyway, I add fixes for possible missing ELOOP (it's not 62 but 114 in errno.h I have) and SO_EXCLUSIVEADDRUSE, as it should be safe to do so in this very case.

Thanks. There is still one remaining problem, I got undefined reference to _chsize_s error for os.fs.

Night-walker commented 10 years ago

Then support for large files will be broken. I definitely against different behavior for different compilers, this is simply becoming ridiculous.

Try this MinGW build, it should work. If you think that asking for a non-official MinGW build is too much, I will have no choice but to disable file size changing since I don't see any other alternative.

Night-walker commented 10 years ago

Actually, there is way via Win API, but the code gonna be monstrous...

daokoder commented 10 years ago

If you think that asking for a non-official MinGW build is too much, I will have no choice but to disable file size changing since I don't see any other alternative.

Yes, I think it is too much. We can add it after a new official MinGW build supports it.

Night-walker commented 10 years ago

Done.

daokoder commented 10 years ago

Thanks.