Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WITH_NDLLS CMake option not working #143

Closed
shinmili opened this issue Jul 31, 2016 · 1 comment · Fixed by #157
Closed

WITH_NDLLS CMake option not working #143

shinmili opened this issue Jul 31, 2016 · 1 comment · Fixed by #157
Assignees

Comments

@shinmili
Copy link

Hi,

I'm trying to build neko on Gentoo/Linux amd64. I tried on v2-1-0 and master, even on virtual Arch Linux, but all caused this.
When I run these commands in the git root directory:

$ mkdir build_minimal
$ cd build_minimal
$ cmake "-DWITH_NDLLS=std.ndll;zlib.ndll" ..

the last cmake command checks for all the dependencies, against what README says WITH_NDLLS is for.

CMake's output without apache installed is like this:

-- The C compiler identification is GNU 4.9.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- set STATIC_DEPS to nothing
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28")
-- Found Git: /usr/bin/git (found version "2.7.3")
-- GC: /usr/include
-- GC_LIBRARIES: /usr/lib64/libgc.so
-- GC_STATIC_LIBRARIES: GC_STATIC_LIBRARIES-NOTFOUND
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found OpenSSL: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so (found version "1.0.2h")
-- checking for module 'zlib'
--   found zlib, version 1.2.8
-- Found dynamic MySQL client library: /usr/lib64/libmysqlclient.so
-- Static MySQL client library not found.
-- Looking for LIBMARIADB
-- Looking for LIBMARIADB - not found
-- Found PCRE
-- checking for module 'sqlite3'
--   found sqlite3, version 3.12.0
-- checking for module 'gtk+-2.0'
--   found gtk+-2.0, version 2.24.30
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find APACHE (missing: APACHE_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindAPACHE.cmake:31 (find_package_handle_standard_args)
  CMakeLists.txt:912 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/misato/neko/build_minimal/CMakeFiles/CMakeOutput.log".
See also "/home/misato/neko/build_minimal/CMakeFiles/CMakeError.log".

Or am I misunderstanding? Building neko requires all the dependencies in any case, and I just can suppress output ndlls with WITH_NDLLS?

@andyli andyli self-assigned this Aug 1, 2016
@ppenzin
Copy link
Collaborator

ppenzin commented Feb 18, 2017

I have also ran into this while working on the FreeBSD port and it is one of the reasons I did not want to enable build options (otherwise port would not pass tests).

The most ideomatic way to deal with this in CMake is to move build of ndlls to their own subdirectories and invoke add_subdirectory conditionally. For example, this is how Clang build decides to whether or not include docs:

if( CLANG_INCLUDE_DOCS )
  add_subdirectory(docs)
endif()

That change is quite simple, but another issue is that WITH_NDLLS is not only a list of libraries to build, but also a list of files in the build directory (there is an INSTALL statement for it in CMakeLists.txt), meaning that if we move any of the targets to its own subdirectory, then current mechanism of locating those libraries would not find it. To solve that, new CMakeLists.txt need to get their own install statements (which means that the install path needs to be figured out before CMake descends into libs directory).

Another CMake idiom deriving from its use of file system structure is that target declarations (add_library, add_executable, etc) should only use files in the same directory, common sources should be compiled into static libraries. That makes CMake code easier to follow and helps with debugging.

Kepping those things in mind, I have experimented with moving CMake code around and got it through CI build and tests. I replaced WITH_NDLLS with a set of "WITH" variables for different dependencies (that part can be reworked back to WITH_NDDLS, but this looks like less code to me at the moment). Code is still in my repo, I am merging latest changes in.

The only issue I had with this code so far is that for "package" target it puts ndll libraries in a subdirectory (just like it would for make install). It feels like it is the correct behavior, since CPack should create package according to the install rules, but that does not seem to affect other targets.

andyli added a commit that referenced this issue Feb 27, 2017
Refactor library build configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants