Bug 153138

Summary: [GTK][OSX] libjavascriptcoregtk fails to link when building debug configuration
Product: WebKit Reporter: Jeremy Huddleston Sequoia <jeremyhu>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, pnormand
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Mac   
OS: OS X 10.11   
See Also: https://trac.macports.org/ticket/50340
Bug Depends on:    
Bug Blocks: 126492    
Attachments:
Description Flags
build log none

Description Jeremy Huddleston Sequoia 2016-01-15 11:25:11 PST
Created attachment 269072 [details]
build log

After addressing previous build issues, webkit-gtk 2.11.3 succeeds in building the release configuration.  When building the debug configuration, it fails when linking libjavascriptcoregtk:

Undefined symbols for architecture x86_64:
  "JSC::JSCell::inherits(JSC::ClassInfo const*) const", referenced from:
      JSC::WriteBarrierBase<JSC::Structure>::set(JSC::VM&, JSC::JSCell const*, JSC::Structure*) in StructureStubInfo.cpp.o
  "JSC::JSCell::structure() const", referenced from:
      JSC::WriteBarrierBase<JSC::Structure>::set(JSC::VM&, JSC::JSCell const*, JSC::Structure*) in StructureStubInfo.cpp.o

webkit-gtk was configured as:

cmake -DCMAKE_INSTALL_PREFIX=/opt/local -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH=/opt/local/lib -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_MODULE_PATH=/opt/local/share/cmake/Modules -DCMAKE_FIND_FRAMEWORK=LAST -Wno-dev -DPORT=GTK -DENABLE_X11_TARGET=ON -DENABLE_QUARTZ_TARGET=OFF -DENABLE_INTROSPECTION=OFF -DENABLE_OPENGL=OFF -DLLVM_CONFIG_EXE=/opt/local/bin/llvm-config-mp-3.7 -DENABLE_VIDEO=ON -DENABLE_PLUGIN_PROCESS_GTK2=ON -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.11" -DCMAKE_OSX_SYSROOT="/" /opt/local/var/macports/build/_Volumes_MiniHD_opt_macports_users_devans_GNOME-3_stable_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.3'
Comment 1 Jeremy Huddleston Sequoia 2016-01-15 11:38:31 PST
Looks like it's supposed to be from runtime/JSCellInlines.h

inline bool JSCell::inherits(const ClassInfo* info) const
{
    return classInfo()->isSubClassOf(info);
}
...
inline Structure* JSCell::structure() const
{
    return Heap::heap(this)->structureIDTable().get(m_structureID);
}
Comment 2 Jeremy Huddleston Sequoia 2016-01-15 11:52:18 PST
I suspect this is from one of the various ASSERT()s in some header.  I didn't track down where it was, but adding '#include "JSCellInlines.h"' to StructureStubInfo.cpp.o allows me to work around this issue.  That's obviously not the appropriate fix.  The include should be done in the appropriate header that is consuming those methods.
Comment 3 Jeremy Huddleston Sequoia 2016-01-31 17:01:07 PST
Ah, I think it is coming from this in WriteBarrier.h:

template<class T> inline void validateCell(T cell)
{
    ASSERT_GC_OBJECT_INHERITS(cell, std::remove_pointer<T>::type::info());
}

by way of WriteBarrierInlines.h:

inline void WriteBarrierBase<T>::set(VM& vm, const JSCell* owner, T* value)
{
    ASSERT(value);
    ASSERT(!Options::useConcurrentJIT() || !isCompilationThread());
    validateCell(value);
    setEarlyValue(vm, owner, value);
}

Testing a fix.
Comment 4 Jeremy Huddleston Sequoia 2016-01-31 20:19:21 PST
Dang.  Messy layering issues...

Including JSCellInlines.h in WriteBarrier.h results in:

In file included from /opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.4/Source/JavaScriptCore/runtime/WriteBarrier.h:33:
In file included from /opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.4/Source/JavaScriptCore/runtime/JSCellInlines.h:33:
In file included from /opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.4/Source/JavaScriptCore/runtime/JSDestructibleObject.h:4:
In file included from /opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.4/Source/JavaScriptCore/runtime/JSObject.h:28:
In file included from /opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.4/Source/JavaScriptCore/runtime/ArrayStorage.h:30:
/opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.4/Source/JavaScriptCore/runtime/Butterfly.h:73:24: error: no template named 'WriteBarrier'; did you mean 'JITWriteBarrier'?
typedef ContiguousData<WriteBarrier<Unknown>> ContiguousJSValues;
                       ^~~~~~~~~~~~
                       JITWriteBarrier

Including JSCellInlines.h in WriteBarrierInlines.h results in:

In file included from /opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.4/Source/JavaScriptCore/runtime/WriteBarrierInlines.h:31:
In file included from /opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.4/Source/JavaScriptCore/runtime/JSCellInlines.h:33:
In file included from /opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.4/Source/JavaScriptCore/runtime/JSDestructibleObject.h:4:
In file included from /opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.4/Source/JavaScriptCore/runtime/JSObject.h:34:
/opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.4/Source/JavaScriptCore/runtime/CustomGetterSetter.h:56:16: error: incomplete type 'JSC::Structure' named in nested name specifier
        return Structure::create(vm, globalObject, prototype, TypeInfo(CustomGetterSetterType, StructureFlags), info());
               ^~~~~~~~~~~
/opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_www_webkit2-gtk/webkit2-gtk/work/webkitgtk-2.11.4/Source/JavaScriptCore/runtime/JSCJSValue.h:55:7: note: forward declaration of 'JSC::Structure'
class Structure;
      ^
Comment 5 Jeremy Huddleston Sequoia 2016-11-06 01:36:55 PST
This is no loner an issue in 2.15.1