Re: LyX's master is now uncompilable

2015-10-20 Thread Georg Baum
Guillaume Munch wrote:

> I'll let Vincent decide whether he wants to make this change.

Sure, our messages crossed each other, I would not have suggested that if I 
knew that he had time to test.

The compilation error could btw easily be fixed by moving the implementation 
of the methods in a .cpp file (I would suggest to use 
src/support/docstream.cpp where id is already implemented, since adding a 
new .cpp would not be trivial: It would not need to be compiled on unix for 
example).


Georg




Re: LyX's master is now uncompilable

2015-10-20 Thread Vincent van Ravesteijn

Op 19-10-2015 om 23:36 schreef Guillaume Munch:

Le 19/10/2015 21:59, Vincent van Ravesteijn a écrit :


Op 19 okt. 2015 22:51 schreef "Guillaume Munch" >:
 >
 > Le 19/10/2015 21:34, Georg Baum a écrit :
 >>
 >>
 >> The message on the list is related to commit e948caf6, which is
supposed to
 >> fix exactly this issue. What I do not understand it why the fix 
does not
 >> work for your recent changes. Maybe you forgot to include 
docstream.h

 >> somewhere or got the include order wrong?
 >
 >
 > The former. If we are supposed to include support/docstream.h to use
odocstringstream, shouldn't the latter be defined in docstream.h instead
of strfwd.h? (or the fix be moved to strfwd.h which is already included
by docstream.h via docstring.h?)
 >
 > I am tempted to do the proper fix, but since I do not own MSVC,
people would have to bear with me if this breaks compilation 
temporarily.

 >

If you post the fix to the list here, I will try it tomorrow, and if it
works, I will commit.


Unfortunately, the patch doesn't work.

"docstring.h" includes "strfwd.h", which now includes 
"numpunct_lyx_char_type.h", which uses "from_ascii", which is defined in 
"docstring.h".


Vincent


Re: LyX's master is now uncompilable

2015-10-20 Thread Vincent van Ravesteijn

Op 20-10-2015 om 20:06 schreef Georg Baum:

Guillaume Munch wrote:


I'll let Vincent decide whether he wants to make this change.

Sure, our messages crossed each other, I would not have suggested that if I
knew that he had time to test.

The compilation error could btw easily be fixed by moving the implementation
of the methods in a .cpp file (I would suggest to use
src/support/docstream.cpp where id is already implemented, since adding a
new .cpp would not be trivial: It would not need to be compiled on unix for
example).


Ok, that's what I did.

Vincent


LyX's master is now uncompilable

2015-10-19 Thread Uwe Stöhr

Dear LyXers,

one of todays' commits broke the compilation for me with MSVC:

 C:\Program Files (x86)\Microsoft Visual Studio 
10.0\VC\include\xstring(982):
error C2491: 'std::numpunct<_Elem>::id': Definition of static data 
member for dllimport is not allowed 
[D:\LyXGit\Master\compile-result\src\LyX.vcxproj]


Georg, Guillaume, could you please have a look?

thanks and regards
Uwe


Re: LyX's master is now uncompilable

2015-10-19 Thread Uwe Stöhr

Am 19.10.2015 um 16:14 schrieb Uwe Stöhr:


one of todays' commits broke the compilation for me with MSVC:

  C:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\include\xstring(982):
error C2491: 'std::numpunct<_Elem>::id': Definition of static data
member for dllimport is not allowed
[D:\LyXGit\Master\compile-result\src\LyX.vcxproj]


The commit to blame is

http://www.lyx.org/trac/changeset/65d61e7a2786172da95ed9433ed0c49a7398f405/lyxgit

Guillaume?

thanks and regards
Uwe


Re: LyX's master is now uncompilable

2015-10-19 Thread Guillaume Munch

Le 19/10/2015 15:14, Uwe Stöhr a écrit :

Dear LyXers,

one of todays' commits broke the compilation for me with MSVC:

  C:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\include\xstring(982):
error C2491: 'std::numpunct<_Elem>::id': Definition of static data
member for dllimport is not allowed
[D:\LyXGit\Master\compile-result\src\LyX.vcxproj]

Georg, Guillaume, could you please have a look?

thanks and regards
Uwe



Dear Uwe,


Here up-to-date master compiles fine with g++ 4.9.2. In addition, I 
tried googling for your error but could not relate it to what I wrote. 
Let's see if Georg or other recent contributors understand this, 
otherwise I suggest that you find the failing commit with git bisect.



Best regards
Guillaume



Re: LyX's master is now uncompilable

2015-10-19 Thread Georg Baum
Guillaume Munch wrote:

> The former. If we are supposed to include support/docstream.h to use
> odocstringstream, shouldn't the latter be defined in docstream.h instead
> of strfwd.h? (or the fix be moved to strfwd.h which is already included
> by docstream.h via docstring.h?)

That was the missing bit, now I understand it. I believe that strfwd.h is 
newer than the MSVC fix.

> I am tempted to do the proper fix, but since I do not own MSVC, people
> would have to bear with me if this breaks compilation temporarily.

Please do it. I am 99% sure that moving these lines

#if defined(_MSC_VER) && (_MSC_VER >= 1600) 
// Ugly workaround for MSVC10 STL bug:
// std::numpunct has a hardcoded dllimport in definition, but we wanna it 
with 32 bit 
// so we can't import it and must define it but then the compiler complains.
#include "support/numpunct_lyx_char_type.h"
#endif

to strfwd.h will work. One could also restrict the MSVC version check to == 
1600 (since the bug is supposed to be fixed in later versions), but I would 
not do this part without test.


Georg



Re: LyX's master is now uncompilable

2015-10-19 Thread Georg Baum
Guillaume Munch wrote:

> Is that all the information that the compiler gives you? Does it not
> give you the name of the file?

This is the kind of error messages you often get from templates.
The compiler gives the name of the file where the error occurs, but it is a 
system header and not in our code. What I miss however are the 'included 
from...' lines. This is strange. Are we using precompiled headers with MSVC?

> I tried to understand the error message with what comes up on Google and
> I cannot relate it to my code. In addition, one of the first hits on
> Google is about a message on this list
> ,
> so it is possible that the bug is elsewhere (while still fixable by
> adapting my code).

The first hit I get is 
http://stackoverflow.com/questions/11076255/stdbasic-stringstreamunsigned-char-wont-compile-with-msvc-10
 which explains the 
problem quite well IMHO: On windows, wchar_t is 16 bit, and therefore we use 
a custom 32 bit type as char_type. Therefore the std::numpunct facets which 
are defined for char and wchar_t cannot be used, and we need to provide our 
own. Unfortunately MS messed up their STL, which declares 
std::numpunct<_Elem>::id in a template, although it is not (and cannot be) 
provided in the runtime dll for custom character types. Because of the 
awkward way how dlls work (declspec dllexport etc), this declaration 
pretends that the symbol, is exported by a dll (other simply declaring it 
would not be any problem).

The message on the list is related to commit e948caf6, which is supposed to 
fix exactly this issue. What I do not understand it why the fix does not 
work for your recent changes. Maybe you forgot to include docstream.h 
somewhere or got the include order wrong?


Georg




Re: LyX's master is now uncompilable

2015-10-19 Thread Guillaume Munch

Le 19/10/2015 22:01, Georg Baum a écrit :

Guillaume Munch wrote:


The former. If we are supposed to include support/docstream.h to use
odocstringstream, shouldn't the latter be defined in docstream.h instead
of strfwd.h? (or the fix be moved to strfwd.h which is already included
by docstream.h via docstring.h?)


That was the missing bit, now I understand it. I believe that strfwd.h is
newer than the MSVC fix.


I am tempted to do the proper fix, but since I do not own MSVC, people
would have to bear with me if this breaks compilation temporarily.


Please do it. I am 99% sure that moving these lines

#if defined(_MSC_VER) && (_MSC_VER >= 1600)
// Ugly workaround for MSVC10 STL bug:
// std::numpunct has a hardcoded dllimport in definition, but we wanna it
with 32 bit
// so we can't import it and must define it but then the compiler complains.
#include "support/numpunct_lyx_char_type.h"
#endif

to strfwd.h will work. One could also restrict the MSVC version check to ==
1600 (since the bug is supposed to be fixed in later versions), but I would
not do this part without test.


I'll let Vincent decide whether he wants to make this change.




Re: LyX's master is now uncompilable

2015-10-19 Thread Vincent van Ravesteijn
Op 19 okt. 2015 22:51 schreef "Guillaume Munch" :
>
> Le 19/10/2015 21:34, Georg Baum a écrit :
>>
>>
>> The message on the list is related to commit e948caf6, which is supposed
to
>> fix exactly this issue. What I do not understand it why the fix does not
>> work for your recent changes. Maybe you forgot to include docstream.h
>> somewhere or got the include order wrong?
>
>
> The former. If we are supposed to include support/docstream.h to use
odocstringstream, shouldn't the latter be defined in docstream.h instead of
strfwd.h? (or the fix be moved to strfwd.h which is already included by
docstream.h via docstring.h?)
>
> I am tempted to do the proper fix, but since I do not own MSVC, people
would have to bear with me if this breaks compilation temporarily.
>

If you post the fix to the list here, I will try it tomorrow, and if it
works, I will commit.

Vincent


Re: LyX's master is now uncompilable

2015-10-19 Thread Guillaume Munch

Le 19/10/2015 21:34, Georg Baum a écrit :


The message on the list is related to commit e948caf6, which is supposed to
fix exactly this issue. What I do not understand it why the fix does not
work for your recent changes. Maybe you forgot to include docstream.h
somewhere or got the include order wrong?


The former. If we are supposed to include support/docstream.h to use 
odocstringstream, shouldn't the latter be defined in docstream.h instead 
of strfwd.h? (or the fix be moved to strfwd.h which is already included 
by docstream.h via docstring.h?)


I am tempted to do the proper fix, but since I do not own MSVC, people 
would have to bear with me if this breaks compilation temporarily.




Re: LyX's master is now uncompilable

2015-10-19 Thread Guillaume Munch

Le 19/10/2015 21:59, Vincent van Ravesteijn a écrit :


Op 19 okt. 2015 22:51 schreef "Guillaume Munch" >:
 >
 > Le 19/10/2015 21:34, Georg Baum a écrit :
 >>
 >>
 >> The message on the list is related to commit e948caf6, which is
supposed to
 >> fix exactly this issue. What I do not understand it why the fix does not
 >> work for your recent changes. Maybe you forgot to include docstream.h
 >> somewhere or got the include order wrong?
 >
 >
 > The former. If we are supposed to include support/docstream.h to use
odocstringstream, shouldn't the latter be defined in docstream.h instead
of strfwd.h? (or the fix be moved to strfwd.h which is already included
by docstream.h via docstring.h?)
 >
 > I am tempted to do the proper fix, but since I do not own MSVC,
people would have to bear with me if this breaks compilation temporarily.
 >

If you post the fix to the list here, I will try it tomorrow, and if it
works, I will commit.

Vincent




Thanks
>From 1257cdd84d4ef20740958d49a9d645a94e1b4b7b Mon Sep 17 00:00:00 2001
From: Guillaume Munch 
Date: Mon, 19 Oct 2015 22:10:54 +0100
Subject: [PATCH] msvc: Proper fix for compilation of TexRow

This bug in MSVC 10 was fixed at e948caf6, but the workaround belongs to
strfwd.h.

Thanks Vincent and Georg.
---
 src/TexRow.cpp  |  8 
 src/support/docstream.h |  7 ---
 src/support/strfwd.h| 10 ++
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/TexRow.cpp b/src/TexRow.cpp
index 60a3539..4bec66e 100644
--- a/src/TexRow.cpp
+++ b/src/TexRow.cpp
@@ -466,12 +466,12 @@ std::pair TexRow::rowFromCursor(Cursor const & cur) const
 ///
 docstring TexRow::asString(RowEntry const & entry)
 {
-	std::ostringstream t;
+	odocstringstream os;
 	if (entry.is_math)
-		t << "(1," << entry.math.id << "," << entry.math.cell << ")";
+		os << "(1," << entry.math.id << "," << entry.math.cell << ")";
 	else
-		t << "(0," << entry.text.id << "," << entry.text.pos << ")";
-	return from_utf8( t.str() );
+		os << "(0," << entry.text.id << "," << entry.text.pos << ")";
+	return os.str();
 }
 
 
diff --git a/src/support/docstream.h b/src/support/docstream.h
index 52916b0..108d00e 100644
--- a/src/support/docstream.h
+++ b/src/support/docstream.h
@@ -14,13 +14,6 @@
 
 #include "support/docstring.h"
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1600) 
-// Ugly workaround for MSVC10 STL bug:
-// std::numpunct has a hardcoded dllimport in definition, but we wanna it with 32 bit 
-// so we can't import it and must define it but then the compiler complains.
-#include "support/numpunct_lyx_char_type.h"
-#endif
-
 #include 
 #include 
 
diff --git a/src/support/strfwd.h b/src/support/strfwd.h
index 8419b51..e0aba82 100644
--- a/src/support/strfwd.h
+++ b/src/support/strfwd.h
@@ -61,6 +61,16 @@ typedef basic_ostringstream ostringst
 
 #endif
 
+
+// Ugly workaround for MSVC10 STL bug:
+// std::numpunct has a hardcoded dllimport in definition, but we wanna it with
+// 32 bit so we can't import it and must define it but then the compiler
+// complains.
+#if defined(_MSC_VER) && (_MSC_VER >= 1600) 
+#include "support/numpunct_lyx_char_type.h"
+#endif
+
+
 namespace lyx {
 
 /**
-- 
2.1.4



Re: LyX's master is now uncompilable

2015-10-19 Thread Vincent van Ravesteijn

Op 19-10-2015 om 19:04 schreef Uwe Stöhr:

Am 19.10.2015 um 18:26 schrieb Guillaume Munch:


I fail to see a problem with this commit after reading it again. I would
like to do some trial-and-error but not being able to reproduce makes it
complicated.


It is also not clear to me what triggers the error.


I fixed it at 10d7f6d.

Vincent


Re: LyX's master is now uncompilable

2015-10-19 Thread Uwe Stöhr

Am 19.10.2015 um 21:29 schrieb Vincent van Ravesteijn:


I fixed it at 10d7f6d.


Many thanks Vincent! This fixes the compilation for me.

best regards
Uwe


Re: LyX's master is now uncompilable

2015-10-19 Thread Uwe Stöhr

Am 19.10.2015 um 18:26 schrieb Guillaume Munch:


I fail to see a problem with this commit after reading it again. I would
like to do some trial-and-error but not being able to reproduce makes it
complicated.


It is also not clear to me what triggers the error.


Is that all the information that the compiler gives you?


Unfortunately yes.


Does it not give you the name of the file?


No, what I posted is all I get.

regards Uwe




Re: LyX's master is now uncompilable

2015-10-19 Thread Guillaume Munch

Le 19/10/2015 16:50, Uwe Stöhr a écrit :

Am 19.10.2015 um 16:14 schrieb Uwe Stöhr:


one of todays' commits broke the compilation for me with MSVC:

  C:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\include\xstring(982):
error C2491: 'std::numpunct<_Elem>::id': Definition of static data
member for dllimport is not allowed
[D:\LyXGit\Master\compile-result\src\LyX.vcxproj]


The commit to blame is

http://www.lyx.org/trac/changeset/65d61e7a2786172da95ed9433ed0c49a7398f405/lyxgit


Guillaume?

thanks and regards
Uwe



I fail to see a problem with this commit after reading it again. I would 
like to do some trial-and-error but not being able to reproduce makes it 
complicated.


Is that all the information that the compiler gives you? Does it not
give you the name of the file?

I tried to understand the error message with what comes up on Google and 
I cannot relate it to my code. In addition, one of the first hits on 
Google is about a message on this list 
, 
so it is possible that the bug is elsewhere (while still fixable by 
adapting my code).


I expect something trivial that I have never encountered yet. Anybody 
else sees the problem?



Guillaume