Hi,

I've just tried the latest libevent2 with Windows. It needs a couple of
fixes as below. Also I have attached a couple of cmake files that will
create build projects for Windows for anyone interested (1 file for main
dir, 1 file for test dir, and no attempt to make it work for unixen).

Regards,
Brodie


evutil.c:
-               return gai_strerror(err);
+               return gai_strerrorA(err);
avoid errors when building with _UNICODE defined

http.c
+#include <winsock2.h>
 #include <ws2tcpip.h>
avoid errors when building with VC 2003 .NET


There also appears to be a number of problems with the Windows build.
The regress test harness has a number of tests that crash. Different
between compilers and debug/release build modes. I haven't looked into
the problems at all.

VC 2003 debug build:

bufferevent/bufferevent_timeout_filter: [forking]
  [bufferevent_timeout_filter FAILED]
  (crash)
bufferevent/bufferevent_timeout_filter_pair: [forking]
  [bufferevent_timeout_filter_pair FAILED]
  (crash)
http/data_length_constraints: [forking]
  FAIL \src\cross\vendor\libevent-2.0.4-alpha\test\regress_http.c:2447:
assert(req)  [data_length_constraints FAILED]

VC 2003 release build:

rpc/basic_test: [forking] [err]
\src\cross\vendor\libevent-2.0.4-alpha\evrpc.c:267: Assertion evhttp
_del_cb(base->http_server, registered_uri) == 0 failed in
evrpc_unregister_rpc
  [basic_test FAILED]

rpc/basic_message: [forking] [err]
\src\cross\vendor\libevent-2.0.4-alpha\evrpc.c:267: Assertion evh
ttp_del_cb(base->http_server, registered_uri) == 0 failed in
evrpc_unregister_rpc
  [basic_message FAILED]

rpc/basic_client: [forking] [err]
\src\cross\vendor\libevent-2.0.4-alpha\evrpc.c:267: Assertion evht
tp_del_cb(base->http_server, registered_uri) == 0 failed in
evrpc_unregister_rpc
  [basic_client FAILED]

rpc/basic_queued_client: [forking] [err]
\src\cross\vendor\libevent-2.0.4-alpha\evrpc.c:267: Asserti
on evhttp_del_cb(base->http_server, registered_uri) == 0 failed in
evrpc_unregister_rpc
  [basic_queued_client FAILED]

rpc/basic_client_with_pause: [forking]
  FAIL \src\cross\vendor\libevent-2.0.4-alpha\test\regress_rpc.c:647:
assert(hook_pause_cb_called ==
 4): 0 vs 4[err] \src\cross\vendor\libevent-2.0.4-alpha\evrpc.c:267:
Assertion evhttp_del_cb(base->h
ttp_server, registered_uri) == 0 failed in evrpc_unregister_rpc
  [basic_client_with_pause FAILED]

rpc/client_timeout: [forking] [err]
\src\cross\vendor\libevent-2.0.4-alpha\evrpc.c:267: Assertion ev
http_del_cb(base->http_server, registered_uri) == 0 failed in
evrpc_unregister_rpc
  [client_timeout FAILED]


VC 2008 debug build:

bufferevent/bufferevent_timeout_filter: [forking]
  [bufferevent_timeout_filter FAILED]
  (crash)
bufferevent/bufferevent_timeout_filter_pair: [forking]
  [bufferevent_timeout_filter_pair FAILED]
  (crash)

VC 2008 release build:

rpc/basic_test: [forking] [err] ..\evrpc.c:267: Assertion
evhttp_del_cb(base->http_server, registered_uri) == 0 failed in
evrpc_unregister_rpc

rpc/basic_message: [forking] [err] ..\evrpc.c:267: Assertion
evhttp_del_cb(base->http_server, registered_uri) == 0 failed in
evrpc_unregister_rpc

rpc/basic_client: [forking] [err] ..\evrpc.c:267: Assertion
evhttp_del_cb(base->http_server, registered_uri) == 0 failed in
evrpc_unregister_rpc

rpc/basic_queued_client: [forking] [err] ..\evrpc.c:267: Assertion
evhttp_del_cb(base->http_server, registered_uri) == 0 failed in
evrpc_unregister_rpc

rpc/basic_client_with_pause: [forking]
  FAIL ..\..\test\regress_rpc.c:647: assert(hook_pause_cb_called == 4):
0 vs 4[err] ..\evrpc.c:267:
Assertion evhttp_del_cb(base->http_server, registered_uri) == 0 failed
in evrpc_unregister_rpc

rpc/client_timeout: [forking] [err] ..\evrpc.c:267: Assertion
evhttp_del_cb(base->http_server, registered_uri) == 0 failed in
evrpc_unregister_rpc
# -----------------------------------------------------------------------------
# Copyright (c) 2010 Cross Language Inc., All Rights Reserved.
#
# vendor/libevent
# -----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)

# get rid of the extra default configurations
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Limited 
configurations" FORCE)

project(libevent)

# Put the libaries and binaries that get built into directories at the
# top of the build tree rather than in hard-to-find leaf directories. 
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)

# -----------------------------------------------------------------------------
# Flags to ensure that debug info is generated in release mode

if(MSVC)
    set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} /Zi /W3 /wd4996")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /W3 /wd4996")
    set(CMAKE_EXE_LINKER_FLAGS_RELEASE    "${CMAKE_EXE_LINKER_FLAGS_RELEASE} 
/DEBUG")
    set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} 
/DEBUG")
        
    add_definitions(-D_UNICODE -DUNICODE)                                       
      # Unicode
    add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)       
      # No spurious warnings
    add_definitions(-DNTDDI_VERSION=0x05000400 -DWINVER=0x0500 
-D_WIN32_WINNT=0x0500) # Windows 2000 SP4
    add_definitions(-DHAVE_CONFIG_H -D_CRT_SECURE_NO_DEPRECATE)

    include_directories(include compat WIN32-Code .)
endif()

set(PRIVATE_HEADERS
    bufferevent-internal.h
    changelist-internal.h
    defer-internal.h
    evbuffer-internal.h
    evdns.h
    event-internal.h
    event.h
    evhttp.h
    evmap-internal.h
    evrpc-internal.h
    evrpc.h
    evsignal-internal.h
    evthread-internal.h
    evutil.h
    ht-internal.h
    http-internal.h
    iocp-internal.h
    ipv6-internal.h
    log-internal.h
    minheap-internal.h
    mm-internal.h
    ratelim-internal.h
    strlcpy-internal.h
    util-internal.h
    )
    
set(PUBLIC_HEADERS
    include/event2/buffer.h
    include/event2/bufferevent.h
    include/event2/bufferevent_compat.h
    include/event2/bufferevent_ssl.h
    include/event2/bufferevent_struct.h
    include/event2/buffer_compat.h
    include/event2/dns.h
    include/event2/dns_compat.h
    include/event2/dns_struct.h
    include/event2/event.h
    include/event2/event_compat.h
    include/event2/event_struct.h
    include/event2/http.h
    include/event2/http_compat.h
    include/event2/http_struct.h
    include/event2/listener.h
    include/event2/rpc.h
    include/event2/rpc_compat.h
    include/event2/rpc_struct.h
    include/event2/tag.h
    include/event2/tag_compat.h
    include/event2/thread.h
    include/event2/util.h
    )

set(CORE_FILES
    event.c 
    buffer.c 
    bufferevent.c 
    bufferevent_sock.c 
        bufferevent_pair.c 
    listener.c 
    evmap.c 
    log.c 
    evutil.c 
        strlcpy.c 
    signal.c 
    bufferevent_filter.c 
    evthread.c 
        bufferevent_ratelim.c 
    evutil_rand.c
    )
    
set(WIN_FILES    
    win32select.c 
    evthread_win32.c 
    buffer_iocp.c 
        event_iocp.c 
    bufferevent_async.c
    )
    
set(EXTRA_FILES
    event_tagging.c 
    http.c 
    evdns.c 
    evrpc.c
    )

add_library(libevent_core STATIC
    ${PRIVATE_HEADERS}
    ${PUBLIC_HEADERS}
    ${CORE_FILES}
    ${WIN_FILES}
    )
    
add_library(libevent_extras STATIC
    ${EXTRA_FILES}
    )
    
add_library(libevent STATIC
    ${PRIVATE_HEADERS}
    ${PUBLIC_HEADERS}
    ${CORE_FILES}
    ${WIN_FILES}
    ${EXTRA_FILES}
    )

source_group("Private Headers"  FILES ${PRIVATE_HEADERS})
source_group("Public Headers"   FILES ${PUBLIC_HEADERS})
source_group("Core Source"      FILES ${CORE_FILES})
source_group("Win Source"       FILES ${WIN_FILES})
source_group("Extra Source"     FILES ${EXTRA_FILES})

add_subdirectory(test)
# -----------------------------------------------------------------------------
# Copyright (c) 2010 Cross Language Inc., All Rights Reserved.
#
# vendor/libevent/test
# -----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)

add_executable(regress
    regress.c 
    regress_buffer.c 
    regress_http.c 
    regress_dns.c 
        regress_testutils.c 
    regress_rpc.c 
    regress.gen.c 
        regress_et.c 
    regress_bufferevent.c 
        regress_listener.c 
    regress_util.c 
    tinytest.c 
        regress_main.c 
    regress_minheap.c 
    regress_iocp.c
    )
target_link_libraries(regress libevent)
if(WIN32)
  target_link_libraries(regress ws2_32 shell32 advapi32)
endif()

# -----------------------------------------------------------------------------

add_executable(test-init
    test-init.c
    )
target_link_libraries(test-init libevent)
if(WIN32)
  target_link_libraries(test-init ws2_32 shell32 advapi32)
endif()

# -----------------------------------------------------------------------------

add_executable(test-eof
    test-eof.c
    )
target_link_libraries(test-eof libevent)
if(WIN32)
  target_link_libraries(test-eof ws2_32 shell32 advapi32)
endif()

# -----------------------------------------------------------------------------

add_executable(test-weof
    test-weof.c
    )
target_link_libraries(test-weof libevent)
if(WIN32)
  target_link_libraries(test-weof ws2_32 shell32 advapi32)
endif()

# -----------------------------------------------------------------------------

add_executable(test-time
    test-time.c
    )
target_link_libraries(test-time libevent)
if(WIN32)
  target_link_libraries(test-time ws2_32 shell32 advapi32)
endif()
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://lists.monkey.org:8080/listinfo/libevent-users

Reply via email to