Почему компоновщик не смог найти tcl / tk? - PullRequest
0 голосов
/ 16 апреля 2019

Я тестирую официальный tcl / tk образец на d языке , но на этапе компоновки он не выполняется.Я на Linux Mint 19 Cinamon 64bit , и я установил по крайней мере

  • libtcl8.6
  • libtk8.6

Кроме того, я использую DUB версии 1.14.0 , созданную 5 апреля 2019 года

Я перешел на страницу привязки tk и выполнил шаги для Linux: страница привязки :

  1. установка библиотек tck / tk 8.6
  2. использование примера кода
...

class Application : TkdApplication                       // Extend TkdApplication.
{
    private void exitCommand(CommandArgs args)           // Create a callback.
    {
        this.exit();                                     // Exit the application.
    }

    override protected void initInterface()              // Initialise user interface.
    {
        auto frame = new Frame(2, ReliefStyle.groove)    // Create a frame.
            .pack(10);                                   // Place the frame.

        auto label = new Label(frame, "Hello World!")    // Create a label.
            .pack(10);                                   // Place the label.

        auto exitButton = new Button(frame, "Exit")      // Create a button.
            .setCommand(&this.exitCommand)               // Use the callback.
            .pack(10);                                   // Place the button.
    }
}

...

Вывод компиляции

$ dub
Performing "debug" build using /usr/bin/dmd for x86_64.
x11 1.0.21: target for configuration "tcltk-import" is up to date.
tcltk 8.6.5: target for configuration "library" is up to date.
tkd 1.1.10: target for configuration "library" is up to date.
hello-user ~master: building configuration "application"...
Linking...
/usr/bin/ld : ne peut trouver -ltcl
/usr/bin/ld : ne peut trouver -ltk
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
/usr/bin/dmd failed with exit code 1.

Где ' ne peut Trouver ' означает " Не удалось найти ".

Это мой dub.json

{
    "authors": [
        "laurent bernabe"
    ],
    "copyright": "Copyleft 2019, Laurent Bernabe",
    "description": "Simple user greeting",
    "license": "MIT",
    "name": "hello-user",
    "dependencies": {
        "tkd": "~>1.1.10"
    },
    "postGenerateCommands-windows-x86": [
        "copy $TCLTK_PACKAGE_DIR\\dist\\x86\\tcl86t.dll build\\tcl86t.dll /y",
        "copy $TCLTK_PACKAGE_DIR\\dist\\x86\\tk86t.dll build\\tk86t.dll /y",
        "xcopy $TCLTK_PACKAGE_DIR\\dist\\library build\\library /i /e /y"
    ],
    "postGenerateCommands-windows-x86_64": [
        "copy $TCLTK_PACKAGE_DIR\\dist\\x86_64\\tcl86t.dll build\\tcl86t.dll /y",
        "copy $TCLTK_PACKAGE_DIR\\dist\\x86_64\\tk86t.dll build\\tk86t.dll /y",
        "xcopy $TCLTK_PACKAGE_DIR\\dist\\library build\\library /i /e /y"
    ]
}

Тем временем ятолько что обнаружили, что и libtcl8.6.a, и libtk8.6.a находятся в / usr / lib / x86_64-linux-gnu.Я пытался установить

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu

, но это не сработало.

1 Ответ

0 голосов
/ 16 апреля 2019

Наконец-то мне удалось !!!

Я создал несколько программных ссылок:

sudo ln -s /usr/lib/x86_64-linux-gnu/libtcl8.6.a /usr/lib/libtcl.a
sudo ln -s /usr/lib/x86_64-linux-gnu/libtk8.6.a /usr/lib/libtk.a
sudo ln -s /usr/lib/x86_64-linux-gnu/libtcl8.6.so /usr/lib/libtcl.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libtk8.6.so /usr/lib/libtk.so

Так что бегущая dub успешно компилируется.

...