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

build fails in cygwin #60

Closed
goatshriek opened this issue Jan 23, 2020 · 11 comments
Closed

build fails in cygwin #60

goatshriek opened this issue Jan 23, 2020 · 11 comments
Assignees

Comments

@goatshriek
Copy link
Owner

Short description of Problem

Attempting to build stumpless in a cygwin environment with the required packages fails.

Environment Description

This has been tested in a Windows 10 build 10240 with cygwin64 3.1.2.

Other details

Current problems with this build appear to come primarily from conflicting type definitions between standard Unix headers (sys/socket.h, unistd.h) and the Windows headers (windows.h, winsock2.h). These are both detected by cmake, and when the library is compiled with both headers conflicting type definitions emerge. Disabling socket and network targets does not alleviate the issue.

Some other smaller problems also arise with Windows functionality and gtest, which should be easier to work around.

@goatshriek
Copy link
Owner Author

This was noted during work on #52 by @annesuzuki

@goatshriek
Copy link
Owner Author

A workaround to get (most) functionality working in cygwin is to add the following hardcoding of the header checks to CMakeLists.txt to avoid header conflicts directly after the check_include_files calls:

if(HAVE_SYS_SOCKET_H AND HAVE_WINSOCK2_H)
  set(HAVE_WINSOCK2_H FALSE)
  set(HAVE_WINDOWS_H FALSE)
endif(HAVE_SYS_SOCKET_H AND HAVE_WINSOCK2_H)

This will force the build environment to use the standard Unix headers.

In order to fix the Google Test builds, you will also need to adjust the -std=c++11 flag in the tools/cmake/test.cmake file to instead be -std=gnu++11.

Note that some of the network target tests still failed (at least for me) after these updates. A new branch to support cygwin builds will be created and incorporated into version 1.5.0.

@annesuzuki
Copy link

Screenshot1
Screenshot2

@annesuzuki
Copy link

These are the screenshots of the errors I'm getting. Everything up until make all is ok.

@goatshriek
Copy link
Owner Author

goatshriek commented Jan 23, 2020

Hmm, for some reason it appears your system doesn't have unistd.h available. Could you post the output of your cmake command in a fresh build directory? I used gcc in my cygwin build, but perhaps you are using mingw or something else that behaves differently.

I will make sure that the cygwin branch can build in this situation as well.

@goatshriek
Copy link
Owner Author

I've created a branch named portability to handle the scenario in the screenshots above - please give it a try next time and see if it resolves the issues in the above screenshots. I've also added a Travis CI test which failed with the same symptoms as above which now works on this branch.

I will add other portability-related fixes to this branch to overcome other portability-related problems identified here. I have not added the workaround for the CMakeLists.txt file mentioned above, as I hope to be able to work out a less blunt way to avoid conflicts.

@annesuzuki
Copy link

annesuzuki commented Jan 27, 2020

I switched to the portability branch and went through the installation procedure.
I still got errors after make all:
std_error.txt
std_output.txt

@goatshriek
Copy link
Owner Author

I've made some updates that get the portability branch building and running the tests, although there are still some warnings in the Windows Event Log module compilation and failing tests for socket and WEL targets. Give it a shot and see if you get some better results.

Any suggestions on how to add CI testing to prevent regressions of Cygwin support are welcome. From a quick glance the best option seems to be the Travis CI MSYS2 support, but I will need to dive into this further.

Thank you for your patience while this gets resolved!

@goatshriek
Copy link
Owner Author

goatshriek commented Jan 30, 2020

Builds of the portability branch on my cygwin installation now complete without any errors, including the tests (via make check). Please confirm if your issues are resolved as well, or post any other problems you encounter here. I'll continue cleaning up the documentation and fine-tuning some configurations in the meantime.

@goatshriek
Copy link
Owner Author

I've created pull request #61 to merge in the support for cygwin (and mingw along the way). I'll go ahead and merge it in a week (on 1 March) unless there are any other issues noted here.

@goatshriek
Copy link
Owner Author

This has been merged into master in release 1.5.0. Please report any further issues with Cygwin support in a new issue.

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

No branches or pull requests

2 participants