Skip to content

OS X building issues #439

@IngwiePhoenix

Description

@IngwiePhoenix

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:

Ingwie@Ingwies-Macbook-Pro.local ~/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions