Cmake's find_package(LibXml2) does not properly include /usr/local/include and it should because one of the header files depends on iconv.h which lives in /usr/local/include. SDL also depends on iconv.h and /usr/share/cmake/Modules/FindSDL.cmake contains the following lines: # On FreeBSD SDL depends on libiconv and SDL_stdinc.h includes iconv.h, which is # located in ${LOCALBASE}/include. Append {LOCALBASE}/include to # the SDL_INCLUDE_DIR, thus allow to build SDL apps out of box. LIST(APPEND SDL_INCLUDE_DIR /usr/local/include) /usr/share/cmake/Modules/FindLibXml2.cmake should almost certainly contain a similar line. Fix: I don't know cmake well, but I assume adding a line like LIST(APPEND LIBXML2_INCLUDE_DIR /usr/local/include) to /usr/share/cmake/Modules/FindLibXml2.cmake would suffice. How-To-Repeat: git clone http://llvm.org/git/llvm.git cd llvm git checkout release_32 cd tools git clone http://llvm.org/git/clang.git cd clang git checkout release_32 cd ../../.. mkdir llvm-build cd llvm-build cmake -G Ninja ../llvm ninja bin/c-index-test
Responsible Changed From-To: freebsd-ports-bugs->kde Over to maintainer (via the GNATS Auto Assign Tool)
Is this PR still relevant?
I think it's still relevant, I remember noticing that several ports needed USES=iconv just because they pulled some libxml2 header that included iconv.h in bug 202798. However, I'm not sure just adding ${LOCALBASE}/include to LIBXML2_INCLUDE_DIR is the right solution here: whether iconv from base or ports needs to be used depends on the FreeBSD version, the iconv features being required and whether the iconv port is already installed. See the logic in Mk/Uses/iconv.mk that is needed to deal with all those differences.
The logic in Uses/iconv.mk adds variables ICONV_INCLUDE_DIR and LIBICONV_INCLUDE_DIR (set to identical values) which a port could use. I suppose we *could* patch FindLibXml2.cmake to add ICONV_INCLUDE_DIR to the LIBXML2_INCLUDE_DIR, so that ports doing find_package(LibXml2 REQUIRED) include_directories(${LIBXML2_INCLUDE_DIR}) add_definitions(${LIBXML2_DEFINITIONS}) will get the right directories included.
But you have to be careful. If you are unlucky, this may lead header files in ${LOCALBASE}/include being picked up, when you actually wanted the ones in ${WRKSRC}/* and break ports in unxpected ways :D
Is this still an issue?
I have long since forgotten how I encountered this. I don't know if it ever got fixed, but it's certainly not an issue for me any more so if you want to close the bug, that's fine with me.
Please feel free to reopen it at any time, if it reoccurs. mfg Tobias