Re: [tor-dev] Building TOR using Visual Studio
teor wrote: Are there no-cost, non-license-restricted compilers available for Windows that support C99? Yes, the MinGW compilers fit the bill. Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
On 18 Oct 2014, at 06:29, teor teor2...@gmail.com wrote: Are there no-cost, non-license-restricted compilers available for Windows that support C99? This could be a way out for those who don't wish to pay for the VS 2013 upgrade. But it's a bit more of a barrier than using an existing compiler on the system. Well, it's always possible to compile it using mingw with gcc. Not that big of a barrier imo? ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
teor: Nick Mathewson: * Some people want to use paid versions of Visual Studio, and have paid for a version earlier than VS2013, and don't want to pay for a newer one. I sympathize with this: I've been on paid upgrade treadmills myself, and it's always tempting to save money by skipping steps in the upgrade treadmill. I've even paid for commercial compilers in my misspent youth. Are there no-cost, non-license-restricted compilers available for Windows that support C99? I assume MinGW fits: http://www.mingw.org/ MinGW is also what is used to build Tor for the Windows version of the Tor Browser (run on GNU/Linux). -- Lunar lu...@torproject.org signature.asc Description: Digital signature ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
On Sat, Oct 18, 2014 at 03:29:51PM +1100, teor wrote: | | On 18 Oct 2014, at 13:29 , tor-dev-requ...@lists.torproject.org wrote: | Date: Fri, 17 Oct 2014 22:29:02 -0400 | From: Nick Mathewson ni...@freehaven.net | To: tor-dev@lists.torproject.org | Subject: Re: [tor-dev] Building TOR using Visual Studio | | * Some people want to use paid versions of Visual Studio, and have | paid for a version earlier than VS2013, and don't want to pay for a | newer one. I sympathize with this: I've been on paid upgrade | treadmills myself, and it's always tempting to save money by skipping | steps in the upgrade treadmill. I've even paid for commercial | compilers in my misspent youth. | | Are there no-cost, non-license-restricted compilers available for Windows that support C99? | | This could be a way out for those who don't wish to pay for the VS 2013 upgrade. Depending on what you mean by non-license-restricted, Visual Studio Express may fit the bill. https://en.wikipedia.org/wiki/Microsoft_Visual_Studio_Express http://www.visualstudio.com/downloads/download-visual-studio-vs Others have brought up mingw, I'm not sure how many of the security features included in the Visual Studio toolchain (such as ASLR, DEP and SEH) are available when building with mingw. Adam -- Join my mailing list, and be the first to hear about my new projects! http://adam.shostack.org/newthing.html ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
On Sat, Oct 18, 2014 at 03:29:51PM +1100, teor wrote: * Some compilers for weird old hardware have never been upgraded to even rudimentary C99 support, and trying to build code with those weird old compilers is a good way to expose some bugs. I sympathize with this too: there was one guy who would always compile new versions of Tor on his old Irix boxes, and he always turned up a new warning or two when he did. Static analysers, better compiler warnings, and runtime checks are starting to fill the role previous occupied by obscure systems. And mobile/embedded platforms help with this too :-) I think we may be able to compensate for lack of C89 support for old compilers, by using a combination of coverity, clang --analyze, gcc/clang -ftrapv , and clang -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error. Oh, and unit tests :-) Theo de Raadt [1]: The answer to that is not news. On a regular basis, we find real and serious bugs which affect all platforms, but they are incidentally made visible on one of the platforms we run, following that they are fixed. It is a harsh reality which static and dynamic analysis tools have not yet resolved. Now, If you don't realize this is the reason we try to run on the older platforms... [1] http://marc.info/?l=openbsd-techm=138973312304511w=2 ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
Looking at this blog post [1] even the support for C99 in VS2013 is limited. I don't know if tor hit the limitations, that's for you to decide. C99 is 15 years old ... It should be sane to use it. [1] https://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-library-support-in-visual-studio-2013.aspx?Redirected=true signature.asc Description: PGP signature ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
On 17 Oct 2014, at 18:07, M. Ziebell ziebell_ma...@posteo.de wrote: Looking at this blog post [1] even the support for C99 in VS2013 is limited. I don't know if tor hit the limitations, that's for you to decide. C99 is 15 years old ... It should be sane to use it. Please also see bug #13260 and its friend #13233. We might re-evaluate based on this input here, tho I'm inclined not to... Cheers Sebastian https://trac.torproject.org/projects/tor/ticket/13260 https://trac.torproject.org/projects/tor/ticket/13233 ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
teor wrote: I just looked over this patch and it looks safe and simple to commit (haven't have a chance to compile it yet though). The correct order of declaration, asserts, and initialisation / assignment has been preserved in the code. If we commit this patch, we should probably change the C standard compiler flags to in the autoconf scripts to C89 as well. (Do we set those?) This would stop any more C99 sneaking in... The vast majority of Vladimir's patch was fix something call Mixed Declarations eg: int i = 0 ; printf (%d\n, i) ; int j = 1 ; You can disallow these mixed declarations in C99 code using -Wdeclaration-after-statement which is probably better than downgrading everything to C89 for comaptibilty with one compiler. People should also be aware than even though VS2013 claims some C99 compatibility my recollection is that it still does not provide a standards conforming snprintf implementation. Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
On Fri, Oct 17, 2014 at 5:01 PM, Erik de Castro Lopo mle+to...@mega-nerd.com wrote: teor wrote: I just looked over this patch and it looks safe and simple to commit (haven't have a chance to compile it yet though). The correct order of declaration, asserts, and initialisation / assignment has been preserved in the code. If we commit this patch, we should probably change the C standard compiler flags to in the autoconf scripts to C89 as well. (Do we set those?) This would stop any more C99 sneaking in... The vast majority of Vladimir's patch was fix something call Mixed Declarations eg: int i = 0 ; printf (%d\n, i) ; int j = 1 ; You can disallow these mixed declarations in C99 code using -Wdeclaration-after-statement which is probably better than downgrading everything to C89 for comaptibilty with one compiler. Well, we've actually had that warning in place in Tor for a long time. We turned it off recently in the master branch. See Sebastian's message above above about the tickets where we turned it off, in particular: https://trac.torproject.org/projects/tor/ticket/13233 https://trac.torproject.org/projects/tor/ticket/13230 The question here isn't, What do we need to do to keep compatibility with C89 -- we've been doing that for ages. The question is, Is there a compelling reason to maintain compatibility with C89 that overrides the benefits of modernizing a little bit. Keep in mind that C99 is 15 years old now. Staying with C89 today feels rather a lot like staying with KR C 15 years after C89 was standardized. Sure, some projects still were (and still are!) written in KR style, but by 2004 it had become pretty uncommon. Right now, the most compelling cases for staying with C89 I've heard are: * Some people want to use paid versions of Visual Studio, and have paid for a version earlier than VS2013, and don't want to pay for a newer one. I sympathize with this: I've been on paid upgrade treadmills myself, and it's always tempting to save money by skipping steps in the upgrade treadmill. I've even paid for commercial compilers in my misspent youth. * Some compilers for weird old hardware have never been upgraded to even rudimentary C99 support, and trying to build code with those weird old compilers is a good way to expose some bugs. I sympathize with this too: there was one guy who would always compile new versions of Tor on his old Irix boxes, and he always turned up a new warning or two when he did. Do we have any other cases to think about here? Personally, I think I'm still inclined to say that the day for a more modern style has arrived. People should also be aware than even though VS2013 claims some C99 compatibility my recollection is that it still does not provide a standards conforming snprintf implementation. Not to worry; we fake our own snprintf if the platform snprintf isn't comformant enough. -- Nick ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
Nick Mathewson wrote: Keep in mind that C99 is 15 years old now. snip Personally, I think I'm still inclined to say that the day for a more modern style has arrived. I'm totally with you on this. I've been coding C to meet the C99 standards since the mid-2000s :-). Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
On 18 Oct 2014, at 13:29 , tor-dev-requ...@lists.torproject.org wrote: Date: Fri, 17 Oct 2014 22:29:02 -0400 From: Nick Mathewson ni...@freehaven.net To: tor-dev@lists.torproject.org Subject: Re: [tor-dev] Building TOR using Visual Studio * Some people want to use paid versions of Visual Studio, and have paid for a version earlier than VS2013, and don't want to pay for a newer one. I sympathize with this: I've been on paid upgrade treadmills myself, and it's always tempting to save money by skipping steps in the upgrade treadmill. I've even paid for commercial compilers in my misspent youth. Are there no-cost, non-license-restricted compilers available for Windows that support C99? This could be a way out for those who don't wish to pay for the VS 2013 upgrade. But it's a bit more of a barrier than using an existing compiler on the system. * Some compilers for weird old hardware have never been upgraded to even rudimentary C99 support, and trying to build code with those weird old compilers is a good way to expose some bugs. I sympathize with this too: there was one guy who would always compile new versions of Tor on his old Irix boxes, and he always turned up a new warning or two when he did. Static analysers, better compiler warnings, and runtime checks are starting to fill the role previous occupied by obscure systems. And mobile/embedded platforms help with this too :-) I think we may be able to compensate for lack of C89 support for old compilers, by using a combination of coverity, clang --analyze, gcc/clang -ftrapv , and clang -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error. Oh, and unit tests :-) teor pgp 0xABFED1AC hkp://pgp.mit.edu/ https://gist.github.com/teor2345/d033b8ce0a99adbc89c5 http://0bin.net/paste/Mu92kPyphK0bqmbA#Zvt3gzMrSCAwDN6GKsUk7Q8G-eG+Y+BLpe7wtmU66Mx signature.asc Description: Message signed with OpenPGP using GPGMail ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
On Thu, Oct 16, 2014 at 7:40 AM, Владимир Мартьянов vilgefo...@gmail.com wrote: Hi all! I'm new at this list :-) I decided to understand how TOR works and I want to build it in VS to debug it and explore it's internals. I have Visual Studio on my first PC and I got errors during build on address.c. I investigated the reason: commit 0ca83872468af59b94e14fe7fdfcb38cb5a3f496 I have Visual Studio express 2013 on my second PC and I didn't have any problems building the TOR. So I have two questions: did you decide not to support old Visual Studio versions or it'll be better to build TOR in VS2008 too? If old versions aren't supported, should it be some #error directives in sources to explain this decision? It was really hard to understand where's the problem, so I think #error will be very helpfull. If you give me some instructions about the problem, I'll try to commit the changes. Thank you. Hello, Vladimir! That's the commit where we decided that, since C99 is 15 years old now, it's probably okay for us to require a compiler to support it. I thought that I would get more feedback by breaking the master branch than by asking on a mailing list. I'd be happy to take a patch that added #error directives for compilers that don't have basic C99 support. But first, I'd like to ask you, and anyone else who sometimes uses compilers that don't support C99: Is it important for Tor that we keep supporting C89? Are there a lot of VS2008 users who can't upgrade? -- Nick ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
As far as I know only Visual Studio 2013 has C99 support. Upgrade to VS2013 costs about 300$ for commercial versions, a lot of code was written in earlier versions... By the way, I fixed only about 10 lines of code and finally I managed to build the TOR using VS2008, so i think it's not so hard to make the code suitable for VS2008. How can I show you my changes? Make a diff in git and attach to the message? 2014-10-16 22:16 GMT+04:00 Nick Mathewson ni...@freehaven.net: On Thu, Oct 16, 2014 at 7:40 AM, Владимир Мартьянов vilgefo...@gmail.com wrote: Hi all! I'm new at this list :-) I decided to understand how TOR works and I want to build it in VS to debug it and explore it's internals. I have Visual Studio on my first PC and I got errors during build on address.c. I investigated the reason: commit 0ca83872468af59b94e14fe7fdfcb38cb5a3f496 I have Visual Studio express 2013 on my second PC and I didn't have any problems building the TOR. So I have two questions: did you decide not to support old Visual Studio versions or it'll be better to build TOR in VS2008 too? If old versions aren't supported, should it be some #error directives in sources to explain this decision? It was really hard to understand where's the problem, so I think #error will be very helpfull. If you give me some instructions about the problem, I'll try to commit the changes. Thank you. Hello, Vladimir! That's the commit where we decided that, since C99 is 15 years old now, it's probably okay for us to require a compiler to support it. I thought that I would get more feedback by breaking the master branch than by asking on a mailing list. I'd be happy to take a patch that added #error directives for compilers that don't have basic C99 support. But first, I'd like to ask you, and anyone else who sometimes uses compilers that don't support C99: Is it important for Tor that we keep supporting C89? Are there a lot of VS2008 users who can't upgrade? -- Nick ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Building TOR using Visual Studio
On Thu, Oct 16, 2014 at 02:16:32PM -0400, Nick Mathewson wrote: On Thu, Oct 16, 2014 at 7:40 AM, Владимир Мартьянов vilgefo...@gmail.com wrote: Hi all! I'm new at this list :-) I decided to understand how TOR works and I want to build it in VS to debug it and explore it's internals. I have Visual Studio on my first PC and I got errors during build on address.c. I investigated the reason: commit 0ca83872468af59b94e14fe7fdfcb38cb5a3f496 I have Visual Studio express 2013 on my second PC and I didn't have any problems building the TOR. So I have two questions: did you decide not to support old Visual Studio versions or it'll be better to build TOR in VS2008 too? If old versions aren't supported, should it be some #error directives in sources to explain this decision? It was really hard to understand where's the problem, so I think #error will be very helpfull. If you give me some instructions about the problem, I'll try to commit the changes. Thank you. Hello, Vladimir! That's the commit where we decided that, since C99 is 15 years old now, it's probably okay for us to require a compiler to support it. I thought that I would get more feedback by breaking the master branch than by asking on a mailing list. I'd be happy to take a patch that added #error directives for compilers that don't have basic C99 support. But first, I'd like to ask you, and anyone else who sometimes uses compilers that don't support C99: Is it important for Tor that we keep supporting C89? Are there a lot of VS2008 users who can't upgrade? Support for C89 makes it possible nativly compile and test software on old archs (e.g. VAX). This is one reason why OpenBSD supports many architectures that practically no longer used today. They have caught tons of bugs through this method. ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev