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

[package] libelf/0.8.13: can't compile with apple-clang 12 #2795

Closed
AndreyMlashkin opened this issue Sep 2, 2020 · 5 comments · Fixed by #2838
Closed

[package] libelf/0.8.13: can't compile with apple-clang 12 #2795

AndreyMlashkin opened this issue Sep 2, 2020 · 5 comments · Fixed by #2838
Labels
bug Something isn't working

Comments

@AndreyMlashkin
Copy link
Contributor

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: libelf/0.8.13
  • Operating System+version: Mac Catalina 10.15.6
  • Compiler+version: apple-clang 12
  • Conan version: conan 1.28.1
  • Python version: Python 3.8.5

Conan profile

Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=14
compiler.libcxx=libc++
compiler.version=12.0
os=Macos
os_build=Macos
[options]
*:fPic=True
*:shared=False
[build_requires]
[env]

Steps to reproduce (Include if Applicable)

conan install libelf/0.8.13@ --build missing

Logs (Include/Attach if Applicable)

Click to expand log
libelf/0.8.13: Copying sources to build folder
libelf/0.8.13: Building your package in /Users/andreimalashkin/.conan/data/libelf/0.8.13/_/_/build/b01a0ba71e5055bb491d9994ac256b1070bd5fea
libelf/0.8.13: Generator cmake created conanbuildinfo.cmake
libelf/0.8.13: Calling build()
libelf/0.8.13: Calling:
 > source_subfolder/configure '--enable-shared=no' '--prefix=/Users/andreimalashkin/.conan/data/libelf/0.8.13/_/_/package/b01a0ba71e5055bb491d9994ac256b1070bd5fea' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' 
creating cache ./config.cache
checking whether make sets ${MAKE}... yes
checking for gcc... gcc
checking whether the C compiler (gcc -m64 -O3 -m64) works... yes
checking whether the C compiler (gcc -m64 -O3 -m64) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking for a BSD compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking whether ln -s works... yes
checking for ANSI C header files... no
checking for unistd.h... yes
checking for stdint.h... yes
checking for fcntl.h... yes
checking for elf.h... no
checking for sys/elf.h... no
checking for link.h... no
checking for sys/link.h... no
checking if gcc can compile elf.h... no
checking for ar.h... yes
checking for libelf.h... no
checking for nlist.h... yes
checking for gelf.h... no
checking whether to install <libelf.h>, <nlist.h> and <gelf.h>... yes
checking for working const... yes
checking for off_t... yes
checking for size_t... yes
checking size of short... 0
checking size of int... 0
checking size of long... 0
checking size of long long... 0
checking size of __int64... 0
checking for 64-bit integer... no
checking for 32-bit integer... no
configure: error: neither int nor long is 32-bit
libelf/0.8.13: 
libelf/0.8.13: ERROR: Package 'b01a0ba71e5055bb491d9994ac256b1070bd5fea' build failed
libelf/0.8.13: WARN: Build folder /Users/andreimalashkin/.conan/data/libelf/0.8.13/_/_/build/b01a0ba71e5055bb491d9994ac256b1070bd5fea
ERROR: libelf/0.8.13: Error in build() method, line 90
	self._build_autotools()
while calling '_build_autotools', line 72
	autotools = self._configure_autotools()
while calling '_configure_autotools', line 68
	self._autotools.configure(configure_dir=self._source_subfolder, args=args)
	ConanException: Error 1 while executing source_subfolder/configure '--enable-shared=no' '--prefix=/Users/andreimalashkin/.conan/data/libelf/0.8.13/_/_/package/b01a0ba71e5055bb491d9994ac256b1070bd5fea' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' 
@AndreyMlashkin AndreyMlashkin added the bug Something isn't working label Sep 2, 2020
@madebr
Copy link
Contributor

madebr commented Sep 2, 2020

The script cannot determine the size of the basic types.
There is something wrong with your build environment.

checking size of short... 0
checking size of int... 0
checking size of long... 0
checking size of long long... 0
checking size of __int64... 0
checking for 64-bit integer... no
checking for 32-bit integer... no
configure: error: neither int nor long is 32-bit

It tries to compile+run the following source:

#include "confdefs.h"
#include <stdio.h>
main()
{
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(int));
  exit(0);
}

with the following command:

'${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'

Please check these environment variables + the config.log in the conan build folder.

@AndreyMlashkin
Copy link
Contributor Author

Here is the config.log file:

Click to expand log

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

configure:582: checking whether make sets ${MAKE}
configure:611: checking for gcc
configure:724: checking whether the C compiler (gcc -m64 -O3 -m64) works
configure:740: gcc -o conftest -m64 -O3 -DNDEBUG -m64 conftest.c  1>&5
configure:737:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main(){return(0);}
^
1 warning generated.
configure:766: checking whether the C compiler (gcc -m64 -O3 -m64) is a cross-compiler
configure:771: checking whether we are using GNU C
configure:780: gcc -E conftest.c
configure:799: checking whether gcc accepts -g
configure:831: checking how to run the C preprocessor
configure:852: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:941: checking for a BSD compatible install
configure:996: checking for ranlib
configure:1024: checking whether ln -s works
configure:1047: checking for ANSI C header files
configure:1060: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:1127: gcc -o conftest -m64 -O3 -DNDEBUG -m64 conftest.c  1>&5
configure:1122:67: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
                                                                  ^
configure:1122:67: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
1 error generated.
configure: failed program was:
#line 1116 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int main () { int i; for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }

configure:1154: checking for unistd.h
configure:1164: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:1154: checking for stdint.h
configure:1164: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:1154: checking for fcntl.h
configure:1164: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:1194: checking for elf.h
configure:1204: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:1200:10: fatal error: 'elf.h' file not found
#include <elf.h>
         ^~~~~~~
1 error generated.
configure: failed program was:
#line 1199 "configure"
#include "confdefs.h"
#include <elf.h>
configure:1194: checking for sys/elf.h
configure:1204: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:1200:10: fatal error: 'sys/elf.h' file not found
#include <sys/elf.h>
         ^~~~~~~~~~~
1 error generated.
configure: failed program was:
#line 1199 "configure"
#include "confdefs.h"
#include <sys/elf.h>
configure:1194: checking for link.h
configure:1204: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:1200:10: fatal error: 'link.h' file not found
#include <link.h>
         ^~~~~~~~
1 error generated.
configure: failed program was:
#line 1199 "configure"
#include "confdefs.h"
#include <link.h>
configure:1194: checking for sys/link.h
configure:1204: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:1200:10: fatal error: 'sys/link.h' file not found
#include <sys/link.h>
         ^~~~~~~~~~~~
1 error generated.
configure: failed program was:
#line 1199 "configure"
#include "confdefs.h"
#include <sys/link.h>
configure:1231: checking if gcc can compile elf.h
configure:1248: gcc -c -m64 -O3 -DNDEBUG conftest.c 1>&5
configure:1244:1: error: use of undeclared identifier 'Elf32_Ehdr'
Elf32_Ehdr dummy
^
1 error generated.
configure: failed program was:
#line 1237 "configure"
#include "confdefs.h"
#if HAVE_ELF_H
    #include <elf.h>
    #elif HAVE_SYS_ELF_H
    #include <sys/elf.h>
    #endif
int main() {
Elf32_Ehdr dummy
; return 0; }
configure:1282: checking for ar.h
configure:1292: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:1282: checking for libelf.h
configure:1292: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:1288:10: fatal error: 'libelf.h' file not found
#include <libelf.h>
         ^~~~~~~~~~
1 error generated.
configure: failed program was:
#line 1287 "configure"
#include "confdefs.h"
#include <libelf.h>
configure:1282: checking for nlist.h
configure:1292: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:1282: checking for gelf.h
configure:1292: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
configure:1288:10: fatal error: 'gelf.h' file not found
#include <gelf.h>
         ^~~~~~~~
1 error generated.
configure: failed program was:
#line 1287 "configure"
#include "confdefs.h"
#include <gelf.h>
configure:1319: checking whether to install <libelf.h>, <nlist.h> and <gelf.h>
configure:1335: checking for working const
configure:1389: gcc -c -m64 -O3 -DNDEBUG conftest.c 1>&5
configure:1410: checking for off_t
configure:1443: checking for size_t
configure:1477: checking size of short
configure:1496: gcc -o conftest -m64 -O3 -DNDEBUG -m64 conftest.c  1>&5
configure:1487:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^
configure:1490:11: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
  if (!f) exit(1);
          ^
configure:1490:11: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
configure:1491:22: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
  fprintf(f, "%d\n", sizeof(short));
              ~~     ^~~~~~~~~~~~~
              %lu
2 warnings and 1 error generated.
configure: failed program was:
#line 1485 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
{
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(short));
  exit(0);
}
configure:1516: checking size of int
configure:1535: gcc -o conftest -m64 -O3 -DNDEBUG -m64 conftest.c  1>&5
configure:1526:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^
configure:1529:11: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
  if (!f) exit(1);
          ^
configure:1529:11: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
configure:1530:22: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
  fprintf(f, "%d\n", sizeof(int));
              ~~     ^~~~~~~~~~~
              %lu
2 warnings and 1 error generated.
configure: failed program was:
#line 1524 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
{
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(int));
  exit(0);
}
configure:1555: checking size of long
configure:1574: gcc -o conftest -m64 -O3 -DNDEBUG -m64 conftest.c  1>&5
configure:1565:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^
configure:1568:11: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
  if (!f) exit(1);
          ^
configure:1568:11: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
configure:1569:22: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
  fprintf(f, "%d\n", sizeof(long));
              ~~     ^~~~~~~~~~~~
              %lu
2 warnings and 1 error generated.
configure: failed program was:
#line 1563 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
{
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(long));
  exit(0);
}
configure:1594: checking size of long long
configure:1613: gcc -o conftest -m64 -O3 -DNDEBUG -m64 conftest.c  1>&5
configure:1604:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^
configure:1607:11: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
  if (!f) exit(1);
          ^
configure:1607:11: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
configure:1608:22: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
  fprintf(f, "%d\n", sizeof(long long));
              ~~     ^~~~~~~~~~~~~~~~~
              %lu
2 warnings and 1 error generated.
configure: failed program was:
#line 1602 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
{
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(long long));
  exit(0);
}
configure:1634: checking size of __int64
configure:1653: gcc -o conftest -m64 -O3 -DNDEBUG -m64 conftest.c  1>&5
configure:1644:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^
configure:1647:11: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
  if (!f) exit(1);
          ^
configure:1647:11: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
configure:1648:29: error: use of undeclared identifier '__int64'
  fprintf(f, "%d\n", sizeof(__int64));
                            ^
1 warning and 2 errors generated.
configure: failed program was:
#line 1642 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
{
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(__int64));
  exit(0);
}
configure:2046: checking for 64-bit integer
configure:2077: checking for 32-bit integer

@madebr
Copy link
Contributor

madebr commented Sep 3, 2020

Can you try applying the following patch?

--- a/recipes/libelf/all/conanfile.py
+++ b/recipes/libelf/all/conanfile.py
@@ -40,6 +40,9 @@ class LibelfConan(ConanFile):
             if self.options.shared:
                 raise ConanInvalidConfiguration("libelf can not be built as shared library on non linux platforms")
 
+    def build_requirements(self):
+        self.build_requires("autoconf/2.69")
+
     def source(self):
         tools.get(**self.conan_data["sources"][self.version])
         extracted_dir = self.name + "-" + self.version
@@ -69,6 +72,8 @@ class LibelfConan(ConanFile):
         return self._autotools
 
     def _build_autotools(self):
+        with tools.chdir(self._source_subfolder):
+            self.run("autoreconf -fiv", run_environment=True)
         autotools = self._configure_autotools()
         autotools.make()

@AndreyMlashkin
Copy link
Contributor Author

The patch solved the problem! Many thanks!
Can you please apply it?

@mysshget
Copy link

您可以尝试应用以下补丁吗?

--- a / recipes / libelf / all / conanfile.py 
+++ b / recipes / libelf / all / conanfile.py 
@@ -40,6 +40,9 @@类LibelfConan(ConanFile):
             如果self.options.shared:
                 引发ConanInvalidConfiguration(“ libelf无法在非Linux平台上构建为共享库”)
 
+     def build_requirements(self):
+         self.build_requires(“ autoconf / 2.69”)
+
     def来源(自己):
         tools.get(** self.conan_data [“ sources”] [self.version])
         extract_dir = self.name +“-” + self.version
@@ -69,6 +72,8 @@ class LibelfConan(ConanFile):
         返回self._autotools
 
     def _build_autotools():
+        使用tools.chdir(self._source_subfolder):
+             self.run(“ autoreconf -fiv”,run_environment = True)
         autotools = self._configure_autotools()
         autotools.make()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants