Opened 12 years ago

Closed 11 years ago

#556 closed defect (wontfix)

Build error using cmake: ../geos_svn_revision.h: No such file or directory

Reported by: dburken Owned by: mloskot
Priority: major Milestone: 3.4.0
Component: Build/Install (cmake) Version: main
Severity: Unassigned Keywords: cmake
Cc:

Description

The cmake build is not auto-generating geos_svn_revision.h so you get error:

[ 83%] Building CXX object capi/CMakeFiles/geos_c.dir/geos_ts_c.cpp.o
/work/osgeo/geos/geos-svn/capi/geos_ts_c.cpp:96:34: fatal error: ../geos_svn_revision.h: No such file or directory 

Potential fix would be to change CMakeLists.txt to call existing:

sh tools/svn_repo_revision.sh geos_svn_revision.h

Or use cmake macro to generate file. Example of pulling revision in cmake:

This will initialize ${Project_WC_REVISION}:

#################################################################################
#  MACRO: GET_SVN_REVISION
#
#  DESCRIPTION:
#      MACRO FOR GETTING THE SVN revision for this build
#################################################################################
MACRO (GET_SVN_REVISION)
   FIND_PACKAGE(Subversion)
   IF(SUBVERSION_FOUND)
      Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
      MESSAGE("Current revision is ${Project_WC_REVISION}")
      Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
      MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
   ENDIF()
ENDMACRO(GET_SVN_REVISION)

Change History (9)

comment:1 by strk, 12 years ago

Component: DefaultBuild/Install (cmake)
Owner: changed from geos-devel@… to mloskot

I shall note that calling our own shell script will work for both SVN and GIT.

comment:2 by mloskot, 12 years ago

Keywords: cmake added

The current solution based on custom shell script has limited portability and I'd suggest to rework it a bit. We already have version.h.in file, so there is no need to generate yet another header.

So, the svn_repo_revision.sh should be called by ./configure and only output SVN revision string. This string should be substituted by regular AC_SUBST. (There must be Autoconf macro available, so no custom made scripts should be required (see also Get the Subversion Revision Number into Autoconf's PACKAGE_VERSION).

CMake can use its own means to get SVN (as well as Git) revision numbers and then generate version.h, similarly to ./configure.

comment:3 by mloskot, 12 years ago

Version: 3.3.4svn-trunk

Temporarily, until the issue is fixed, generate the missing header manually:

$ cd /path/to/geos/trunk
$ ./tools/svn_repo_revision.sh 
#define GEOS_SVN_REVISION 3680
Wrote rev '3680' in file './geos_svn_revision.h'

Then use CMake:

$ mkdir ../build
$ cd ../build
$ cmake ../trunk

and everything should work well.

comment:4 by strk, 12 years ago

We want the revision file to be generated/checked on every "make" invocation to avoid having to ./configure again on each and every working copy update. What would make ./configure more portable than ./svn_repo_revision.sh ? They are both shell scripts...

comment:5 by strk, 12 years ago

Milestone: 3.3.53.4.0

in reply to:  4 comment:6 by mloskot, 12 years ago

Replying to strk:

We want the revision file to be generated/checked on every "make" invocation to avoid having to ./configure again on each and every working copy update.

Then make it explicit and documented as separate step of bootstrapping, similar to ./autogen.sh

Autotools' purpose is to generate configuration files and headers. Make takes all ingredients and bakes the binaries. Simply, I'd suggest to avoid making the whole process unnecessarily obscure.

What would make ./configure more portable than ./svn_repo_revision.sh ? They are both shell scripts...

There are different shells. Autotools require M4sh, as per the Autoconf man. Also, non-POSIX systems do not have it.

comment:7 by mloskot, 11 years ago

Resolution: fixed
Status: newclosed

Quoting strk from #576:

The official build system is the automake one. Please only file tickets against cmake if willing to provide a patch (sorry).

comment:8 by mloskot, 11 years ago

Resolution: fixed
Status: closedreopened

comment:9 by mloskot, 11 years ago

Resolution: wontfix
Status: reopenedclosed
Note: See TracTickets for help on using tickets.