Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on Make #5

Open
mateidragony opened this issue Mar 12, 2024 · 1 comment
Open

Error on Make #5

mateidragony opened this issue Mar 12, 2024 · 1 comment

Comments

@mateidragony
Copy link

I get a few errors when I call make:

Building CXX object CMakeFiles/riscv_vm.dir/riscv_vm/syscall.cpp.o syscall.cpp: In function ‘void syscall_write(riscv_t*)’:

syscall.cpp:97:29: error: ‘alloca’ was not declared in this scope 97 | uint8_t *temp = (uint8_t*)alloca(count);

syscall.cpp:231:29: error: ‘alloca’ was not declared in this scope 231 | uint8_t *temp = (uint8_t*)alloca(count); | ^~~~~~ make[2]: *** [CMakeFiles/riscv_vm.dir/build.make:104: CMakeFiles/riscv_vm.dir/riscv_vm/syscall.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:196: CMakeFiles/riscv_vm.dir/all] Error 2 make: *** [Makefile:91: all] Error 2

@ALexei-Stukov
Copy link

ALexei-Stukov commented Jul 16, 2024

I got the same problem and I had solved it.
use

man alloca

you will know the alloca comes from <alloca.h>

so just add this code in syscall.cpp:

#include <cstdint>
#include <cstdio>
#include <ctime>

#include "../riscv_core/riscv.h"
#include "state.h"

#include <alloca.h>    // Add this line

enum {
 SYS_getcwd = 17,

then you will make successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants