Modify

Ticket #447 (closed Bug: Fixed)

Opened 2 years ago

Last modified 3 months ago

E17 build issue for OpenBSD-4.6

Reported by: sda00@… Owned by: vtorry
Priority: Major Milestone: Enlightenment 0.17.1
Component: enlightenment Keywords: undefined reference to `backtrace'
Cc: Blocked By:
Blocking: #900

Description

the case is here:  http://pastebin.com/m15eb3ad2

the cure is to add

#include <execinfo.h>

into the ./src/bin/e_signals.c file and adjust CFLAGS for explicit declaration of "-lexecinfo" among other things.

guess that it's mostly the OpenBSD related issue anyway.

thanks!

Attachments

Change History

comment:1 Changed 2 years ago by vtorri

can you try this patch ?

Index: src/bin/e_signals.c
===================================================================
--- src/bin/e_signals.c	(revision 43565)
+++ src/bin/e_signals.c	(working copy)
@@ -7,6 +7,10 @@
 #include "e.h"
 #include <X11/Xlib.h>
 
+#if defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) || defined (__DragonFly__) || defined (__MacOSX__)
+# include <execinfo.h> 
+#endif
+
 static volatile Eina_Bool _e_x_composite_shutdown_try = 0;
 static void
 _e_x_composite_shutdown(void)
Index: configure.ac
===================================================================
--- configure.ac	(revision 43565)
+++ configure.ac	(working copy)
@@ -260,8 +260,13 @@
 
 AC_E_CHECK_PKG(ECORE_IMF, [ecore-imf ecore-imf-evas], [], [:])
 
+case "$host_os" in
+   *bsd*)
+      bsd_libs="-lexecinfo"
+   ;;
+esac
 
-e_libs=$E_LIBS" "$LIBINTL" "$fnmatch_libs" "$ECORE_IMF_LIBS
+e_libs=$E_LIBS" "$LIBINTL" "$fnmatch_libs" "$ECORE_IMF_LIBS" "$bsd_libs
 e_cflags="-DUSE_E_CONFIG_H "$E_CFLAGS" "$ECORE_IMF_CFLAGS
 e_configflags="-DUSE_E_CONFIG_H"
 

comment:2 Changed 2 years ago by sda00@…

it works! also to have a smooth build we need to remove some comments from "default.edc":

//      set_state(PART:"increase_button", "inactive", 0.0);
//      set_state(PART:"decrease_button", "inactive", 0.0);
//      set_state(PART:"increase", "inactive", 0.0);
//      set_state(PART:"decrease", "inactive", 0.0);

the're 8 lines of comments total, because "edje_cc" fails to build the "default.edj" if they're present :(.

the current svn return the error now:

 gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I. -I../../../.. -I.. -I../../../.. -I../../../../src/modules/everything -I../../../../src/bin -I../../../../src/lib -I../../../../src/modules -DUSE_E_CONFIG_H -I/usr/local/include -I/usr/local//include -I/usr/local/include/fribidi -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/local/include/efreet -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/eina-0 -I/usr/local/include/eina-0/eina -I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus-1.0/include -I/usr/local/include -I/usr/local/include/fribidi -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/eina-0 -I/usr/local/include/eina-0/eina -I/usr/local/include -I/usr/include -I/usr/local/include -I/usr/X11R6/include -lintl -liconv -lpthread -MT evry_plug_dir_browse.lo -MD -MP -MF .deps/evry_plug_dir_browse.Tpo -c evry_plug_dir_browse.c  -fPIC -DPIC -o .libs/evry_plug_dir_browse.o
gcc: -lintl: linker input file unused because linking not done
gcc: -liconv: linker input file unused because linking not done
gcc: -lpthread: linker input file unused because linking not done
evry_plug_dir_browse.c: In function '_read_directory':
evry_plug_dir_browse.c:232: error: too many arguments to function 'ecore_thread_run'
gmake[5]: *** [evry_plug_dir_browse.lo] Error 1

but i suppose that this error is due to the outdated "ecore" (build approx 2 weeks ago)

HUGE THANKS!

comment:3 Changed 2 years ago by vtorri

about default.edc, use C comment instead of c++ comments. The correct way would be to fix edje so that c++ comments work. The same problem exists on Mac OS X (well, it's almost a FreeBSD...)

about the error in everything, update, compile and install ecore.

comment:4 Changed 2 years ago by vtorri

better patch

Index: src/bin/e_signals.c
===================================================================
--- src/bin/e_signals.c	(revision 43567)
+++ src/bin/e_signals.c	(working copy)
@@ -7,6 +7,10 @@
 #include "e.h"
 #include <X11/Xlib.h>
 
+#ifdef HAVE_EXECINFO_H
+# include <execinfo.h> 
+#endif
+
 static volatile Eina_Bool _e_x_composite_shutdown_try = 0;
 static void
 _e_x_composite_shutdown(void)
Index: configure.ac
===================================================================
--- configure.ac	(revision 43567)
+++ configure.ac	(working copy)
@@ -149,6 +149,47 @@
 AC_SUBST(cf_cflags)
 AC_SUBST(cf_libs)
 
+
+execinfo_libs=""
+AC_CHECK_HEADERS([execinfo.h], [have_execinfo="yes"], [have_execinfo="no"])
+if test "x${have_execinfo}" = "xyes" ; then
+   AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[
+#include <stdlib.h>
+#include <execinfo.h>
+         ]],
+         [[
+backtrace_symbols_fd(NULL, 0, 0);
+         ]])],
+      [link_execinfo="yes"],
+      [link_execinfo="no"])
+fi
+if test "x${link_execinfo}" = "xno" ; then
+   LDFLAGS_save="${LDFLAGS}"
+   LDFLAGS="${LDFLAGS} -lexecinfo"
+   AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[
+#include <stdlib.h>
+#include <execinfo.h>
+         ]],
+         [[
+backtrace_symbols_fd(NULL, 0, 0);
+         ]])],
+      [
+       linkexec_info="yes"
+       execinfo_libs="-lexecinfo"
+      ],
+      [linkexec_info="no"])
+   LDFLAGS="${LDFLAGS_save}"
+fi
+
+if test "x${link_execinfo}" = "xno" ; then
+   AC_MSG_ERROR([Cannot use backtrace_symbols_fd()])
+fi
+
+
 #ALL_LINGUAS="bg de eo es fi fr ja pl pt ru zh_CN hu sl it cs da sk sv nb nl zh_TW ko"
 #ALL_LINGUAS="bg de eo es fi fr ja pt ru zh_CN hu sl it cs da sk sv nb nl zh_TW"
 # a lot of .po's are broken
@@ -260,8 +301,7 @@
 
 AC_E_CHECK_PKG(ECORE_IMF, [ecore-imf ecore-imf-evas], [], [:])
 
-
-e_libs=$E_LIBS" "$LIBINTL" "$fnmatch_libs" "$ECORE_IMF_LIBS
+e_libs=$E_LIBS" "$LIBINTL" "$fnmatch_libs" "$ECORE_IMF_LIBS" "$execinfo_libs
 e_cflags="-DUSE_E_CONFIG_H "$E_CFLAGS" "$ECORE_IMF_CFLAGS
 e_configflags="-DUSE_E_CONFIG_H"
 

comment:5 Changed 2 years ago by sda00@…

well, the result is strange:

checking execinfo.h usability... yes
checking execinfo.h presence... yes
checking for execinfo.h... yes
configure: error: Cannot use backtrace_symbols_fd()

if we declare "-lexecinfo" manually - then configure/(autogen.sh) is fine.

comment:6 Changed 2 years ago by vtorri

paste config.log

comment:7 Changed 2 years ago by sda00@…

comment:8 Changed 2 years ago by vtorri

in the patch, replace

+   AC_MSG_ERROR([Cannot use backtrace_symbols_fd()])

by

+   AC_MSG_ERROR([Cannot use backtrace_symbols_fd])

that is, without () after backtrace_symbols_fd

If it still does not work, paste the configure script and config.log again

comment:9 Changed 2 years ago by sda00@…

checking execinfo.h presence... yes
checking for execinfo.h... yes
configure: error: Cannot use backtrace_symbols_fd

 http://www.mediafire.com/download.php?hzmnzzzezd4 - configure script and config.log are bzipped

comment:10 Changed 2 years ago by sda00@…

comment:11 Changed 2 years ago by vtorri

can you create the file conftest.c:

#include <stdlib.h>
#include <execinfo.h>
int main()
{
backtrace_symbols_fd(NULL, 0, 0);
return 0;
}

and compile it with

gcc -std=gnu99 -o conftest -I/usr/include -lintl -liconv -lpthread -L/usr/local/lib -I/usr/local/include -L/usr/X11R6/lib -I/usr/X11R6/include   -L/usr/local/lib -L/usr/X11R6/lib -lintl -lpthread -L/usr/local/lib -L/usr/X11R6/lib -lintl -lpthread  -lexecinfo conftest.c

?

comment:12 Changed 2 years ago by sda00@…

sure, the build is o'k,

conftest: ELF 32-bit LSB executable, Intel 80386, version 1, for OpenBSD, dynamically linked (uses shared libs), not stripped

comment:13 Changed 2 years ago by vtorri

I'm lost...

Try with the following patch, it adds some messages in the configure output, and give the configure output.

Index: src/bin/e_signals.c
===================================================================
--- src/bin/e_signals.c	(revision 43567)
+++ src/bin/e_signals.c	(working copy)
@@ -7,6 +7,10 @@
 #include "e.h"
 #include <X11/Xlib.h>
 
+#ifdef HAVE_EXECINFO_H
+# include <execinfo.h> 
+#endif
+
 static volatile Eina_Bool _e_x_composite_shutdown_try = 0;
 static void
 _e_x_composite_shutdown(void)
Index: configure.ac
===================================================================
--- configure.ac	(revision 43567)
+++ configure.ac	(working copy)
@@ -149,6 +149,56 @@
 AC_SUBST(cf_cflags)
 AC_SUBST(cf_libs)
 
+
+execinfo_libs=""
+AC_CHECK_HEADERS([execinfo.h], [have_execinfo="yes"], [have_execinfo="no"])
+if test "x${have_execinfo}" = "xyes" ; then
+   AC_MSG_CHECKING([whether backtrace_symbols_fd() is in libc])
+
+   AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[
+#include <stdlib.h>
+#include <execinfo.h>
+         ]],
+         [[
+backtrace_symbols_fd(NULL, 0, 0);
+         ]])],
+      [link_execinfo="yes"],
+      [link_execinfo="no"])
+
+   AC_MSG_RESULT([${link_execinfo}])
+fi
+
+if test "x${link_execinfo}" = "xno" ; then
+   AC_MSG_CHECKING([whether backtrace_symbols_fd() is in libexecinfo])
+
+   LDFLAGS_save="${LDFLAGS}"
+   LDFLAGS="${LDFLAGS} -lexecinfo"
+   AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[
+#include <stdlib.h>
+#include <execinfo.h>
+         ]],
+         [[
+backtrace_symbols_fd(NULL, 0, 0);
+         ]])],
+      [
+       linkexec_info="yes"
+       execinfo_libs="-lexecinfo"
+      ],
+      [linkexec_info="no"])
+   LDFLAGS="${LDFLAGS_save}"
+
+   AC_MSG_RESULT([${link_execinfo}])
+fi
+
+if test "x${link_execinfo}" = "xno" ; then
+   AC_MSG_ERROR([Cannot use backtrace_symbols_fd()])
+fi
+
+
 #ALL_LINGUAS="bg de eo es fi fr ja pl pt ru zh_CN hu sl it cs da sk sv nb nl zh_TW ko"
 #ALL_LINGUAS="bg de eo es fi fr ja pt ru zh_CN hu sl it cs da sk sv nb nl zh_TW"
 # a lot of .po's are broken
@@ -260,8 +310,7 @@
 
 AC_E_CHECK_PKG(ECORE_IMF, [ecore-imf ecore-imf-evas], [], [:])
 
-
-e_libs=$E_LIBS" "$LIBINTL" "$fnmatch_libs" "$ECORE_IMF_LIBS
+e_libs=$E_LIBS" "$LIBINTL" "$fnmatch_libs" "$ECORE_IMF_LIBS" "$execinfo_libs
 e_cflags="-DUSE_E_CONFIG_H "$E_CFLAGS" "$ECORE_IMF_CFLAGS
 e_configflags="-DUSE_E_CONFIG_H"
 

comment:14 Changed 2 years ago by sda00@…

if we don't set "-lexecinfo" for CFLAGS - the error appear:

checking execinfo.h presence... yes
checking for execinfo.h... yes
checking whether backtrace_symbols_fd() is in libc... no
checking whether backtrace_symbols_fd() is in libexecinfo... no
configure: error: Cannot use backtrace_symbols_fd()

but if we do - all is fine. please commit the patch. it's easy to declare the "-lexecinfo" for CFLAGS.

thank you for your patience and attention, regards, sda

comment:15 Changed 2 years ago by vtorri

First, please fix your CFLAGS and LDFLAGS:

CPPFLAGS should contain preprocessor stuff, mainly all the -D* and -I* flags CFLAGS should not contain -L* and -l*, but should contain compiler flags LDFLAGS should contain the -L* and -l* flags

It will not correct the problem, but it will be cleaner. So -lexecinfo should belong to LDFLAGS.

I'm still not satisfied. Last try: with the patched configure.ac, instead of

LDFLAGS="${LDFLAGS} -lexecinfo"

use:

LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -lexecinfo"

comment:16 Changed 2 years ago by vtorri

and be sure to not have -lexecinfo in your env vars, of course

comment:17 Changed 2 years ago by sda00@…

bash-4.0$ set | grep -i flags
CFLAGS='-I/usr/include -I/usr/local/include -I/usr/X11R6/include '
LDFLAGS='-L/usr/local/lib -L/usr/X11R6/lib -L/usr/lib -lintl -lpthread -liconv '

with

LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -lexecinfo"

result:

checking execinfo.h usability... yes
checking execinfo.h presence... yes
checking for execinfo.h... yes
checking whether backtrace_symbols_fd() is in libc... no
checking whether backtrace_symbols_fd() is in libexecinfo... no
configure: error: Cannot use backtrace_symbols_fd()

we do need

export CFLAGS="-I/usr/include -I/usr/local/include -I/usr/X11R6/include -lexecinfo"

to pass ./configure :(

comment:18 Changed 2 years ago by vtorri

and if you replace LDFLAGS by LIBS in the patch ?

comment:19 Changed 2 years ago by sda00@…

even if we replace LDFLAGS by LIBS in the patch the error still here.

comment:20 Changed 2 years ago by sda00@…

  • Status changed from new to closed
  • Resolution set to Fixed

o'k, things seems nice in general and passing "-lexecinfo" to CFLAGS is not a rocket science.

Vincent - HUGE THANKS!

closed/fixed :)

comment:21 Changed 3 months ago by sda00@…

  • Blocking 900 added
View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.