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

Ulfius failed to link microhttpd on mingw64 using CMake #268

Open
raccoman opened this issue Jul 28, 2023 · 4 comments
Open

Ulfius failed to link microhttpd on mingw64 using CMake #268

raccoman opened this issue Jul 28, 2023 · 4 comments
Labels

Comments

@raccoman
Copy link

raccoman commented Jul 28, 2023

Describe the issue
I'm trying to link ulfius to my cmake project on Windows. I would like to have ulfius sourcecode inside my libs/ folder, then let cmake compile using add_subdirectory(libs/ulfius) and directly linking target ulfius_static. It seems to works just fine except for microhttpd.

To Reproduce
I cloned ulfius inside libs/ folder, then I downloaded microhttpd-w32-bin.zip extracted the libmicrohttpd-0.9.77-w32-bin\x86_64\MinGW\static\mingw64 contents inside libs/. Then I copied an Ulfius example and compiled my porject using Cmake (crf. Additional Context)

Expected behavior
It should successfully compile

Screenshots
immagine

System (please complete the following information):

  • Windows 11
  • Ulfius 2.7.13
  • git clone

Additional context
Here is my CMakeLists.txt

cmake_minimum_required(VERSION 3.22.1)
project(myapp C)

if (WIN32)
    set(MHD_LIBRARY ${PROJECT_SOURCE_DIR}/libs/microhttpd-w32/lib/libmicrohttpd.a)
    set(MHD_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/libs/microhttpd-w32/include)
endif ()
add_subdirectory(libs/ulfius-2.7.13)


include_directories(include)
set(SOURCES)

add_executable(${PROJECT_NAME} main.c ${SOURCES})

target_link_libraries(${PROJECT_NAME}
        ulfius_static)

if (NOT WIN32)
    target_link_libraries(${PROJECT_NAME} m)
endif ()
@babelouest
Copy link
Owner

Hello,

Unfortunately, I don't know much on windows build or mingw64, I believe it's possible since I think other were able to build it, but I wouldn't know how.

@sfhacker
Copy link

sfhacker commented Dec 3, 2023

Alo.

Sorry, we do not understand this issue.

image

image

@4cecoder
Copy link

I've been looking into this as well and still haven't found a smooth solution to building ulfius on windows

However, maybe trying zig cc command to build on windows.

link your libs and stuff and disable websockets to build easier for windows

With some tweaking of this command, I think we might be able to get some results on windows

zig cc -I /path/to/libmicrohttpd/bin -I /path/to/orcania -I /path/to/yder -o ulfius.o ulfius.c

@sfhacker
Copy link

I've never used zig in my life. However, if it works fine on different platforms and/or OSes (e.g. Mac, Linux & Windows), we should give it a try. More than happy to assist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants