Troubles with ExternalProject_Add and PATCH_COMMAND

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Troubles with ExternalProject_Add and PATCH_COMMAND

Steven Truppe

Hi everyone,

i try to patch a file from an externalprojects with the PATCH_COMMAND.

The patch file looks like:

--- project-config.jam    2019-07-18 17:21:44.008695808 +0200
+++ project-config.jam.tmp    2019-07-18 17:23:28.236474532 +0200
@@ -18,7 +18,7 @@
 import python ;
 if ! [ python.configured ]
 {
-    using python : 2.7 : /usr ;
+    using python : 3.7 : /usr ;
 }
 
 path-constant ICU_PATH : /usr ;

When i try to apply the patch manualy with patch originalfile < patchfile it's working, but when i try it with the externalproject_add command:

if(WITH_LIB_BOOST)
    message(STATUS "Build WITH_LIB_BOOST.")

    set(LIB_BOOST_INC_PATH ${OUTPUT_PATH}/libs/boost/include/)
    set(LIB_BOOST_LIB_PATH ${OUTPUT_PATH}/libs/boost/lib)
    set(LIB_BOOST_DEPS external_boost)
    set(LIB_BOOST_STATIC_LIBS boost_python27)
 
    ExternalProject_Add(external_boost
        PREFIX ${CMAKE_BINARY_DIR}/boost
        URL ${BOOST_URL}
        DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/boost
        URL_HASH MD5=${BOOST_HASH}
        PATCH_COMMAND /usr/bin/patch ${CMAKE_BINARY_DIR}/boost/src/external_boost/project-config.jam < ${CMAKE_SOURCE_DIR}/tools/patches/boost_python3.7.patch
        CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ &&
                        ./bootstrap.sh --prefix=${OUTPUT_PATH}/libs/boost/ --with-libraries=python
        BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ &&
                      ./b2
        INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ && ./bjam && ./bjam install
        INSTALL_DIR ${OUTPUT_PATH}/boost
    )

endif()

But when running cmake i get the following output:

patching file /home/stuv/projects/programming/bsEdit/build/boost/src/external_boost/project-config.jam
Hunk #1 FAILED at 18.


I have no idea what i'm doing wrong here, i hope someone here can help me out.


best regards,

Steven Truppe





--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: [DKIM: Failed] Troubles with ExternalProject_Add and PATCH_COMMAND

Marcel Loose
Hi Steven,

When you run patch manually, do you then supply the same absolute paths? Looking at the patch file I noticed that it contains a relative path. So maybe you should cd to ${CMAKE_BINARY_DIR}/boost/src/external_boost/project-config.jam before running the patch command.

Cheers,
Marcel.

Op 18-07-19 om 17:29 schreef Steven Truppe:

Hi everyone,

i try to patch a file from an externalprojects with the PATCH_COMMAND.

The patch file looks like:

--- project-config.jam    2019-07-18 17:21:44.008695808 +0200
+++ project-config.jam.tmp    2019-07-18 17:23:28.236474532 +0200
@@ -18,7 +18,7 @@
 import python ;
 if ! [ python.configured ]
 {
-    using python : 2.7 : /usr ;
+    using python : 3.7 : /usr ;
 }
 
 path-constant ICU_PATH : /usr ;

When i try to apply the patch manualy with patch originalfile < patchfile it's working, but when i try it with the externalproject_add command:

if(WITH_LIB_BOOST)
    message(STATUS "Build WITH_LIB_BOOST.")

    set(LIB_BOOST_INC_PATH ${OUTPUT_PATH}/libs/boost/include/)
    set(LIB_BOOST_LIB_PATH ${OUTPUT_PATH}/libs/boost/lib)
    set(LIB_BOOST_DEPS external_boost)
    set(LIB_BOOST_STATIC_LIBS boost_python27)
 
    ExternalProject_Add(external_boost
        PREFIX ${CMAKE_BINARY_DIR}/boost
        URL ${BOOST_URL}
        DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/boost
        URL_HASH MD5=${BOOST_HASH}
        PATCH_COMMAND /usr/bin/patch ${CMAKE_BINARY_DIR}/boost/src/external_boost/project-config.jam < ${CMAKE_SOURCE_DIR}/tools/patches/boost_python3.7.patch
        CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ &&
                        ./bootstrap.sh --prefix=${OUTPUT_PATH}/libs/boost/ --with-libraries=python
        BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ &&
                      ./b2
        INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ && ./bjam && ./bjam install
        INSTALL_DIR ${OUTPUT_PATH}/boost
    )

endif()

But when running cmake i get the following output:

patching file /home/stuv/projects/programming/bsEdit/build/boost/src/external_boost/project-config.jam
Hunk #1 FAILED at 18.


I have no idea what i'm doing wrong here, i hope someone here can help me out.


best regards,

Steven Truppe







--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake