Skip to content

bfd.cmake error - unset called with incorrect number of arguments #486

Description

@danim7

Hello,

First of all, it is great to see the recent surge in activity in this project :)

I was trying to compile the last version on Ubuntu 24.04, and I hit this error:

-- git revision rev. 2.3.3-207-gcdbc34c13 found
-- Looking for bfd.h
-- Looking for bfd.h - found
-- Performing Test BFD_COMPILE_TEST
-- Performing Test BFD_COMPILE_TEST - Success
CMake Error at cmake/bfd.cmake:29 (unset):
  unset called with incorrect number of arguments
Call Stack (most recent call first):
  CMakeLists.txt:137 (include)

When checking bfd.cmake:29, we can see this:
unset (${CMAKE_REQUIRED_LIBRARIES})

I'm a newbie to cmake, so I tried changing the syntax to:
unset (CMAKE_REQUIRED_LIBRARIES)

And then I got:

-- git revision rev. 2.3.3-207-gcdbc34c13 found
-- Looking for bfd.h
-- Looking for bfd.h - found
-- Performing Test BFD_COMPILE_TEST
-- Performing Test BFD_COMPILE_TEST - Success
-- bfd.h found but can't link against it, disabling support
-- 

	Configured aMule SVN for 'Linux-6.17.0-22-generic' on 'x86_64'.

The linking issue, seems to come from the empty "" element in the first position of the foreach loop.

foreach (CMAKE_REQUIRED_LIBRARIES
                               ""  "${LIBBFD_TMP}" "${LIBBFD_TMP};iberty" "${LIBBFD_TMP};dl" "${LIBBFD};iberty;dl" "${LIBBFD_TMP};${LIBINTL}" "${LIBBFD_TMP};iberty;${LIBINTL_TMP}" "${LIBBFD_TMP};iberty;dl;${LIBINBTL}"

After removing it, I get:

-- git revision rev. 2.3.3-207-gcdbc34c13 found
-- Looking for bfd.h
-- Looking for bfd.h - found
-- Performing Test BFD_COMPILE_TEST
-- Performing Test BFD_COMPILE_TEST - Success
-- 

	Configured aMule SVN for 'Linux-6.17.0-22-generic' on 'x86_64'.

And it builds correctly after that.

As i'm not an expert on cmake or the purpose of this library, i'm opening this issue to get your thoughts.
What shall be the best approach to fix this issue?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions