私はカスタム共有オブジェクトにアクセスしようとしましたが、権限が拒否されました。

私はカスタム共有オブジェクトにアクセスしようとしましたが、権限が拒否されました。

g++を使用してデフォルトのC ++共有オブジェクトファイルを作成しました。

// calculate.hpp
#ifdef __cplusplus
extern "C"
{
#endif

  // typedef struct ...;
  // function decls
  int Add(int x, int y);

#ifdef __cplusplus
}
#endif

以下を実装する C++ ファイルを使用します。

// calculate.cpp    
#include <iostream>
#include "calculate.hpp"
    
int Add(int x, int y) {
    return x + y; 
}

私は基本的に次のように共有ライブラリを作成しました。

g++ -fPIC -shared calculate.cpp -o calculate.so

私のC#アプリケーションはLinuxシステムで完全に動作します。

// sandbox.cs
using System.Runtime.InteropServices;

namespace sandbox;

class Program
{
    // (changed the directory due to privacy stuff)
    [DllImport("/.../shared-objects/calculate/libcalculate.so")]
    static extern int Add(int x, int y);

    static void Main(string[] args)
    {
        int result = Add(15, 20);
        Console.WriteLine($"Result of so is: {result}");
    }
}

ただし、Tizenアプリケーションパッケージ(TV用C#アプリケーション)を介してスマートTV経由で実行しようとすると、次の結果が表示されます。

System.DllNotFoundException: Unable to load shared library '/home/guest/libtest/libcalculate.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: /home/guest/libtest/libcalculate.so: cannot open shared object file: Permission denied

ご覧のとおり、/home/guest/には.soファイルがありますが、/lib/、/opt/data、/home/など、他の場所でもテストしました。私が考えることができるどこでも。まだ同じ例外:権限が拒否されました。

また、chmod(現在の-rwxrwxrwx)を介してファイルを変更し、/usrと/usr/libのls -ldの両方が機能していることを確認しましたが、権限はまだ拒否されました。今の問題は、これが実際にアクセス関連の問題であるのか、それともテレビでアプリバンドルがどのように処理されるのかということです。

ベストアンサー1

おすすめ記事