1

firefox 12 SDK で「Proxy」オブジェクトが削除されたため、nsRunnableを使用してクロススレッド呼び出しを使用したいと考えました。私は基本的にコードのコピーアンドペーストを行いました:

class NotifyTask : public nsRunnable
{
public:
  NotifyTask(nsISupports *subject, const char *topic, bool remref)
    : mWorkerThread(do_GetCurrentThread())
  {
    MOZ_ASSERT(!NS_IsMainThread()); // This should be running on the worker thread
  }

  NS_IMETHOD Run() {
    MOZ_ASSERT(NS_IsMainThread()); // This method is supposed to run on the main thread!

    mWorkerThread->Shutdown();
    return NS_OK;
  }

private:
  nsCOMPtr<nsIThread> mWorkerThread;
};

で、まとめてみました。次のエラーが発生しました:

g++ -std=gnu++0x -Wall -O2 -c  -DUSE_LIBUSB -fPIC -DHAVE_CRYPTO -fpermissive -DCRYPTPP -fshort-wchar -I../../xulrunner-sdk/include -o gipsy.o gipsy.cpp
gipsy.cpp:74:7: warning: ‘NotifyTask’ declared with greater visibility than the type of its field ‘NotifyTask::<anonymous>’ [-Wattributes]
gipsy.cpp:74:7: warning: ‘NotifyTask’ declared with greater visibility than its base ‘nsRunnable’ [-Wattributes]
g++ -std=gnu++0x -Wl,-z,defs -Wall -Os -o gipsy.so -shared gipsy.o gipsymodule.o tracklog.o gpslib/data.o gpslib/garmin.o gpslib/gps.o gpslib/phys.o gpslib/igc.o gpslib/aircotec.o cp1250.o prefparser.o gpslib/foreignigc.o gpslib/mlr.o gpslib/flymaster.o gpslib/compeo.o gpslib/iq.o ../libs/libcryptopp.a -lusb -L../../xulrunner-sdk/lib -lxpcomglue_s -lxul -lxpcom -lplds4 -lplc4 -lnspr4 -lpthread -ldl -lmozalloc
gipsy.o:(.data.rel.ro._ZTI10NotifyTask[typeinfo for NotifyTask]+0x10): undefined reference to `typeinfo for nsRunnable'
collect2: ld returned 1 exit status

g++ undefined reference to typeinfoによると、gecko sdk が -fvisibility=hidden といくつかの奇妙な「key method in different .so」でビルドされた可能性があります。これは Gecko SDK のエラーですか、それとも何か間違っていますか?

4

1 に答える 1

1

gecko SDK は RTTI とリンクしていません。特定の .o ファイルに「-fno-rtti」パラメータを追加すると、問題が修正されました。

于 2012-05-17T16:28:54.343 に答える