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

bfd.h detection always fails because missing config.h header (or missing compile definitions) #358

Open
sl1pkn07 opened this issue May 10, 2023 · 1 comment

Comments

@sl1pkn07
Copy link

check_include_file (bfd.h HAVE_BFD)

this always fails, because when try to find the header:

    kind: "try_compile-v1"
    backtrace:
      - "/usr/share/cmake/Modules/CheckIncludeFile.cmake:95 (try_compile)"
      - "cmake/bfd.cmake:7 (check_include_file)"
      - "CMakeLists.txt:109 (include)"
    checks:
      - "Looking for bfd.h"
    directories:
      source: "/tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-AI6Ilm"
      binary: "/tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-AI6Ilm"
    cmakeVariables:
      CMAKE_C_FLAGS: ""
      CMAKE_C_FLAGS_DEBUG: "-g"
      CMAKE_EXE_LINKER_FLAGS: ""
    buildResult:
      variable: "HAVE_BFD"
      cached: true
      stdout: |
        Change Dir: /tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-AI6Ilm
        
        Run Build Command(s):/usr/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_35672/fast && /usr/bin/make  -f CMakeFiles/cmTC_35672.dir/build.make CMakeFiles/cmTC_35672.dir/build
        make[1]: se entra en el directorio '/tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-AI6Ilm'
        Building C object CMakeFiles/cmTC_35672.dir/CheckIncludeFile.c.o
        /usr/bin/cc    -o CMakeFiles/cmTC_35672.dir/CheckIncludeFile.c.o -c /tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-AI6Ilm/CheckIncludeFile.c
        En el fichero incluido desde /tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-AI6Ilm/CheckIncludeFile.c:1:
        /usr/include/bfd.h:35:2: error: #error config.h must be included before this header
           35 | #error config.h must be included before this header
              |  ^~~~~
        make[1]: *** [CMakeFiles/cmTC_35672.dir/build.make:78: CMakeFiles/cmTC_35672.dir/CheckIncludeFile.c.o] Error 1
        make[1]: se sale del directorio '/tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-AI6Ilm'
        make: *** [Makefile:127: cmTC_35672/fast] Error 2
        
      exitCode: 2

adding this to bfd.cmake:

diff --git a/cmake/bfd.cmake b/cmake/bfd.cmake
index 7889d2030..d7e4665af 100644
--- a/cmake/bfd.cmake
+++ b/cmake/bfd.cmake
@@ -1,6 +1,8 @@
 if (NOT HAVE_BFD)
        include (CheckIncludeFile)
        include (CheckCSourceCompiles)
+       list(APPEND CMAKE_REQUIRED_DEFINITIONS -DPACKAGE="${PACKAGE_NAME}")
+       list(APPEND CMAKE_REQUIRED_DEFINITIONS -DPACKAGE_VERSION="${VERSION}")
 
        check_include_file (bfd.h HAVE_BFD)

do the trick:

-- Looking for bfd.h
-- Looking for bfd.h - found
-- Performing Test BFD_COMPILE_TEST
-- Performing Test BFD_COMPILE_TEST - Failed
-- Performing Test BFD_COMPILE_TEST
-- Performing Test BFD_COMPILE_TEST - Success
    kind: "try_compile-v1"
    backtrace:
      - "/usr/share/cmake/Modules/CheckIncludeFile.cmake:95 (try_compile)"
      - "cmake/bfd.cmake:7 (check_include_file)"
      - "CMakeLists.txt:109 (include)"
    checks:
      - "Looking for bfd.h"
    directories:
      source: "/tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-RHxySm"
      binary: "/tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-RHxySm"
    cmakeVariables:
      CMAKE_C_FLAGS: ""
      CMAKE_C_FLAGS_DEBUG: "-g"
      CMAKE_EXE_LINKER_FLAGS: ""
    buildResult:
      variable: "HAVE_BFD"
      cached: true
      stdout: |
        Change Dir: /tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-RHxySm
        
        Run Build Command(s):/usr/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_05df7/fast && /usr/bin/make  -f CMakeFiles/cmTC_05df7.dir/build.make CMakeFiles/cmTC_05df7.dir/build
        make[1]: se entra en el directorio '/tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-RHxySm'
        Building C object CMakeFiles/cmTC_05df7.dir/CheckIncludeFile.c.o
        /usr/bin/cc -DPACKAGE=\\"aMule\\" -DPACKAGE_VERSION=\\"GIT\\"   -o CMakeFiles/cmTC_05df7.dir/CheckIncludeFile.c.o -c /tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-RHxySm/CheckIncludeFile.c
        Linking C executable cmTC_05df7
        /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_05df7.dir/link.txt --verbose=1
        /usr/bin/cc CMakeFiles/cmTC_05df7.dir/CheckIncludeFile.c.o -o cmTC_05df7 
        make[1]: se sale del directorio '/tmp/makepkg/amule-daemon-git/src/amule/build/CMakeFiles/CMakeScratch/TryCompile-RHxySm'
        
      exitCode: 0

but i'm not sure if is correct

greetings

@Vollstrecker
Copy link
Collaborator

Could be correct as bfd maybe want to print these info aswell. I would prefer to set the defines on one line and empty the list after it's not needed anymore. Maybe I have time on Saturday.

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

2 participants