kanaka / mal

mal - Make a Lisp
Other
10.07k stars 2.55k forks source link

Problem Running Tests with Readline Library in C #593

Closed rohan-mehta-1024 closed 3 years ago

rohan-mehta-1024 commented 3 years ago

Hello I am having an issue trying to run the first test (my implementation is in C). I have created the following makefile which works when I run "make" in the directory of my implementation:

program: step0_repl.c gcc -ledit step0_repl.c

But when I try to run the first test, it gives this error (there is some problem with the readline library?):

/Applications/Xcode.app/Contents/Developer/usr/bin/make -C impls/c step0_repl cc step0_repl.c -o step0_repl Undefined symbols for architecture x86_64: "_readline", referenced from: _main in step0_repl-dcb634.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [step0_repl] Error 1 make: [impls/c/step0_repl] Error 2

I am very new to C and so don't understand what's going on. Apologies if this is an obvious question.

dubek commented 3 years ago

Hi @rohan-mehta-1024 , try adding -lreadline as another argument to your cc line.

rohan-mehta-1024 commented 3 years ago

Hello @dubek, unfortunately this returns the same error message. Also, that cc line is what is run internally by the "text^quux^step0_repl" command - is there any way for me to get it to work by just running this command with some other argument? The thing I find confusing is when I just run make in the implementation directory, it compiles fine, but it's not able to compile when I try to run the tests.

rohan-mehta-1024 commented 3 years ago

Actually, now if I compile it first by running make in the implementation directory and then trying to run make "text^quux^step0_repl" at the top level, I get this error:

/Applications/Xcode.app/Contents/Developer/usr/bin/make -C impls/c step0_repl make[1]: `step0_repl' is up to date. (call STEP_TEST_FILES,c,step0): impls/tests/step0_repl.mal

Testing test^c^step0; step file: impls/c/step0_repl, test file: tests/step0_repl.mal Running: env STEP=step0_repl MAL_IMPL=js ../../runtest.py --deferrable --optional ../tests/step0_repl.mal -- ../c/run Traceback (most recent call last): File "../../runtest.py", line 230, in r = Runner(args.mal_cmd, no_pty=args.no_pty, line_break="\r\n" if args.crlf else "\n") File "../../runtest.py", line 105, in init env=env) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 394, in init errread, errwrite) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1047, in _execute_child raise child_exception OSError: [Errno 13] Permission denied make: *** [test^c^step0] Error 1

Any ideas?

rohan-mehta-1024 commented 3 years ago

I have since fixed the issue, thanks! (I had to add executable permissions to my run script?)