Summary: | Fix builds with Visual Studio 2013 | ||
---|---|---|---|
Product: | poppler | Reporter: | Tamas Szekeres <szekerest> |
Component: | general | Assignee: | poppler-bugs <poppler-bugs> |
Status: | RESOLVED INVALID | QA Contact: | |
Severity: | critical | ||
Priority: | medium | CC: | cristeab, lztoad |
Version: | unspecified | ||
Hardware: | Other | ||
OS: | Windows (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
Patch to fix build
Patch for fix |
Description
Tamas Szekeres
2015-01-16 22:01:48 UTC
Can you attach the patch you need? Created attachment 112366 [details] [review] Patch to fix build Bogdan, you added the fmax defines, can you comment? > -#if defined(_MSC_VER) > -#define fmax(a, b) std::max(a, b) > -#define fmin(a, b) std::min(a, b) > -#endif fmax was added in Visual Studio 2012 http://msdn.microsoft.com/en-us/library/hh308439%28v=vs.110%29.aspx so we would need to keep this when MSC_VER < 1700. Created attachment 112382 [details] [review] Patch for fix Yes, you can keep that section for the older compilers. Modified patch added. > -#if defined(_MSC_VER) > +#if defined(_MSC_VER) && (_MSC_VER <= 1700) According to http://stackoverflow.com/questions/70013/how-to-detect-if-im-compiling-code-with-visual-studio-2008 1700 is Visual Studio 2012. According to http://msdn.microsoft.com/en-us/library/hh308439%28v=vs.110%29.aspx fmax is available in 2012 and 2013. Should that _MSC_VER check be for < 1700? (In reply to Adrian Johnson from comment #6) > > -#if defined(_MSC_VER) > > +#if defined(_MSC_VER) && (_MSC_VER <= 1700) > > According to > > http://stackoverflow.com/questions/70013/how-to-detect-if-im-compiling-code- > with-visual-studio-2008 > > 1700 is Visual Studio 2012. > > According to > > http://msdn.microsoft.com/en-us/library/hh308439%28v=vs.110%29.aspx > > fmax is available in 2012 and 2013. Should that _MSC_VER check be for < 1700? That might be working, though it would require to modify further files (in which fmax and fmin are used) by including the appropriate header to be able to compile with VS2012. I was able to build it with CMake+VC 2013. In short use CMake, compile freetype first (it has vc 2010 projects that are fine with vc 2013) and see my bugs, the ids are: 91188 91060 91057 91055 91053 I only needed the main poppler project, but had some qt5 projects and other successfully built too. Command line for CMake is like cmake -G "Visual Studio 12 2013" . -DFREETYPE_LIBRARY=..\freetype-2.6\objs\vc2010\Win32 -DFREETYPE_INCLUDE_DIRS=..\freetype-2.6\include -DENABLE_CPP=OFF -DBUILD_CPP_TESTS=OFF -DBUILD_GTK_TESTS=OFF -DBUILD_QT4_TESTS=OFF -DBUILD_QT5_TESTS=OFF -DENABLE_UTILS=OFF -DUSE_FIXEDPOINT=OFF -DUSE_FLOAT=ON -DICONV_LIBRARIES=OFF But you can use the CMake gui, just provide freetype libs and headers folders (you can skip other or build with it as you like). PS: The std::min/max thing is https://bugs.freedesktop.org/show_bug.cgi?id=91060 I've just added the header globally, and that is not good, so you can fix it appropriately (#include <algorithm> in all the needed files). And add a patch, you can use WinMerge to create it, use unified patch. I'm actually yet to lazy to include it everywhere) I've commited the <algorithm> changes please agree on wheter the
> -#if defined(_MSC_VER)
> +#if defined(_MSC_VER) && (_MSC_VER <= 1700)
is needed or not
Just a heads up: the lack of: #include <algorithm> caused my attempt to compile poppler for the Scribus-libs project using MS Visual Studio 2013 Express. I referenced this bug therein: See https://bugs.scribus.net/view.php?id=13788#c39006 I'm afraid I know so little about the MS Development system, just enough to accomplish the task of building Scribus. The "#include <algorithm>" part of this patch was already committed. Are you saying that it needs to be #included in more places? Are you able to provide a patch? Here's the patch I created *FOR USE WITH THE SCRIBUS-LIB* project only: --- librevenge-0.0.3/src/lib/RVNGTextTextGenerator.cpp Sat Aug 29 22:03:12 2015 +++ librevenge-0.0.3/src/lib/RVNGTextTextGenerator.cpp Thu Mar 03 21:17:29 2016 @@ -19,7 +19,6 @@ */ #include <sstream> - #include <librevenge-generators/librevenge-generators.h> // use the BELL code to represent a TAB for now @@ -123,7 +122,7 @@ if (!m_impl->m_endnotes.str().empty()) { *m_impl->m_stream << '\n'; - *m_impl->m_stream << m_impl->m_endnotes; + *m_impl->m_stream << m_impl->m_endnotes.str(); } m_impl->m_document=m_impl->m_stream->str().c_str(); } --- librevenge-0.0.3/src/lib/RVNGZipStream.cpp Wed Dec 23 10:50:32 2015 +++ librevenge-0.0.3/src/lib/RVNGZipStream.cpp Thu Mar 03 20:36:53 2016 @@ -21,6 +21,7 @@ #include <string> #include <string.h> #include <stdio.h> +#include <algorithm> #include <utility> #include <zlib.h> --- poppler-0.39.0/poppler/PSOutputDev.cc Wed Dec 16 14:58:32 2015 +++ poppler-0.39.0/poppler/PSOutputDev.cc Thu Mar 03 20:36:33 2016 @@ -41,11 +41,11 @@ #ifdef USE_GCC_PRAGMAS #pragma implementation #endif - #include <stdio.h> #include <stddef.h> #include <stdarg.h> #include <signal.h> +#include <algorithm> #include <math.h> #include <limits.h> #include "goo/GooString.h" --- poppler-0.39.0/poppler/TextOutputDev.cc Sun Nov 15 13:05:22 2015 +++ poppler-0.39.0/poppler/TextOutputDev.cc Thu Mar 03 20:37:04 2016 @@ -50,6 +50,7 @@ #include <stdio.h> #include <stdlib.h> #include <stddef.h> +#include <algorithm> #include <math.h> #include <float.h> #include <ctype.h> I don't know if this helps our not, but here's the version information from my workbench installed January 2016: https://msdn.microsoft.com/en-us/library/b0084kay.aspx instructs: Type cl /? at the command line to view the compiler's version number. Start->All Programs->Visual Studio 2013->Visual Studio Tools opens Explorer to the directory: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts Note: I installed MS Visual Studio 2013 on 1/26/2016 and that is the date of the shortcut named "Developer Command Prompt for VS2013" So it appears that the installation of MS Visual Studio 2013 includes directories with the name Visual Studio 2012. Clicked: Developer Command Prompt for VS2013 C:\Program Files (x86)\Microsoft Visual Studio 12.0>cl /? Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86 Copyright (C) Microsoft Corporation. All rights reserved. ... (In reply to John L. Poole from comment #12) Please provide a patch against the current version of poppler git not for an old version. no answer -> invalid |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.