sandeepmistry / pico-rmii-ethernet

BSD 3-Clause "New" or "Revised" License
204 stars 29 forks source link

CMake unable to create build files due to duplicate pico_lwip library #5

Open idpromnut opened 4 weeks ago

idpromnut commented 4 weeks ago

Hi, I'm trying to compile pico-rmii-ethernet When I try and build it I get the following CMake error:

[proc] Executing command: C:\dev\apps\CMake\bin\cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin\arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin\arm-none-eabi-g++.exe" --no-warn-unused-cli -SC:/dev/repos/rp2040-ether-dev/firmware/pico-rmii-ethernet -Bc:/dev/repos/rp2040-ether-dev/firmware/pico-rmii-ethernet/build -G "MinGW Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] Using PICO_SDK_PATH from environment ('C:\dev\personal\pico-sdk')
[cmake] PICO_SDK_PATH is C:/dev/personal/pico-sdk
[cmake] Defaulting PICO_PLATFORM to rp2040 since not specified.
[cmake] Defaulting PICO platform compiler to pico_arm_gcc since not specified.
[cmake] PICO compiler is pico_arm_gcc
[cmake] -- The C compiler identification is GNU 10.3.1
[cmake] -- The CXX compiler identification is GNU 10.3.1
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc.exe - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-g++.exe - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- The ASM compiler identification is GNU
[cmake] -- Found assembler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc.exe
[cmake] Build type is Debug
[cmake] Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize)
[cmake] Defaulting PICO target board to pico since not specified.
[cmake] Using board configuration from C:/dev/personal/pico-sdk/src/boards/include/boards/pico.h
[cmake] -- Found Python3: C:/Program Files/Python310/python.exe (found version "3.10.8") found components: Interpreter 
[cmake] TinyUSB available at C:/dev/personal/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; enabling build support for USB.
[cmake] Compiling TinyUSB with CFG_TUSB_DEBUG=1
[cmake] BTstack available at C:/dev/personal/pico-sdk/lib/btstack
[cmake] cyw43-driver available at C:/dev/personal/pico-sdk/lib/cyw43-driver
[cmake] Pico W Bluetooth build support available.
[cmake] lwIP available at C:/dev/personal/pico-sdk/lib/lwip
[cmake] mbedtls available at C:/dev/personal/pico-sdk/lib/mbedtls
[cmake] CMake Error at CMakeLists.txt:18 (add_library):
[cmake]   add_library cannot create target "pico_lwip" because another target with
[cmake]   the same name already exists.  The existing target is an interface library
[cmake]   created in source directory
[cmake]   "C:/dev/personal/pico-sdk/src/rp2_common/pico_lwip".  See documentation for
[cmake]   policy CMP0002 for more details.
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!

I'm using the latest Pico SDK 1.5 and GCC ARM 10.1

Let me know if there is any other information you need from me. I have PICO_SDK correctly mapped (I am able to generate and compile other Pico projects that I am working on).

Thanks!

aallan commented 4 weeks ago

CMake can't find the Lwip library. My guess is that you haven't initialised the GitHub sub modules. Either in this checkout or the SDK itself. See https://www.raspberrypi.com/news/how-to-add-ethernet-to-raspberry-pi-pico/ for a full walkthrough for building this repo.

idpromnut commented 4 weeks ago

I'm pretty sure the Pico SDK is finding and building the LWIP library. It is complaining that there is an existing interface library.

[cmake] CMake Error at CMakeLists.txt:18 (add_library):
[cmake]   add_library cannot create target "pico_lwip" because another target with
[cmake]   the same name already exists.  The existing target is an interface library
[cmake]   created in source directory
idpromnut commented 4 weeks ago

And I have init'd the submodules. LWIP is present (with the repo) under lib/lwip. I don't know if it makes a difference, but I am trying to compile this under windows. Is there something with the Cmake setup that may work under Linux that is tripping me up?

idpromnut commented 4 weeks ago

I tried the exact instructions found at https://www.raspberrypi.com/news/how-to-add-ethernet-to-raspberry-pi-pico/ on my laptop with a Debian install and i get the exact same problem (I also checked that I had init'd the pico-sdk repo as well):

user@helium:~/dev/pico-rmii-ethernet/build$ cmake ..
Using PICO_SDK_PATH from environment ('/home/user/dev/pico/pico-sdk')
PICO_SDK_PATH is /home/user/dev/pico/pico-sdk
Defaulting PICO_PLATFORM to rp2040 since not specified.
Defaulting PICO platform compiler to pico_arm_gcc since not specified.
-- Defaulting build type to 'Release' since not specified.
PICO compiler is pico_arm_gcc
-- The C compiler identification is GNU 8.3.1
-- The CXX compiler identification is GNU 8.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/arm-none-eabi-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/arm-none-eabi-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/arm-none-eabi-gcc
Build type is Release
Defaulting PICO target board to pico since not specified.
Using board configuration from /home/user/dev/pico/pico-sdk/src/boards/include/boards/pico.h
-- Found Python3: /usr/bin/python3.9 (found version "3.9.2") found components: Interpreter 
TinyUSB available at /home/usre/dev/pico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; enabling build support for USB.
BTstack available at /home/user/dev/pico/pico-sdk/lib/btstack
cyw43-driver available at /home/user/dev/pico/pico-sdk/lib/cyw43-driver
Pico W Bluetooth build support available.
lwIP available at /home/user/dev/pico/pico-sdk/lib/lwip
mbedtls available at /home/user/dev/pico/pico-sdk/lib/mbedtls
Using PICO_EXAMPLES_PATH from environment ('/home/user/dev/pico/pico-examples')
CMake Error at CMakeLists.txt:18 (add_library):
  add_library cannot create target "pico_lwip" because another target with
  the same name already exists.  The existing target is an interface library
  created in source directory
  "/home/user/dev/pico/pico-sdk/src/rp2_common/pico_lwip".  See
  documentation for policy CMP0002 for more details.

-- Configuring incomplete, errors occurred!
user@helium:~/dev/pico-rmii-ethernet/build$ 

Is there a particular pico-sdk commit that you are using? I am using the version tagged 1.5.1 (commit 6a7db34ff63345a7badec79ebea3aaef1712f374).