1

I am using pico with W5500. There is a library for it here: GitHub-RP2040 but unfortunately there is no HTTP Client library ( I tried some examples and library is working). I need to use http client for http request to server so I decided to add myself. I found this github-W5X00. I didn't try it before but I think I need to add httpClient.c, httpClient.h and main.c to first link. Then maybe I can do http request with it.

I added httpClient.c and httpClient.h like this : photo and I added main.c like this: photo2.

When I try to use cmake .. (I am using Mac, its the same with MinGW or something) in build, it gives

 CMake Error at examples/http_client/CMakeLists.txt:3 (add_executable):
 Cannot find source file: 
 /Users/User/Desktop/RP2040/RP2040-HAT-C/libraries/ioLibrary_Driver/Internet/HTTPClient/httpClient.c

and

  CMake Error at libraries/CMakeLists.txt:136 (add_library):
  Cannot find source file: 
  /Users/User/Desktop/RP2040/RP2040-HAT-C/libraries/ioLibrary_Driver/Internet/HTTPClient/httpClient.c
CMake Error at libraries/CMakeLists.txt:136 (add_library):
No SOURCES given to target: HTTPCLIENT_FILES

error even files exist. Then my libraries/ioLibrary_Driver/internet/HTTPClient files are being delete. I try to write CMakeLists.txt by looking other examples (ftp,http,mqt,sntp etc.)

First errors CMakeLists.txt :

set(TARGET_NAME w5x00_http_client)

add_executable(${TARGET_NAME}
        ${TARGET_NAME}.c
        )

target_link_libraries(${TARGET_NAME} PRIVATE
        pico_stdlib
        hardware_spi
        hardware_dma
        ETHERNET_FILES
        IOLIBRARY_FILES
        DHCP_FILES
        DNS_FILES
        HTTPCLIENT_FILES
        TIMER_FILES
        )

pico_enable_stdio_usb(${TARGET_NAME} 1)
pico_enable_stdio_uart(${TARGET_NAME} 0)
pico_add_extra_outputs(${TARGET_NAME})

Second errors CMakeLists.txt (it is too long I only (150 line so I am sending only what I add ) :

# HTTP Client
add_library(HTTPCLIENT_FILES STATIC)

target_sources(HTTPCLIENT_FILES PUBLIC
        ${WIZNET_DIR}/Internet/HTTPClient/httpClient.c
        )
target_include_directories(HTTPCLIENT_FILES PUBLIC
        ${WIZNET_DIR}/Ethernet
        ${WIZNET_DIR}/Internet/HTTPClient
)

So I didn't understand what is the problem. I try to add these files like they do. Why it is not working ?

Or It just http client files can't work like this?

files location

files location2

  • "it gives .. error even files exist" - CMake rarely shows an error about unexistent file when it actually exists. Please, add **textual** view of your file's structure, so we can distinguish different symbols even if they are printed very similar (like `1` and `l`). Also, show **complete** error messages: After the line `Cannot find source file:` CMake prints exact source filename which is missed. – Tsyvarev May 28 '22 at 09:01
  • @Tsyvarev I added photo and full error message . Is this photo what you want ? – Tryingtogetsome May 28 '22 at 09:19
  • I asked for **text** of the file's structure, and "photo" is definitely not what I wanted. But the error messages now in complete form, thanks. However, this output smells like **not corresponding** to your `CMakeLists.txt`: In the script you specify **relative** name of the source file (`w5x00_http_client.c`), but the error message notes **absolute** path. Autodeleting of your files after the running cmake also smells like you choose wrong location for them. Sorry, I cannot be more specific because I am not familiar with the project your use. – Tsyvarev May 28 '22 at 09:34

0 Answers0