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

Alpine Build Failure #319

Closed
nayrnet opened this issue Feb 27, 2021 · 5 comments
Closed

Alpine Build Failure #319

nayrnet opened this issue Feb 27, 2021 · 5 comments

Comments

@nayrnet
Copy link

nayrnet commented Feb 27, 2021

Trying to make an alpine docker container, the build is failing with:

-- Found AVAHI: TRUE
-- Configuring done
CMake Error at external/misc/CMakeLists.txt:35 (add_library):
  No SOURCES given to target: misc

 CMake Generate step failed.  Build files cannot be regenerated correctly.

Here's a docker file to reproduce:

FROM alpine:latest as base

RUN mkdir -p /etc/direwolf
RUN apk add --no-cache  --update rtl-sdr
RUN apk add --no-cache  --update eudev
RUN apk add --no-cache  --update netcat-openbsd
RUN apk add --no-cache  --update alsa-lib
RUN apk add --no-cache  --update libusb
RUN apk add --no-cache  --update gpsd
RUN apk add --no-cache  --update avahi
#RUN apk add --no-cache  --update hamlib

FROM base as builder
RUN apk add --no-cache  --update alpine-sdk
RUN apk add --no-cache  --update cmake
RUN apk add --no-cache  --update eudev-dev
RUN apk add --no-cache  --update alsa-lib-dev
RUN apk add --no-cache  --update libusb-dev
RUN apk add --no-cache  --update gpsd-dev
RUN apk add --no-cache  --update avahi-dev
#RUN apk add --no-cache  --update hamlib-dev

RUN git clone "https://github.com/wb2osz/direwolf.git" /tmp/direwolf \
  && cd /tmp/direwolf \
  && git checkout dev \
  && mkdir build \
  && cd build \
  && cmake ..\
  && make -j8\
  && make DESTDIR=/target install \
  && find /target/usr/local/bin/ -type f -exec strip -p --strip-debug {} \;
@dranch
Copy link
Collaborator

dranch commented Feb 27, 2021

The misc part of the build is to add the strlcpy and strlcat functions to Linux or Windows based builds per external/misc/README . If I was to guess, your docker setup isn't passing enough information to cmake to declare what OS you're using. For example, here is the output of running "cmake .." on an Ubuntu 20.04 machine. Cmake ultimately recognizes it's a Linux X86_64 setup. What do you see on your setup?

--
$ cmake ..
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.25.1")
-- Dire Wolf Version: 1.7.0Development
-- Build type set to: Release
CMake system: Linux
-- Target architecture: x86_64
-- Use SSE SIMD instructions
-- Looking for strlcpy
-- Looking for strlcpy - not found
-- Looking for strlcat
-- Looking for strlcat - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Checking for module 'libgps'
-- Found libgps, version 3.20
-- Found GPSD: /usr/lib/x86_64-linux-gnu/libgps.so
-- Checking for module 'hamlib'
-- Found hamlib, version 3.3
-- Found HAMLIB: /usr/lib/x86_64-linux-gnu/libhamlib.so
-- Found ALSA: /usr/lib/x86_64-linux-gnu/libasound.so (found version "1.2.2")
-- Checking for module 'libudev'
-- Found libudev, version 245
-- Found UDEV: /usr/lib/x86_64-linux-gnu/libudev.so
-- Could NOT find AVAHI (missing: AVAHI_COMMON_FOUND AVAHI_CLIENT_FOUND)
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/src/packaging/direwolf/direwolf-1.7/build

@nayrnet
Copy link
Author

nayrnet commented Feb 28, 2021

I too see Linux x86_64, I've got a debian based container that builds perfectly fine with the same dependencies, was trying to see if I could make an alpine build for further space optimization, although I'm down to 28M w/debian I'd like to get it to build in alpine.

-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - 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/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.30.1")
-- Dire Wolf Version: 1.7.0-04b32c4
-- Build type set to: Release
CMake system: Linux
-- Target architecture: x86_64
-- Use SSE SIMD instructions
-- Looking for strlcpy
-- Looking for strlcpy - found
-- Looking for strlcat
-- Looking for strlcat - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Checking for module 'libgps'
--   Found libgps, version 3.21
-- Found GPSD: /usr/lib/libgps.so
-- Checking for module 'hamlib'
--   Package 'hamlib', required by 'virtual:world', not found
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
  The package name passed to `find_package_handle_standard_args` (HAMLIB)
  does not match the name of the calling package (hamlib).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/modules/Findhamlib.cmake:55 (find_package_handle_standard_args)
  CMakeLists.txt:280 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find HAMLIB (missing: HAMLIB_LIBRARY HAMLIB_INCLUDE_DIR)
-- Found ALSA: /usr/lib/libasound.so (found version "1.2.4")
-- Checking for module 'libudev'
--   Found libudev, version 243
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
  The package name passed to `find_package_handle_standard_args` (UDEV) does
  not match the name of the calling package (udev).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/modules/Findudev.cmake:68 (find_package_handle_standard_args)
  CMakeLists.txt:294 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found UDEV: /usr/lib/libudev.so
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
  The package name passed to `find_package_handle_standard_args` (AVAHI) does
  not match the name of the calling package (Avahi).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/modules/FindAvahi.cmake:12 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:299 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found AVAHI: TRUE
-- Configuring done
CMake Error at external/misc/CMakeLists.txt:35 (add_library):
  No SOURCES given to target: misc


CMake Generate step failed.  Build files cannot be regenerated correctly.

Cmake does seem to have issues with package case on alpine, tho they are just warnings I don't see em in Debian.

@wb2osz
Copy link
Owner

wb2osz commented Apr 10, 2023

Is this still a problem or can this be closed?

@tstellanova
Copy link

Building dev branch from source on debian I also saw the cmake error
-- Could NOT find Avahi (missing: AVAHI_COMMON_FOUND AVAHI_CLIENT_FOUND)
and worked around this by pre-installing the dependency:
sudo apt install libavahi-client-dev
This would make the full dependency chain:
sudo apt-get install gcc g++ make cmake libasound2-dev libudev-dev libavahi-client-dev
It may be worth updating the README.md instructions for On Debian / Ubuntu / Raspbian / Raspberry Pi OS

bwarden added a commit to bwarden/direwolf that referenced this issue Aug 14, 2023
For Linux builds, if strlcpt and strlcat are already provided, cmake is
given an empty list of sources to build for the "misc" library. Newer
versions of cmake throw an error for this. In this case, we should just
avoid building the library.

Failure pattern:
CMake Error at external/misc/CMakeLists.txt:35 (add_library):
  No SOURCES given to target: misc
CMake Generate step failed.  Build files cannot be regenerated correctly.

Fixes wb2osz#319
@wb2osz
Copy link
Owner

wb2osz commented Sep 23, 2023

There are multiple open cases for the same issue of building on Alpine.
These are combined into #344 .
Closing this one.

@wb2osz wb2osz closed this as completed Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants