Closed Bug 712433 Opened 13 years ago Closed 6 years ago

pyloader.cpp no longer builds

Categories

(Other Applications Graveyard :: PyXPCOM, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: simon, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:9.0) Gecko/20100101 Firefox/9.0
Build ID: 20111212185108

Steps to reproduce:

Bug 695843 introduced a FileLocation interface in order to speed up startup on Android. However, this interface includes nsString.h, without making allowances for code that does not have MOZILLA_INTERNAL_API defined. More importantly, the symbols for FileLocation aren't part of XPCOM glue. As far as I can tell, without some modifications to the core, it's no longer possible to build PyXPCOM (or any custom module loader).
Blocks: 695843
The pyxpcom build error on Linux:

c++ -o pyloader.o -c -I../../../dist/system_wrappers -include ../../../../config/gcc_hidden.h -DOSTYPE=\"Linux3.0\" -DOSARCH=Linux -DMOZ_NO_MOZALLOC -I/volatile/src/mozilla/pythonext/build/py_install/include/python2.6 -I../../../../xpcom/src/loader -I. -I../../../dist/include -I../../../dist/include/nsprpub -I/volatile/src/mozilla/pythonext/build/xulrunner-sdk/include -I/volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/nsprpub `/volatile/src/mozilla/pythonext/build/xulrunner-sdk/sdk/bin/nspr-config --prefix=/volatile/src/mozilla/pythonext/build/xulrunner-sdk --includedir=/volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/nspr --cflags`          -fPIC   -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-long-long -pedantic -fno-strict-aliasing -pipe -std=gnu++0x  -DNDEBUG -DTRIMMED -Os -freorder-blocks -fno-reorder-functions  -g   -DMOZILLA_CLIENT -include /volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/mozilla-config.h -Wp,-MD,.deps/pyloader.pp ../../../../xpcom/src/loader/pyloader.cpp
In file included from /volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/nsAString.h:43:0,
                 from /volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/nsSubstring.h:40,
                 from /volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/nsString.h:44,
                 from /volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/mozilla/FileLocation.h:41,
                 from /volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/mozilla/ModuleLoader.h:44,
                 from ../../../../xpcom/src/loader/pyloader.h:45,
                 from ../../../../xpcom/src/loader/pyloader.cpp:56:
/volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/nsStringFwd.h:49:2: error: #error Internal string headers are not available from external-linkage code.
In file included from /volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/nsAString.h:64:0,
                 from /volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/nsSubstring.h:40,
                 from /volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/nsString.h:44,
                 from /volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/mozilla/FileLocation.h:41,
                 from /volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/mozilla/ModuleLoader.h:44,
                 from ../../../../xpcom/src/loader/pyloader.h:45,
                 from ../../../../xpcom/src/loader/pyloader.cpp:56:
/volatile/src/mozilla/pythonext/build/xulrunner-sdk/include/nsTSubstring.h:40:2: error: #error Cannot use internal string classes without MOZILLA_INTERNAL_API defined. Use the frozen header nsStringAPI.h instead.
...
Status: UNCONFIRMED → NEW
Ever confirmed: true
@glandium - do you have some ideas on how to get this working?
After tweaking FileLocation to use nsStringAPI.h, the error from Simon's second point (FileLocation not being available in xpcom_glue) is as such:

pyloader.o: In function `nsPythonModuleLoader::LoadModule(mozilla::FileLocation&)':
/volatile/src/mozilla/pythonext/build/pyxpcom/obj_pyxpcom/xpcom/src/loader/../../../../xpcom/src/loader/pyloader.cpp:115: undefined reference to `mozilla::FileLocation::GetBaseFile()'
/usr/bin/ld: libpyloader.so: hidden symbol `mozilla::FileLocation::GetBaseFile()' isn't defined
I've a tree at home that gets... further.  It involved using nsStringGlue.h instead of nsString.h in FileLocation.h; but that isn't quite enough since mozilla::FileLocation::GetBaseFile() isn't available outside of libxul.  (The temporary hack I had was to reinterpret_cast a FileLocation* to a nsILocalFile**, but obviously that's not really useful for checkin purposes...)

There were, I believe, also issues stemming from the changes in bug 683802; I haven't gotten through those yet.
already_AddRefed<nsILocalFile>
FileLocation::GetBaseFile()
{
  if (IsZip() && mBaseZip) {
    nsRefPtr<nsZipHandle> handler = mBaseZip->GetFD();
    if (handler)
      return handler->mFile.GetBaseFile();
    return NULL;
  }

  nsCOMPtr<nsILocalFile> file = mBaseFile;
  return file.forget();
}
Just in the interest of getting to pyXPCOM to work, the above definition of GetBaseFile only extends the unresolved problem into requiring nsZipHandle::GetFD() and the implied use of nsZipHandle::AddRef and nsZipHandle::Release

For the unwilling to wait and willing to egregiously hack, it does build (and appears to work in XULRunner 11.0 at least) if one simply fails on an FileLocation::IsZip()==true.
Component is obsolete so resolving bugs as INCOMPLETE[B
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INCOMPLETE
Product: Other Applications → Other Applications Graveyard
You need to log in before you can comment on or make changes to this bug.