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

CMake build fails on OS X #26

Closed
kainjow opened this issue Mar 22, 2016 · 6 comments
Closed

CMake build fails on OS X #26

kainjow opened this issue Mar 22, 2016 · 6 comments

Comments

@kainjow
Copy link

kainjow commented Mar 22, 2016

Using Xcode 7.3, check fails to build:

cmake ../check && make

First error is:

lib/timer_settime.c:23:5: error: conflicting types for 'timer_settime'
int timer_settime(timer_t timerid CK_ATTRIBUTE_UNUSED,
     ^
lib/libcompat.h:196:16: note: previous declaration is here
CK_DLL_EXP int timer_settime(timer_t timerid, int flags,

OS X doesn't have itimespec but the CMake file doesn't properly detect this. If I disable the ifs in CMakeLists.txt on lines 167 and 168 for if(NOT HAVE_SYS_TIME_H) and if(MSVC) then it compiles. Not sure if this is the right fix though.

Also, the Travis tests don't test CMake, might be good to add.

@brarcher
Copy link
Contributor

Currently Check only supports CMake for Windows; all other platforms are encouraged to use the provided configure script.

If one were interested in providing changes which get CMake working on OSX, we would be happy to accept them and add something to the travis-ci config for building with CMake on OSX. If you have that interest, I'll leave this issue open.

@brarcher
Copy link
Contributor

Looking at your project, I see that at test time Check is being downloaded, compiled with CMake, and unit tests run. Probably this worked for Windows and GNU/Linux, but perhaps not other platforms such as OSX.

Originally I added CMake support to Check so that Windows could be supported. CMake also happens to work for GNU/Linux, and there is one job on our Jenkins instance which verifies that it continues to work. To date no work has gone into support CMake on other platforms, as the autotools build system works just fine. Probably for now Check will not officially support CMake on any platform besides Windows. If it happens to work, though, I'm not opposed to setting up something on our Jenkins instance or on Travis-CI to keep it working.

If you were able to provide some fixes to Check to enable CMake support for OSX, I can review the changes and add them to Check. If the fixes also happen to apply cleanly to Check 0.10.0, then you may have a way to use the latest Check release with your patches to get your OSX build working now before Check has its next release.

As a side note, would using Check 0.10.0 remove the need for the patch to get it working for MinGW? I think the patch referenced in that commit is in Check 0.10.0.

@brarcher
Copy link
Contributor

OS X doesn't have itimespec but the CMake file doesn't properly detect this. If I disable the ifs in CMakeLists.txt on lines 167 and 168 for if(NOT HAVE_SYS_TIME_H) and if(MSVC) then it compiles. Not sure if this is the right fix though.

It looks like one will need to add an Apple section for checking for itimespec, or simply marking that the definition is missing. For example:

# Check for  tv_sec in struct timeval 
if(NOT HAVE_SYS_TIME_H)
    if(MSVC)
...
    endif(MSVC)
endif(NOT HAVE_SYS_TIME_H)
+ if(APPLE)
+    add_definitions(-DSTRUCT_ITIMERSPEC_DEFINITION_MISSING=1)
+   set(STRUCT_ITIMERSPEC_DEFINITION_MISSING 1)
+ endif(APPLE)

Could you try that out and see if it works for you? It works for me on my Mac.

@jd-boyd
Copy link
Contributor

jd-boyd commented Mar 23, 2016

I made #29 which should fix this issue.

@jd-boyd
Copy link
Contributor

jd-boyd commented Mar 24, 2016

Since #29 was merged, I think this issue could be closed?

@kainjow
Copy link
Author

kainjow commented Mar 24, 2016

The fix works for me, thanks!

@kainjow kainjow closed this as completed Mar 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants