Bug 40905 - DBUS_VERSION_STRING not defined (on Windows with CMake/MSVC)
Summary: DBUS_VERSION_STRING not defined (on Windows with CMake/MSVC)
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: 1.4.x
Hardware: All All
: medium normal
Assignee: Ralf Habacker
QA Contact: John (J5) Palmieri
URL:
Whiteboard: review+
Keywords: patch
Depends on:
Blocks: 41033
  Show dependency treegraph
 
Reported: 2011-09-15 02:39 UTC by rony
Modified: 2011-09-20 10:40 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
cmake fix: install version string (1.15 KB, patch)
2011-09-19 23:56 UTC, Ralf Habacker
Details | Splinter Review

Description rony 2011-09-15 02:39:08 UTC
Unlike the Linux and MacOSX versions, DBUS_VERSION_STRING is not defined on the Windows version.
Comment 1 Simon McVittie 2011-09-16 03:43:24 UTC
How are you building D-Bus on each platform you mention? This might be a bug in the CMake build-system, rather than in the Windows port as such.
Comment 2 rony 2011-09-17 04:44:34 UTC
The Windows version was built with cmake using the MS compiler set. Is there anything I can upload that would help you? If so, please advise.
Comment 3 Ralf Habacker 2011-09-19 08:22:20 UTC
cmake fetches version numbers from <source-root>/configure.ac by using the following code (from cmake/CMakeLists.txt): 


#########################################################################
# detect version
#########################################################################
file (READ ../configure.ac configure_ac)
string (REGEX REPLACE ".*dbus_major_version], .([0-9]+).*" "\\1" DBUS_MAJOR_VERSION ${configure_ac})
string (REGEX REPLACE ".*dbus_minor_version], .([0-9]+).*" "\\1" DBUS_MINOR_VERSION ${configure_ac})
string (REGEX REPLACE ".*dbus_micro_version], .([0-9]+).*" "\\1" DBUS_MICRO_VERSION ${configure_ac})
# used by file version info
set (DBUS_PATCH_VERSION "0")
set (DBUS_VERSION ${DBUS_MAJOR_VERSION}.${DBUS_MINOR_VERSION}.${DBUS_MICRO_VERSION})

set (DBUS_VERSION_STRING "${DBUS_VERSION}")
.... 

The resulting DBUS_VERSION_STRING define is placed into <build-root>\config.h as shown below: 

...

/* Version number of package */
#define DBUS_MAJOR_VERSION 1
#define DBUS_MINOR_VERSION 5
#define DBUS_MICRO_VERSION 7
#define DBUS_VERSION ((1 << 16) | (5 << 8) | (7))
#define DBUS_VERSION_STRING "1.5.7"
/* #undef DBUS_ENABLE_STATS */

The only possible error case could be that the sources do not contain configure.ac, which is not supported 


BTW: A fresh compile with git master using vc90 and cmake 2.8.3 do not show any problems.
Comment 4 Ralf Habacker 2011-09-19 08:22:41 UTC
cmake fetches version numbers from <source-root>/configure.ac by using the following code (from cmake/CMakeLists.txt): 


#########################################################################
# detect version
#########################################################################
file (READ ../configure.ac configure_ac)
string (REGEX REPLACE ".*dbus_major_version], .([0-9]+).*" "\\1" DBUS_MAJOR_VERSION ${configure_ac})
string (REGEX REPLACE ".*dbus_minor_version], .([0-9]+).*" "\\1" DBUS_MINOR_VERSION ${configure_ac})
string (REGEX REPLACE ".*dbus_micro_version], .([0-9]+).*" "\\1" DBUS_MICRO_VERSION ${configure_ac})
# used by file version info
set (DBUS_PATCH_VERSION "0")
set (DBUS_VERSION ${DBUS_MAJOR_VERSION}.${DBUS_MINOR_VERSION}.${DBUS_MICRO_VERSION})

set (DBUS_VERSION_STRING "${DBUS_VERSION}")
.... 

The resulting DBUS_VERSION_STRING define is placed into <build-root>\config.h as shown below: 

...

/* Version number of package */
#define DBUS_MAJOR_VERSION 1
#define DBUS_MINOR_VERSION 5
#define DBUS_MICRO_VERSION 7
#define DBUS_VERSION ((1 << 16) | (5 << 8) | (7))
#define DBUS_VERSION_STRING "1.5.7"
/* #undef DBUS_ENABLE_STATS */

The only possible error case could be that the sources do not contain configure.ac, which is not supported 


BTW: A fresh compile with git master using vc90 and cmake 2.8.3 do not show any problems.
Comment 5 rony 2011-09-19 12:48:20 UTC
Ralf,

your comments are correct.

*However*, config.h is not included when building an application that wishes to include the version of D-Bus as available at compile time (referring to the DBUS_VERSION_STRING definition). 

For D-Bus applications the installed D-Bus include files get used and in those, there is no DBUS_VERSION_STRING defined. Here the list of include files that got installed after successfully building D-Bus for 32-bit Windows on XP in the target-dir "%ProgramFiles%\dbus\dbus\include" (after running "nmake install"):

------------------ cut here ---------------------
19.09.2011  17:25             2.135 dbus-address.h
19.09.2011  20:51             1.775 dbus-arch-deps.h
19.09.2011  17:25             3.472 dbus-bus.h
19.09.2011  17:25            25.953 dbus-connection.h
19.09.2011  17:25             2.886 dbus-errors.h
19.09.2011  17:25             4.881 dbus-macros.h
19.09.2011  17:25             1.975 dbus-memory.h
19.09.2011  17:25            13.049 dbus-message.h
19.09.2011  17:25             1.609 dbus-misc.h
19.09.2011  17:25             3.124 dbus-pending-call.h
19.09.2011  17:25            23.178 dbus-protocol.h
19.09.2011  17:25             4.794 dbus-server.h
19.09.2011  17:25             5.135 dbus-shared.h
19.09.2011  17:25             3.049 dbus-signature.h
19.09.2011  17:25             9.004 dbus-threads.h
19.09.2011  17:25             3.635 dbus-types.h
19.09.2011  17:25             3.925 dbus.h
------------------ cut here ---------------------

It seems that except of "dbus-arch-deps.h" all include files stem from the git master and remained unchanged.

Upon further investigation (and comparing with the Linux builds) the Windows version of "dbus-arch-deps.h" is missing the definition of "DBUS_VERSION_STRING", hence it cannot be picked up on Windows at compile time.

---

Cf. <source-root>/dbus-arch-deps.h.in:

  dbus-arch-deps.h.in:#define DBUS_VERSION_STRING "@DBUS_VERSION@"


(On Linux "dbus-arch-deps.h" contains the line
  dbus-arch-deps.h:#define DBUS_VERSION_STRING "1.5.7")
Comment 6 Ralf Habacker 2011-09-19 22:57:55 UTC
(In reply to comment #5)

> Upon further investigation (and comparing with the Linux builds) the Windows
> version of "dbus-arch-deps.h" is missing the definition of
> "DBUS_VERSION_STRING", hence it cannot be picked up on Windows at compile time.

Then this is an installation problem - i will take a look into.
Comment 7 Ralf Habacker 2011-09-19 23:56:15 UTC
Created attachment 51386 [details] [review]
cmake fix: install version string

The appended patch should fix the issue
Comment 8 Simon McVittie 2011-09-20 04:05:57 UTC
(In reply to comment #7)
> Created an attachment (id=51386)
> cmake fix: install version string
> 
> The appended patch should fix the issue

Looks right, please commit (to dbus-1.4 and merge to master). This is in fact not Windows-specific: it's an equally valid bug when using CMake on Unix.

It'd be good to get rid of the other divergence between dbus/dbus-arch-deps.h.in and cmake/dbus/dbus-arch-deps.h.cmake, which are remarkably similar; ideally, both build systems could work from dbus/dbus-arch-deps.h.in by using the same @THING@ substitutions. I'll open a bug for that.
Comment 9 Ralf Habacker 2011-09-20 10:40:11 UTC
commited and bug closed


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.