我已经阅读了有关如何在Linux上安装Ndless SDK的here的信息,并且已经尽可能地关注,例如通过终端通过以下方式安装软件包:

sudo apt-get install [package]

一切顺利,直到到达根“make”命令为止。我按照指示进行操作,在〜/Ndless中,然后在终端中运行“make”。每次尝试执行此操作都会收到此错误:
make -C ndless-sdk
make[1]: Entering directory '/home/pi/Ndless/ndless-sdk'
make -C libsyscalls
make[2]: Entering directory '/home/pi/Ndless/ndless-sdk/libsyscalls'
arm-none-eabi-gcc -mcpu=arm926ej-s -std=c11 -nostdlib -O3 -fPIE -mlong-calls -Wall -Werror -I ../include/ -I ../thirdparty/nspire-io/include/ -D_TINSPIRE -ffunction-sections -fdata-sections -c realpath.c -o realpath.o
realpath.c: In function 'realpath1':
realpath.c:50:12: error: 'PATH_MAX' undeclared (first use in this function)
  char left[PATH_MAX], next_token[PATH_MAX];
            ^
realpath.c:50:12: note: each undeclared identifier is reported only once for each function it appears in
realpath.c:50:23: error: unused variable 'next_token' [-Werror=unused-variable]
  char left[PATH_MAX], next_token[PATH_MAX];
                       ^
realpath.c:50:7: error: unused variable 'left' [-Werror=unused-variable]
  char left[PATH_MAX], next_token[PATH_MAX];
       ^
realpath.c: In function 'realpath':
realpath.c:159:25: error: 'PATH_MAX' undeclared (first use in this function)
   m = resolved = malloc(PATH_MAX);
                         ^
cc1: all warnings being treated as errors
Makefile:21: recipe for target 'realpath.o' failed
make[2]: *** [realpath.o] Error 1
make[2]: Leaving directory '/home/pi/Ndless/ndless-sdk/libsyscalls'
Makefile:14: recipe for target 'build-libsyscalls' failed
make[1]: *** [build-libsyscalls] Error 2
make[1]: Leaving directory '/home/pi/Ndless/ndless-sdk'
Makefile:19: recipe for target 'build-ndless-sdk' failed
make: *** [build-ndless-sdk] Error 2

另外,我在主目录中创建了.bash_profile,并将其添加到其中,如指导所示:
export PATH="/home/pi/Ndless/ndless-sdk/toolchain/install/bin:/home/pi/Ndless/ndless-sdk/bin:${PATH}"

当指示将 PATH环境变量显示为粗体时,我进入了网络,发现.bashrc是PATH,因此我在上面添加了相同的代码。

最后编辑

https://pastebin.com/C7rWJp5Y
make[4]: Entering directory '/home/pi/Ndless/ndless/src/tools/MakeSyscalls'
php ./mkSyscalls.php "idc" "../../../../ndless-sdk/include/syscall-addrs.h"
/bin/sh: 1: php: not found
Makefile:9: recipe for target '../../../../ndless-sdk/include/syscall-addrs.h' failed
make[4]: *** [../../../../ndless-sdk/include/syscall-addrs.h] Error 127
make[4]: Leaving directory '/home/pi/Ndless/ndless/src/tools/MakeSyscalls'
Makefile:10: recipe for target 'build-MakeSyscalls' failed
make[3]: *** [build-MakeSyscalls] Error 2
make[3]: Leaving directory '/home/pi/Ndless/ndless/src/tools'
Makefile:9: recipe for target 'build-tools' failed
make[2]: *** [build-tools] Error 2
make[2]: Leaving directory '/home/pi/Ndless/ndless/src'
Makefile:9: recipe for target 'build-src' failed
make[1]: *** [build-src] Error 2
make[1]: Leaving directory '/home/pi/Ndless/ndless'
Makefile:19: recipe for target 'build-ndless' failed
make: *** [build-ndless] Error 2

最佳答案

在下面的用于更改目录的命令中,只要在字符串用户出现字符串的任何地方,只需在Linux中将其替换为您的用户名即可。

更新apt-get



安装套件



将Ndless克隆到家中



运行build_toolchain



Ndless命令路径



Ndless Makefile



所有这一切都将花费很长时间(对我来说需要5个小时),具体取决于您的硬件以及可能的互联网连接。

笔记

当Makefile在终端中完成时,您可以尝试编译此示例程序,以查看安装程序是否完美(将其命名为test.cpp):

#include <libndls.h>
#include <SDL/SDL.h>
#include <SDL/SDL_config.h>

int main() {
    SDL_Surface *screen;
    nSDL_Font *font;
    SDL_Init(SDL_INIT_VIDEO);
    screen = SDL_SetVideoMode(320, 240, has_colors ? 16 : 8, SDL_SWSURFACE);
    font = nSDL_LoadFont(NSDL_FONT_TINYTYPE, 29, 43, 61);

    SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 255, 0, 0));
    nSDL_DrawString(screen, font, 10, 10, "Hello, world! \x1");

    SDL_Flip(screen); // update screen
    SDL_Delay(3000); // wait for 3 seconds

    SDL_Quit(); // get out of SDL screen, returns to normal nspire
    return 0;
}

然后进行编译,在终端中导航到新创建的test.cpp的目录,然后输入:
nspire-tools new test.cpp

然后运行:
make

如果编译成功,则终端输出应如下所示:



您也可以尝试在安装了Ndless的Firebird Emulator中运行它!

如果您跳过并决定在未完全完成./build_toolchain命令的情况下运行make(可能是由于错误而导致),则make命令失败时请不要感到惊讶。失败的输出将是关于



但是,如果您安装了所有必需的软件包,并且成功地完全构建了命令,则Ndless应该可以毫无问题地进行编译和运行。

08-27 04:41