Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I managed to "fix" this (more like a hack really) by combining a couple of stackoverflow answers.

The issue I was having when following the building procedure you describe was related to "jmemansi.o" not being found. Following this tip fixed that issue.

Filtering out jmemansi.o from the linker input in modules/world/CMakeLists.txt:84:

Add ocv_list_filterout(objlist jmemansi) # <<= dirty fix

macro(ios_include_3party_libs)
  foreach(l ${ARGN})
    add_dependencies(${the_module} ${l})
    string(REGEX REPLACE "<MODULE_NAME>" "${l}" objpath1 "${CMAKE_BINARY_DIR}/3rdparty/${l}/${objpath0}")
    file(GLOB sources ${CMAKE_SOURCE_DIR}/3rdparty/${l}/*.c)
    foreach(srcname ${sources})
      if(IS_ABSOLUTE "${srcname}")
        file(RELATIVE_PATH srcname "${CMAKE_SOURCE_DIR}/3rdparty/${l}" "${srcname}")
      endif()

      string(REPLACE ".." "__" srcname "${srcname}")
      get_filename_component(srcname_we ${srcname} NAME_WE)
      string(REGEX REPLACE <SRC_NAME_WE> "${srcname_we}" objpath2 "${objpath1}")
      string(REGEX REPLACE <RELATIVE_SRC_NAME> "${srcname}" objpath3 "${objpath2}")

      list(APPEND objlist "\"${objpath3}\"")
    endforeach() # (srcname ${sources})
  endforeach()
  ocv_list_filterout(objlist jmemansi) # <<= dirty fix
endmacro()

The next issue I had was related to zlib:

implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration] if (close(state->fd) == -1)

I fixed this with this answer:

Add -Wno-implicit-function-declaration to your C_FLAGS ... this can be added to build_framework.py in the cmakeargs list as -DCMAKE_C_FLAGS=\"-Wno-implicit-function-declaration\"

cmakeargs = ("-GXcode " +
        "-DCMAKE_BUILD_TYPE=Release " +
        "-DCMAKE_C_FLAGS=\"-Wno-implicit-function-declaration\" " +
        "-DCMAKE_TOOLCHAIN_FILE=%s/platforms/ios/cmake/Toolchains/Toolchain-%s_Xcode.cmake " +
        "-DBUILD_opencv_world=ON " +
        "-DCMAKE_INSTALL_PREFIX=install") % (srcroot, target)

After those 2 dirty hacks everything built properly! Hope this helps, good luck!

(for reference: I built it on osx 10.9 on with xcode 5 command line tools)

I managed to "fix" this (more like a hack really) by combining a couple of stackoverflow answers.

The issue I was having when following the building procedure you describe was related to "jmemansi.o" not being found. Following this tip fixed that issue.

Filtering out jmemansi.o from the linker input in modules/world/CMakeLists.txt:84:

Add ocv_list_filterout(objlist jmemansi) # <<= dirty fix

macro(ios_include_3party_libs)
  foreach(l ${ARGN})
    add_dependencies(${the_module} ${l})
    string(REGEX REPLACE "<MODULE_NAME>" "${l}" objpath1 "${CMAKE_BINARY_DIR}/3rdparty/${l}/${objpath0}")
    file(GLOB sources ${CMAKE_SOURCE_DIR}/3rdparty/${l}/*.c)
    foreach(srcname ${sources})
      if(IS_ABSOLUTE "${srcname}")
        file(RELATIVE_PATH srcname "${CMAKE_SOURCE_DIR}/3rdparty/${l}" "${srcname}")
      endif()

      string(REPLACE ".." "__" srcname "${srcname}")
      get_filename_component(srcname_we ${srcname} NAME_WE)
      string(REGEX REPLACE <SRC_NAME_WE> "${srcname_we}" objpath2 "${objpath1}")
      string(REGEX REPLACE <RELATIVE_SRC_NAME> "${srcname}" objpath3 "${objpath2}")

      list(APPEND objlist "\"${objpath3}\"")
    endforeach() # (srcname ${sources})
  endforeach()
  ocv_list_filterout(objlist jmemansi) # <<= dirty fix
endmacro()

The next issue I had was related to zlib:

implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration] if (close(state->fd) == -1)

I fixed this with this answer:

Add -Wno-implicit-function-declaration to your C_FLAGS ... this can be added to build_framework.py in the cmakeargs list as -DCMAKE_C_FLAGS=\"-Wno-implicit-function-declaration\"

cmakeargs = ("-GXcode " +
        "-DCMAKE_BUILD_TYPE=Release " +
        "-DCMAKE_C_FLAGS=\"-Wno-implicit-function-declaration\" " +
        "-DCMAKE_TOOLCHAIN_FILE=%s/platforms/ios/cmake/Toolchains/Toolchain-%s_Xcode.cmake " +
        "-DBUILD_opencv_world=ON " +
        "-DCMAKE_INSTALL_PREFIX=install") % (srcroot, target)

After those 2 dirty hacks everything built properly! Hope this helps, good luck!

(for reference: I built it on osx 10.9 on with xcode 5 command line tools)

tools) btw: most tests all seem to fail, but it works anyway, no clue why that's happening.