dschmenk / PLASMA

Proto Language AsSeMbler for All (formerly Apple)
MIT License
189 stars 26 forks source link

OSX make error #15

Closed dmolony closed 7 years ago

dmolony commented 7 years ago

After following the instructions I get:

MBP3:~/plasma/src/PLASMA/src $ make cc -c -o toolsrc/parse.o toolsrc/parse.c cc -c -o toolsrc/lex.o toolsrc/lex.c cc -c -o toolsrc/codegen.o toolsrc/codegen.c toolsrc/codegen.c:470:24: error: use of undeclared identifier 'uintptr_t' str = (char *)(uintptr_t)constval; ^ 1 error generated. make: *** [toolsrc/codegen.o] Error 1

peterferrie commented 7 years ago

After following the instructions I get:

MBP3:~/plasma/src/PLASMA/src $ make cc -c -o toolsrc/parse.o toolsrc/parse.c cc -c -o toolsrc/lex.o toolsrc/lex.c cc -c -o toolsrc/codegen.o toolsrc/codegen.c toolsrc/codegen.c:470:24: error: use of undeclared identifier 'uintptr_t' str = (char *)(uintptr_t)constval; ^ 1 error generated. make: *** [toolsrc/codegen.o] Error 1

What version of the compiler are you using? uintptr_t is very important to compile correctly on 64-bit platforms. I suppose that we can typedef it into something if it doesn't exist...

dmolony commented 7 years ago

Hi Peter

It's a standard Sierra mac (without homebrew at the moment)

MBP3:~/plasma/src/PLASMA/src $ cc --version Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin16.3.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Does that help?

Denis

On 22 Jan 2017, at 4:25 pm, Peter Ferrie notifications@github.com wrote:

After following the instructions I get:

MBP3:~/plasma/src/PLASMA/src $ make cc -c -o toolsrc/parse.o toolsrc/parse.c cc -c -o toolsrc/lex.o toolsrc/lex.c cc -c -o toolsrc/codegen.o toolsrc/codegen.c toolsrc/codegen.c:470:24: error: use of undeclared identifier 'uintptr_t' str = (char *)(uintptr_t)constval; ^ 1 error generated. make: *** [toolsrc/codegen.o] Error 1

What version of the compiler are you using? uintptr_t is very important to compile correctly on 64-bit platforms. I suppose that we can typedef it into something if it doesn't exist... — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dschmenk/PLASMA/issues/15#issuecomment-274310114, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1B8GE8dK6UB34RL9sEEw-c6lBxpcyVks5rUuhVgaJpZM4LqRpc.

dschmenk commented 7 years ago

I'm unclear as to what uintptr_t is supposed to improve. It fails on FreeBSD 11 x86_64, which also uses clang like OS X. It also fails on Ubuntu x86_64 16.04

lifepillar commented 7 years ago

@dmolony brew install lifepillar/appleii/plasma uses the latest revision that builds correctly in macOS Sierra (a5215e330905e8ecc026dcddcb5afb24b54f4efa), so you may use that for now. Note that brew install lifepillar/appleii/plasma --HEAD builds the current master instead, so at this time that is broken because of this issue.

peterferrie commented 7 years ago

I'm unclear as to what uintptr_t is supposed to improve.

uintptr_t is an unsigned int that is capable of storing a pointer. The code is casting from a long to a pointer, which can result in data loss on some platforms. The cast is used to convert the value safely.

peterferrie commented 7 years ago

Hi Denis,

It's a standard Sierra mac (without homebrew at the moment)

MBP3:~/plasma/src/PLASMA/src $ cc --version Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin16.3.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Does that help?

Yes, please sync and try again. I've added a reference to the header file where it should be defined for your system.

dschmenk commented 7 years ago

I'm unclear as to what uintptr_t is supposed to improve. uintptr_t is an unsigned int that is capable of storing a pointer. The code is casting from a long to a pointer, which can result in data loss on some platforms. The cast is used to convert the value safely.

Except that the original value is a long, so by casting through an intermediate uintptr_t to something like a (char *) is just being pedantic. The proper way to fix is to make the original value a uintptr_t instead of a long so as to not lose precision.

dmolony commented 7 years ago

Hi

I deleted the PLASMA folder and did the clone step again. The result of 'make' is:

Regards

Denis

On 23 Jan 2017, at 6:30 am, David Schmenk notifications@github.com wrote:

I'm unclear as to what uintptr_t is supposed to improve. uintptr_t is an unsigned int that is capable of storing a pointer. The code is casting from a long to a pointer, which can result in data loss on some platforms. The cast is used to convert the value safely.

Except that the original value is a long, so by casting through an intermediate uintptr_t to something like a (char *) is just being pedantic. The proper way to fix is to make the original value a uintptr_t instead of a long so as to not lose precision.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dschmenk/PLASMA/issues/15#issuecomment-274353012, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1B8P0Gp0syj9eO1ysQlZez4HmT5tIyks5rU65mgaJpZM4LqRpc.

dschmenk commented 7 years ago

Peter, are you going to fix these nonsense casts:

    str = (char *)(uintptr_t)constval;
peterferrie commented 7 years ago

Peter, are you going to fix these nonsense casts:

str = (char *)(uintptr_t)constval;

Yes, when I have time. If you get to it first, then go ahead.