Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#61130 closed defect (fixed)

gcc8: jit/jit-result.c:52:3: error: 'dlclose' was not declared in this scope

Reported by: kencu (Ken) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: landonf (Landon Fuller), chrstphrchvz (Christopher Chavez), dsedivec, cooljeanius (Eric Gallager)
Port: gcc8

Description

The recent update to all the gcc versions to include jit code has broken the 32bit builds, at least on 10.6 where I live.

<https://build.macports.org/builders/ports-10.6_i386-builder/builds/16987/steps/install-port/logs/stdio>

The i386 build is broken, and the universal build is also broken.

I've pegged back my gcc version to the pre-jit version on suitable systems until this is sorted out.

I haven't tried the full gamut of all the gcc versions on all possible systems yet, as I don't have 102,000 days to devote to that project :>

/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-result.c:52:3: error: 'dlclose' was not declared in this scope
   dlclose (m_dso_handle);
   ^~~~~~~
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-result.c:52:3: note: suggested alternative: 'close'
   dlclose (m_dso_handle);
   ^~~~~~~
   close
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-result.c: In member function 'void* gcc::jit::result::get_code(const char*)':
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-result.c:78:3: error: 'dlerror' was not declared in this scope
   dlerror ();
   ^~~~~~~
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-result.c:78:3: note: suggested alternative: 'perror'
   dlerror ();
   ^~~~~~~
   perror
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-result.c:80:10: error: 'dlsym' was not declared in this scope
   code = dlsym (m_dso_handle, funcname);
          ^~~~~
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-result.c: In member function 'void* gcc::jit::result::get_global(const char*)':
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-result.c:105:3: error: 'dlerror' was not declared in this scope
   dlerror ();
   ^~~~~~~
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-result.c:105:3: note: suggested alternative: 'perror'
   dlerror ();
   ^~~~~~~
   perror
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-result.c:107:12: error: 'dlsym' was not declared in this scope
   global = dlsym (m_dso_handle, name);
            ^~~~~
make[3]: *** [jit/jit-result.o] Error 1
make[3]: *** Waiting for unfinished jobs....
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-playback.c: In member function 'gcc::jit::result* gcc::jit::playback::context::dlopen_built_dso()':
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-playback.c:2599:3: error: 'dlerror' was not declared in this scope
   dlerror ();
   ^~~~~~~
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-playback.c:2599:3: note: suggested alternative: 'error'
   dlerror ();
   ^~~~~~~
   error
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-playback.c:2602:6: error: 'RTLD_NOW' was not declared in this scope
      RTLD_NOW | RTLD_LOCAL);
      ^~~~~~~~
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-playback.c:2602:6: note: suggested alternative: 'CLD_NOOP'
      RTLD_NOW | RTLD_LOCAL);
      ^~~~~~~~
      CLD_NOOP
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-playback.c:2602:17: error: 'RTLD_LOCAL' was not declared in this scope
      RTLD_NOW | RTLD_LOCAL);
                 ^~~~~~~~~~
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-playback.c:2602:17: note: suggested alternative: 'TV_LOAD'
      RTLD_NOW | RTLD_LOCAL);
                 ^~~~~~~~~~
                 TV_LOAD
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-playback.c:2601:12: error: 'dlopen' was not declared in this scope
   handle = dlopen (m_tempdir->get_path_so_file (),
            ^~~~~~
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.4.0/gcc/jit/jit-playback.c:2601:12: note: suggested alternative: 'open'
   handle = dlopen (m_tempdir->get_path_so_file (),
            ^~~~~~
            open
make[3]: *** [jit/jit-playback.o] Error 1

Change History (12)

comment:1 Changed 4 years ago by kencu (Ken)

I understand the jit is mostly to support building some kind of lisp code compiler on to be used on emacs.

Hopefully this is isn't too hard to fix, with some missing header perhaps.

Last edited 3 years ago by kencu (Ken) (previous) (diff)

comment:2 Changed 4 years ago by kencu (Ken)

Cc: landonf added

comment:3 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

These functions are defined in dlfcn.h; is that being properly included in gcc/system.h, which in turn jit-result.c and jit-playback.c include?

comment:4 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Cc: chrstphrchvz added

comment:5 Changed 4 years ago by kencu (Ken)

include is being blocked somehow.

comment:6 Changed 4 years ago by kencu (Ken)

Thre is some information about building gcc with the jit here <https://gcc.gnu.org/onlinedocs/gcc-10.2.0/jit/internals/index.html>

Last edited 3 years ago by kencu (Ken) (previous) (diff)

comment:7 Changed 4 years ago by dsedivec

Cc: dsedivec added

comment:8 Changed 3 years ago by kencu (Ken)

In 4903d86c02b74efdb94c1f40c158233816a8cebe/macports-ports (master):

gcc8: disable jit on i386

see: #61130

comment:9 Changed 3 years ago by kencu (Ken)

so getting past the missing header was not hard:

--- gcc/jit/libgccjit.h.orig	2021-06-14 14:22:15.000000000 -0700
+++ gcc/jit/libgccjit.h	2021-06-14 14:22:49.000000000 -0700
@@ -22,6 +22,10 @@
 
 #include <stdio.h>
 
+#if defined (HAVE_DLFCN_H)
+#include <dlfcn.h>
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */

but that later led to this linkage failure anyway:

opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/./prev-gcc/xg++ -B/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/./prev-gcc/ -B/opt/local/i386-apple-darwin10/bin/ -nostdinc++ -B/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/prev-i386-apple-darwin10/libstdc++-v3/src/.libs -B/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/prev-i386-apple-darwin10/libstdc++-v3/libsupc++/.libs  -isystem /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/prev-i386-apple-darwin10/libstdc++-v3/include/i386-apple-darwin10  -isystem /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/prev-i386-apple-darwin10/libstdc++-v3/include  -isystem /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/libstdc++-v3/libsupc++ -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/prev-i386-apple-darwin10/libstdc++-v3/src/.libs -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/prev-i386-apple-darwin10/libstdc++-v3/libsupc++/.libs -fno-PIE -c  -DIN_GCC_FRONTEND -g -O2 -mdynamic-no-pic  -gtoggle -DIN_GCC -fPIC    -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -I. -I. -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/. -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../libcpp/include -I/opt/local/include -I/opt/local/include -I/opt/local/include  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../libdecnumber -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../libdecnumber/dpd -I../libdecnumber -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../libbacktrace -I/opt/local/include  -o cc1-checksum.o -MT cc1-checksum.o -MMD -MP -MF ./.deps/cc1-checksum.TPo cc1-checksum.c
cc1plus: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
ld: illegal text-relocation to attributes_table       in attribs.o from find_attribute_namespace(char const*) [clone .part.17] in attribs.o for architecture i386
collect2: error: ld returned 1 exit status
make[3]: *** [libgccjit.0.dylib] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build'
make: *** [bootstrap-lean] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build" && /usr/bin/make -j4 -w bootstrap-lean 

and of course that ld: illegal text-relocation is a common error on i386 32 bit systems, but it just indicates that -- pretty sure -- nobody has ever built this libjit component for i386 darwin, or at least not in a while.

comment:10 Changed 3 years ago by kencu (Ken)

Resolution: fixed
Status: newclosed

This is as fixed as I will do here. If upstream fixes the build of libgccjit on i386 gcc8 (don't hold your breath) then I'll move that fix back down here to the ports tree.

comment:11 Changed 3 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:12 Changed 3 years ago by cooljeanius (Eric Gallager)

Is there an upstream bug open about this?

Note: See TracTickets for help on using tickets.