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

OS X building issues #439

Open
IngwiePhoenix opened this issue Jan 6, 2019 · 1 comment
Open

OS X building issues #439

IngwiePhoenix opened this issue Jan 6, 2019 · 1 comment

Comments

@IngwiePhoenix
Copy link

Hello! I already have prepared a little patch for OS X, as there are several build issues I have faced regarding OpenSSL some path setups. But what I am stuck at right now, is libevent:

[email protected] ~/W/g/k/out $ ninja
[1/2] Building C object src/package-devel/Lib.Libevent/CMakeFiles/Libevent_glue.dir/Libevent_glue.c.o
FAILED: src/package-devel/Lib.Libevent/CMakeFiles/Libevent_glue.dir/Libevent_glue.c.o 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DHAVE_CONFIG_H -DLibevent_glue_EXPORTS -I../ -I../include -I. -I/usr/local/include -I../src/package-devel/Lib.Libevent -I../src/package-devel/Lib.Libevent/include -Isrc/package-devel/Lib.Libevent -Wsign-compare -Wformat -Wall -Wcomment -Wunused-macros -I/usr/local/include -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -fPIC -MD -MT src/package-devel/Lib.Libevent/CMakeFiles/Libevent_glue.dir/Libevent_glue.c.o -MF src/package-devel/Lib.Libevent/CMakeFiles/Libevent_glue.dir/Libevent_glue.c.o.d -o src/package-devel/Lib.Libevent/CMakeFiles/Libevent_glue.dir/Libevent_glue.c.o   -c ../src/package-devel/Lib.Libevent/Libevent_glue.c
clang: warning: argument unused during compilation: '-L/usr/local/opt/openssl/lib' [-Wunused-command-line-argument]
../src/package-devel/Lib.Libevent/Libevent_glue.c:1481:13: error: no member named '_internal' in 'struct evbuffer_ptr'; did you mean 'internal_'?
        evptr->ptr._internal.chain = NULL;
                   ^~~~~~~~~
                   internal_
/usr/local/include/event2/buffer.h:124:4: note: 'internal_' declared here
        } internal_;
          ^
../src/package-devel/Lib.Libevent/Libevent_glue.c:1482:13: error: no member named '_internal' in 'struct evbuffer_ptr'; did you mean 'internal_'?
        evptr->ptr._internal.pos_in_chain = 0;
                   ^~~~~~~~~
                   internal_
/usr/local/include/event2/buffer.h:124:4: note: 'internal_' declared here
        } internal_;
          ^
2 errors generated.
ninja: build stopped: subcommand failed.

Here is the current addition I made for the CMakeLists.txt file:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3d075e3a..d0fd257e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,6 +31,18 @@ else(MSVC)
        SET(CMAKE_CXX_FLAGS_COMPRESSED "${CMAKE_CXX_FLAGS} -Os -g0")
 endif(MSVC)
 
+## OS X: Starting with OS X 10.10 and upwards, OpenSSL is no longer shipped with the system
+## itself. Therefore, one needs to install OpenSSL manually, by using a package manager like Homebrew:
+##   $ brew install openssl
+## Once done, the include path has to be extended, as well as the library search path:
+##   - add to CFLAGS: -I/usr/local/opt/openssl/include/
+##   - add to CFLAGS: -L/usr/local/opt/openssl/lib/
+##   - add to Linker flags: -L/usr/local/opt/openssl/lib/
+if(APPLE)
+  set(CMAKE_C_FLAGS   "${CFLAGS} -I/usr/local/include -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib")
+  set(CMAKE_EXE_LINKER_FLAGS "-L/usr/local/opt/openssl/lib")
+endif(APPLE)
+
 ## Source Code settings
 set(KONOHA_SOURCE src/konoha/konoha.c src/parser/parser.c)

Any help on fixing the libevent troubble?

Kind regards,
Ingwie

@imasahiro
Copy link
Member

Thanks for filing an issue. I guess, compilation error on libevent is caused by interface change at libevent side - see libevent/libevent@cb9da0b#diff-2385bda88d0d693a147be8a9f79367e3R127

The original purpose of that code is initializing data, so it should be fine to replace with memset(&evptr->ptr, 0, sizeof(struct evbuffer_ptr));

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