By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.

Bug 916

Summary: Build issue: tdesvn src/CMakeLists.txt hardcoded apr path causes build failure
Product: TDE Reporter: David C. Rankin <trin>
Component: other (any)Assignee: Timothy Pearson <kb9vqf>
Status: RESOLVED FIXED    
Severity: normal CC: bugwatch, darrella
Priority: P5    
Version: R14.0.0 [Trinity]   
Hardware: All   
OS: Linux   
Compiler Version: TDE Version String:
Application Version: Application Name:
Attachments: patch removing hardcoded apr-1.0 path from src/CMakeLists.txt
patch changing hardcoded include for apr from apr-1.0 to apr-1
patch to cmake files to fix ${APR_INCLUDE_DIRS}
added pkg_search_module( APR apr-1 ) which sets APR_INCLUDE_DIRS magically

Description David C. Rankin 2012-03-13 21:41:17 CDT
The path to the apache portable runtime is hardcoded in the tdesvn/src/CMakeLists.txt file which causes builds to fail if the apr includes are installed anywhere other than /usr/include/apr-1.0. Further, the build ignores the CMAKE_INCLUDE_PATH environment variable if set by the packager.

The current code looks like the hardcoded path was simply added to the end of the includes list:

include_directories(
  ${TQT_INCLUDE_DIRS}
  ${TDE_INCLUDE_DIR}
  ${CMAKE_BINARY_DIR}
  ${CMAKE_BINARY_DIR}/src
  ${CMAKE_SOURCE_DIR}/src
  ${CMAKE_SOURCE_DIR}/src/settings
  ${CMAKE_SOURCE_DIR}/src/svnqt
  ${CMAKE_BINARY_DIR}/src/svnqt
  ${CMAKE_SOURCE_DIR}/src/svnfrontend/graphtree
  ${CMAKE_SOURCE_DIR}/src/svnfrontend/fronthelpers
  ${CMAKE_SOURCE_DIR}/src/ksvnwidgets
  ${CMAKE_SOURCE_DIR}/src/helpers
  ${CMAKE_SOURCE_DIR}/src/svnfrontend
  ${CMAKE_SOURCE_DIR}/src/svnqt/cache
  ${SUBVERSION_INCLUDE_DIR}
  /usr/include/apr-1.0
)

There should be some type of check or use of pkgconfig info to set the apr path to avoid this failure.
Comment 1 David C. Rankin 2012-03-14 17:15:16 CDT
Created attachment 493 [details]
patch removing hardcoded apr-1.0 path from src/CMakeLists.txt
Comment 2 David C. Rankin 2012-03-14 17:25:39 CDT
NOTE: tested and the patch failed. Here is the result of the testing:

Serghei,

  I tried that and that did not work??

include_directories(
  ${TQT_INCLUDE_DIRS}
  ${TDE_INCLUDE_DIR}
  ${CMAKE_BINARY_DIR}
  ${CMAKE_BINARY_DIR}/src
  ${CMAKE_SOURCE_DIR}/src
  ${CMAKE_SOURCE_DIR}/src/settings
  ${CMAKE_SOURCE_DIR}/src/svnqt
  ${CMAKE_BINARY_DIR}/src/svnqt
  ${CMAKE_SOURCE_DIR}/src/svnfrontend/graphtree
  ${CMAKE_SOURCE_DIR}/src/svnfrontend/fronthelpers
  ${CMAKE_SOURCE_DIR}/src/ksvnwidgets
  ${CMAKE_SOURCE_DIR}/src/helpers
  ${CMAKE_SOURCE_DIR}/src/svnfrontend
  ${CMAKE_SOURCE_DIR}/src/svnqt/cache
  ${SUBVERSION_INCLUDE_DIR}
  ${APR_INCLUDE_DIRS}
)

 Still results in the error:

[  0%] Building CXX object src/svnqt/CMakeFiles/svnqt.dir/apr.cpp.o
cd /build/src/build/src/svnqt && /usr/bin/c++   -Dsvnqt_EXPORTS -DHAVE_CONFIG_H -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2   -DQT_NO_ASCII_CAST -DQT_CLEAN_NAMESPACE -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -DQT_THREAD_SUPPORT -D_REENTRANT -include tqt.h -fPIC -I/build/src/build/src/svnqt -I/opt/tqt3/include -I/opt/trinity/include/tqt -I/opt/trinity/include -I/build/src/build -I/build/src/build/src -I/build/src/tdesvn/src -I/build/src/tdesvn/src/settings -I/build/src/tdesvn/src/svnqt -I/build/src/tdesvn/src/svnfrontend/graphtree -I/build/src/tdesvn/src/svnfrontend/fronthelpers -I/build/src/tdesvn/src/ksvnwidgets -I/build/src/tdesvn/src/helpers -I/build/src/tdesvn/src/svnfrontend -I/build/src/tdesvn/src/svnqt/cache -I/usr/include/subversion-1 -I/build/src/tdesvn/src/svnqt/SQLITE_INCLUDE_DIR    -fPIC -o CMakeFiles/svnqt.dir/apr.cpp.o -c /build/src/tdesvn/src/svnqt/apr.cpp
/build/src/tdesvn/src/svnqt/apr.cpp:32:25: fatal error: apr_general.h: No such file or directory
compilation terminated.
make[2]: *** [src/svnqt/CMakeFiles/svnqt.dir/apr.cpp.o] Error 1
make[2]: Leaving directory `/build/src/build'
make[1]: *** [src/svnqt/CMakeFiles/svnqt.dir/all] Error 2
make[1]: Leaving directory `/build/src/build'
make: *** [all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
==> ERROR: Build failed, check /mnt/nv1/home/chroot/david/build

  If I just patch with the directory it works fine:

include_directories(
  ${TQT_INCLUDE_DIRS}
  ${TDE_INCLUDE_DIR}
  ${CMAKE_BINARY_DIR}
  ${CMAKE_BINARY_DIR}/src
  ${CMAKE_SOURCE_DIR}/src
  ${CMAKE_SOURCE_DIR}/src/settings
  ${CMAKE_SOURCE_DIR}/src/svnqt
  ${CMAKE_BINARY_DIR}/src/svnqt
  ${CMAKE_SOURCE_DIR}/src/svnfrontend/graphtree
  ${CMAKE_SOURCE_DIR}/src/svnfrontend/fronthelpers
  ${CMAKE_SOURCE_DIR}/src/ksvnwidgets
  ${CMAKE_SOURCE_DIR}/src/helpers
  ${CMAKE_SOURCE_DIR}/src/svnfrontend
  ${CMAKE_SOURCE_DIR}/src/svnqt/cache
  ${SUBVERSION_INCLUDE_DIR}
  /usr/include/apr-1
)

  There is something wrong with the logic behind ${APR_INCLUDE_DIRS} which is probably why it got hardcoded to begin with?? ${APR_INCLUDE_DIRS} isn't providing anything. Does it need more cmake code somewhere in the cmake dir?
Comment 3 David C. Rankin 2012-03-14 17:35:51 CDT
Created attachment 494 [details]
patch changing hardcoded include for apr from apr-1.0 to apr-1

For some reason setting ${APR_INCLUDE_DIRS} doesn't include the information from pkg-config:

17:31 nirvana:~/tde/tmp/tdesvn> pkg-config --variable=includedir apr-1
/usr/include/apr-1

Setting src/CMakeLists.txt using the patch hardcoding the dir seems to be the only thing that works. This points to a problem with the cmake code that is setting ${APR_INCLUDE_DIRS}. This patch is an example of how I got it to work. The original patch including ${APR_INCLUDE_DIRS} is what should be done, but the cmake code that sets ${APR_INCLUDE_DIRS} will need fixing first.
Comment 4 David C. Rankin 2012-03-14 18:01:16 CDT
I can't figure out what is going on. When I set src/CMakeLists.txt:

include_directories(
<snip>
  ${SUBVERSION_INCLUDE_DIR}
  ${APR_INCLUDE_DIRS}
)

The CMakeCache.txt information is exactly the same as when I hardcode 

include_directories(
<snip>
  ${SUBVERSION_INCLUDE_DIR}
  /usr/include/apr-1
)

APR_CONFIG:FILEPATH=/usr/bin/apr-1-config
svnqt_LIB_DEPENDS:STATIC=general;tqt;general;tqt-mt;general;/usr/lib/libsvn_client-1.so;general;/usr/lib/libsvn_diff-1.so;general;/usr/lib/libsvn_fs-1.so;general;/usr/lib/libsvn_ra-1.so;general;/usr/lib/libsvn_repos-1.so;general;/usr/lib/libsvn_subr-1.so;general;/usr/lib/libsvn_wc-1.so;general;-luuid -lrt -lcrypt  -lpthread -ldl -L/usr/lib -lapr-1 -L/usr/lib -lldap -llber -llber -ldb  -lgdbm  -lexpat -L/usr/lib -laprutil-1;general;/usr/lib/libsqlite3.so;
APR_CPP_FLAGS:INTERNAL=-D_REENTRANT -D_GNU_SOURCE
APR_EXTRA_LIBFLAGS:INTERNAL=-luuid -lrt -lcrypt  -lpthread -ldl -L/usr/lib -lapr-1
APR_INCLUDE_DIR:INTERNAL=/usr/include/apr-1
APU_CPP_FLAGS:INTERNAL=-I/usr/include/apr-1 -I/usr/include
APU_EXTRA_LIBFLAGS:INTERNAL=-L/usr/lib -lldap -llber -llber -ldb  -lgdbm  -lexpat -L/usr/lib -laprutil-1
APU_INCLUDE_DIR:INTERNAL=/usr/include/apr-1

  However, if I use ${APR_INCLUDE_DIRS}, the build fails with:

[  0%] Building CXX object src/svnqt/CMakeFiles/svnqt.dir/apr.cpp.o
cd /build/src/build/src/svnqt && /usr/bin/c++   -Dsvnqt_EXPORTS -DHAVE_CONFIG_H -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2   -DQT_NO_ASCII_CAST -DQT_CLEAN_NAMESPACE -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -DQT_THREAD_SUPPORT -D_REENTRANT -include tqt.h -fPIC -I/build/src/build/src/svnqt -I/opt/tqt3/include -I/opt/trinity/include/tqt -I/opt/trinity/include -I/build/src/build -I/build/src/build/src -I/build/src/tdesvn/src -I/build/src/tdesvn/src/settings -I/build/src/tdesvn/src/svnqt -I/build/src/tdesvn/src/svnfrontend/graphtree -I/build/src/tdesvn/src/svnfrontend/fronthelpers -I/build/src/tdesvn/src/ksvnwidgets -I/build/src/tdesvn/src/helpers -I/build/src/tdesvn/src/svnfrontend -I/build/src/tdesvn/src/svnqt/cache -I/usr/include/subversion-1 -I/build/src/tdesvn/src/svnqt/SQLITE_INCLUDE_DIR    -fPIC -o CMakeFiles/svnqt.dir/apr.cpp.o -c /build/src/tdesvn/src/svnqt/apr.cpp
/build/src/tdesvn/src/svnqt/apr.cpp:32:25: fatal error: apr_general.h: No such file or directory
compilation terminated.

  hardcoded, I get:

[  0%] Building CXX object src/svnqt/CMakeFiles/svnqt.dir/apr.cpp.o
cd /build/src/build/src/svnqt && /usr/bin/c++   -Dsvnqt_EXPORTS -DHAVE_CONFIG_H -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2   -DQT_NO_ASCII_CAST -DQT_CLEAN_NAMESPACE -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -DQT_THREAD_SUPPORT -D_REENTRANT -include tqt.h -fPIC -I/build/src/build/src/svnqt -I/opt/tqt3/include -I/opt/trinity/include/tqt -I/opt/trinity/include -I/build/src/build -I/build/src/build/src -I/build/src/tdesvn/src -I/build/src/tdesvn/src/settings -I/build/src/tdesvn/src/svnqt -I/build/src/tdesvn/src/svnfrontend/graphtree -I/build/src/tdesvn/src/svnfrontend/fronthelpers -I/build/src/tdesvn/src/ksvnwidgets -I/build/src/tdesvn/src/helpers -I/build/src/tdesvn/src/svnfrontend -I/build/src/tdesvn/src/svnqt/cache -I/usr/include/subversion-1 -I/usr/include/apr-1 -I/build/src/tdesvn/src/svnqt/SQLITE_INCLUDE_DIR    -fPIC -o

  So the ${APR_INCLUDE_DIRS} variable is FUBAR....
Comment 5 David C. Rankin 2012-03-14 18:28:12 CDT
Created attachment 495 [details]
patch to cmake files to fix ${APR_INCLUDE_DIRS}

The whole problem was ${APR_INCLUDE_DIRS} was never being set from ${APR_INCLUDE_DIR_INT}. This patch removes the hardcoded apr path and adds:

SET(APR_INCLUDE_DIRS ${APR_INCLUDE_DIR_INT})

to ConfigureChecks.cmake
Comment 6 David C. Rankin 2012-03-14 18:51:29 CDT
Created attachment 496 [details]
added pkg_search_module( APR apr-1 ) which sets APR_INCLUDE_DIRS magically

This should be final form of patch - Serghei will have to determine where he wants the information located in ConfigureChecks.cmake.
Comment 7 Darrell 2012-03-16 16:22:22 CDT
tdesdk has APR checks that can be used a template.
Comment 8 Darrell 2012-04-20 22:58:24 CDT
Patch tested in Arch and Slackware.

Patch merged upstream in GIT hash 220261c9.

Resolved.

Thank you for the patch!