carp
carp copied to clipboard
compilation error on ubuntu 14.04
I am using my ubuntu 14.04 virtual machine to compile carp. The used compiler is gcc 4.8.2, I tried gcc 4.6 but got the same error:
cc -c -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security -static src/carp_instructions.c src/carp_lexer.c src/carp_machine.c src/carp_tokenizer.c src/lib/carp_stack.c src/lib/carp_ht.c
src/carp_instructions.c: In function ‘carp_instr_DBS’:
src/carp_instructions.c:144:15: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
char *key = (char *) carp_vm_next(m);
^
src/carp_instructions.c: In function ‘carp_instr_DBG’:
src/carp_instructions.c:153:15: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
char *key = (char *) carp_vm_next(m);
^
cc1: all warnings being treated as errors
make: *** [build] Error 1
So this is an issue with trying to store pointers to the keys/strings in the program array. You are more than welcome to submit a pull request with a fix, but I am not sure what the best way to fix is.
On Thu, Aug 14, 2014 at 12:23 AM, Khaled Diab [email protected] wrote:
I am using my ubuntu 14.04 virtual machine to compile carp. The used compiler is gcc 4.8.2, I tried gcc 4.6 but got the same error:
cc -c -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security -static src/carp_instructions.c src/carp_lexer.c src/carp_machine.c src/carp_tokenizer.c src/lib/carp_stack.c src/lib/carp_ht.c src/carp_instructions.c: In function ‘carp_instr_DBS’: src/carp_instructions.c:144:15: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] char key = (char *) carp_vm_next(m); ^ src/carp_instructions.c: In function ‘carp_instr_DBG’: src/carp_instructions.c:153:15: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] char *key = (char *) carp_vm_next(m); ^ cc1: all warnings being treated as errors make: ** [build] Error 1
— Reply to this email directly or view it on GitHub https://github.com/tekknolagi/carp/issues/19.
(I don't see an issue since I guess clang realizes that going from 8 bytes to 1 byte in this case involves no truncation? Maybe?)
On Thu, Aug 14, 2014 at 12:29 AM, Maxwell Bernstein [email protected] wrote:
So this is an issue with trying to store pointers to the keys/strings in the program array. You are more than welcome to submit a pull request with a fix, but I am not sure what the best way to fix is.
On Thu, Aug 14, 2014 at 12:23 AM, Khaled Diab [email protected] wrote:
I am using my ubuntu 14.04 virtual machine to compile carp. The used compiler is gcc 4.8.2, I tried gcc 4.6 but got the same error:
cc -c -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security -static src/carp_instructions.c src/carp_lexer.c src/carp_machine.c src/carp_tokenizer.c src/lib/carp_stack.c src/lib/carp_ht.c src/carp_instructions.c: In function ‘carp_instr_DBS’: src/carp_instructions.c:144:15: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] char key = (char *) carp_vm_next(m); ^ src/carp_instructions.c: In function ‘carp_instr_DBG’: src/carp_instructions.c:153:15: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] char *key = (char *) carp_vm_next(m); ^ cc1: all warnings being treated as errors make: ** [build] Error 1
— Reply to this email directly or view it on GitHub https://github.com/tekknolagi/carp/issues/19.
By the way this should be a warning but I happen to have the flag that treats warnings as errors on.
A quick fix is simply to remove that flag in the makefile. On Aug 14, 2014 12:23 AM, "Khaled Diab" [email protected] wrote:
I am using my ubuntu 14.04 virtual machine to compile carp. The used compiler is gcc 4.8.2, I tried gcc 4.6 but got the same error:
cc -c -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security -static src/carp_instructions.c src/carp_lexer.c src/carp_machine.c src/carp_tokenizer.c src/lib/carp_stack.c src/lib/carp_ht.c src/carp_instructions.c: In function ‘carp_instr_DBS’: src/carp_instructions.c:144:15: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] char key = (char *) carp_vm_next(m); ^ src/carp_instructions.c: In function ‘carp_instr_DBG’: src/carp_instructions.c:153:15: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] char *key = (char *) carp_vm_next(m); ^ cc1: all warnings being treated as errors make: ** [build] Error 1
— Reply to this email directly or view it on GitHub https://github.com/tekknolagi/carp/issues/19.
Yes, I see the flag. But we may need a "safer" solution. I will see this one.
btw, what are the supported platforms and compilers? roughly speaking ..
Do you have a safer solution? I would love to see it.
On Thu, Aug 14, 2014 at 9:56 AM, Maxwell Bernstein [email protected] wrote:
By the way this should be a warning but I happen to have the flag that treats warnings as errors on.
A quick fix is simply to remove that flag in the makefile. On Aug 14, 2014 12:23 AM, "Khaled Diab" [email protected] wrote:
I am using my ubuntu 14.04 virtual machine to compile carp. The used compiler is gcc 4.8.2, I tried gcc 4.6 but got the same error:
cc -c -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security -static src/carp_instructions.c src/carp_lexer.c src/carp_machine.c src/carp_tokenizer.c src/lib/carp_stack.c src/lib/carp_ht.c src/carp_instructions.c: In function ‘carp_instr_DBS’: src/carp_instructions.c:144:15: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] char key = (char *) carp_vm_next(m); ^ src/carp_instructions.c: In function ‘carp_instr_DBG’: src/carp_instructions.c:153:15: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] char *key = (char *) carp_vm_next(m); ^ cc1: all warnings being treated as errors make: ** [build] Error 1
— Reply to this email directly or view it on GitHub https://github.com/tekknolagi/carp/issues/19.
@khaledmdiab re: your errors — I am not seeing this on gcc 4.9 or clang. How odd!
@tekknolagi I can test compiling on gcc 4.9, and see how it goes.
For the safer solution, I still don't know it, but hopefully get one soon. Rather than removing the flag, do you have suggestions?
Sorry, wrong issue — thought I was fixing something else.
@akkartik any ideas? Perhaps a separate string db array?
Turns out I have a spare laptop with Trusty and gcc 4.8.2, but I see no errors on it. It's a 64-bit machine, and pointers have the same size as long ints. @khaledmdiab, can you share the output of uname -a
?
@tekknolagi, there's an error in your comment above. You're going from a long int to a pointer, not to a char. So on an architecture where long ints are 8 bytes but pointers are 4, there would be truncation.
Anyway, here's my output:
$ uname -a
Linux thinkpad 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ git log |head
commit 54f82711a0aa62602963f02b7e62654b87567566
Author: Max Bernstein <[email protected]>
Date: Sun Aug 24 10:05:32 2014 -0700
add << and >> operators on stack, fix string representation of 'and' in reverse_instr array
$ cc --version
cc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
$ make
cc -c -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security src/carp_registers.c src/carp_instructions.c src/carp_lexer.c src/carp_machine.c src/carp_tokenizer.c src/lib/carp_stack.c src/lib/carp_ht.c
# no warnings
ar cr libcarp.a *.o
...
Ah, correct. So there will be a warning on 32 bit systems?
On Sun, Aug 24, 2014 at 10:33 AM, Kartik Agaram [email protected] wrote:
Turns out I have a spare laptop with Trusty and gcc 4.8.2, but I see no errors on it. It's a 64-bit machine, and pointers have the same size as long ints. @khaledmdiab https://github.com/khaledmdiab, can you share the output of uname -a?
@tekknolagi https://github.com/tekknolagi, there's an error in your comment above. You're going from a long int to a pointer, not to a char. So on an architecture where long ints are 8 bytes but pointers are 4, there would be truncation.
Anyway, here's my output:
$ uname -a Linux thinkpad 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ cc --version cc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
$ make cc -c -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security src/carp_registers.c src/carp_instructions.c src/carp_lexer.c src/carp_machine.c src/carp_tokenizer.c src/lib/carp_stack.c src/lib/carp_ht.c
no warnings
ar cr libcarp.a *.o ...
— Reply to this email directly or view it on GitHub https://github.com/tekknolagi/carp/issues/19#issuecomment-53200652.
I don't have access to one, so I'm not sure. Were long int
s 8 bytes on 32-bit machines?
I'm unclear on what DBS
and DBG
do. I see them used in examples/c/data.c, but what is the expected result?
They are/were (not sure if I want them) for storing variables.
On Sun, Aug 24, 2014 at 10:42 AM, Kartik Agaram [email protected] wrote:
I'm unclear on what DBS and DBG do. I see them used in examples/c/data.c, but what is the expected result?
— Reply to this email directly or view it on GitHub https://github.com/tekknolagi/carp/issues/19#issuecomment-53200936.
Maybe rip them out (YAGNI) until you have a use case? :) Easy to bring back from history once you're sure what you want.
Gone :) On Aug 24, 2014 10:45 AM, "Kartik Agaram" [email protected] wrote:
Maybe rip them out (YAGNI) until you have a use case? :) Easy to bring back from history once you're sure what you want.
— Reply to this email directly or view it on GitHub https://github.com/tekknolagi/carp/issues/19#issuecomment-53201071.
@tekknolagi @akkartik it's a 32-bit vm ..
uname -a
Linux khaled-00 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:08:14 UTC 2014 i686 i686 i686 GNU/Linux
I tried it using both gcc 4.6.4 and 4.8.2
Thanks!
In any case, I have removed the problematic features (and I think pushed when I landed).
On Mon, Aug 25, 2014 at 2:15 AM, Kartik Agaram [email protected] wrote:
Thanks!
— Reply to this email directly or view it on GitHub https://github.com/tekknolagi/carp/issues/19#issuecomment-53230060.
Whoops, now it's up.
On Mon, Aug 25, 2014 at 9:50 PM, Maxwell Bernstein [email protected] wrote:
In any case, I have removed the problematic features (and I think pushed when I landed).
On Mon, Aug 25, 2014 at 2:15 AM, Kartik Agaram [email protected] wrote:
Thanks!
— Reply to this email directly or view it on GitHub https://github.com/tekknolagi/carp/issues/19#issuecomment-53230060.
it was successfully compiled. but fails in the "test" target. looks like "tests/libtap" directory is empty. is it normal? or I'm missing something.
Looks like you missed the instructions in the README.md — check that for help.
On Mon, Aug 25, 2014 at 10:28 PM, Khaled Diab [email protected] wrote:
it was successfully compiled. but fails in the "test" target. looks like "tests/libtap" directory is empty. is it normal? or I'm missing something.
— Reply to this email directly or view it on GitHub https://github.com/tekknolagi/carp/issues/19#issuecomment-53367528.
done .. I think we need to keep a complete list of platforms/operating systems/compilers at which carp supports.
Good idea. What seems to be the issue, other than your 32 bit warning?
Perhaps submit a PR to the readme file in the style that already exists. On Aug 25, 2014 11:11 PM, "Khaled Diab" [email protected] wrote:
done .. I think we need to keep a complete list of platforms/operating systems/compilers at which carp supports.
— Reply to this email directly or view it on GitHub https://github.com/tekknolagi/carp/issues/19#issuecomment-53370341.
I don't have additional warnings till now. but in future, who knows? :)
I use ubuntu 14.04.1 64bit virtual machine to compile carp.but still have the problem ,
asd@ubuntu:~/Desktop/tekknolagi-carp-a93c5cf$ make
cc -c -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security src/carp_registers.c src/carp_instructions.c src/carp_lexer.c src/carp_machine.c src/carp_tokenizer.c src/lib/carp_stack.c src/lib/carp_ht.c
ar cr libcarp.a .o
cc -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security src/carp.c libcarp.a -o carp.out
find . -name ".o"
-o -name "_.dSYM"
| xargs rm -rf
cd tests/libtap && make
make[1]: Entering directory /home/asd/Desktop/tekknolagi-carp-a93c5cf/tests/libtap' make[1]: *_\* No targets specified and no makefile found. Stop. make[1]: Leaving directory
/home/asd/Desktop/tekknolagi-carp-a93c5cf/tests/libtap'
make: *** [libtap] Error 2
Okay, so you appear not to be cloning the repository correctly; make sure to include the --recursive flags.
On Tue, Aug 26, 2014 at 10:08 PM, nikiyiyi [email protected] wrote:
I use ubuntu 14.04.1 64bit virtual machine to compile carp.but still have the problem ,
asd@ubuntu:~/Desktop/tekknolagi-carp-a93c5cf$ make cc -c -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security src/carp_registers.c src/carp_instructions.c src/carp_lexer.c src/carp_machine.c src/carp_tokenizer.c src/lib/carp_stack.c src/lib/carp_ht.c ar cr libcarp.a
.o cc -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security src/carp.c libcarp.a -o carp.out find . -name ".o"
-o -name "_.dSYM" \ | xargs rm -rf cd tests/libtap && make make[1]: Entering directory
/home/asd/Desktop/tekknolagi-carp-a93c5cf/tests/libtap' make[1]: *_\* No targets specified and no makefile found. Stop. make[1]: Leaving directory
/home/asd/Desktop/tekknolagi-carp-a93c5cf/tests/libtap' make: *** [libtap] Error 2— Reply to this email directly or view it on GitHub https://github.com/tekknolagi/carp/issues/19#issuecomment-53518646.
Is this working now?
Is this still valid in HEAD?