koka-lang / libhandler

Libhandler implements algebraic effects and handlers in portable C99. Monads for free in C.
Other
187 stars 15 forks source link

compilation error on mac os #8

Closed shazqadeer closed 5 years ago

shazqadeer commented 5 years ago

I am getting the following error when compiling on Mac OS.

build variant: debug, configuration: gcc-amd64-apple-darwin18.2.0 src/exception.c:11:10: fatal error: 'malloc.h' file not found

include

     ^~~~~~~~~~

1 error generated. make[3]: [depend] Error 1 make[2]: [Prt/CMakeFiles/libhandler] Error 2 make[1]: [Prt/CMakeFiles/libhandler.dir/all] Error 2 make: [all] Error 2

System Version: macOS 10.14.1 (18B75) Kernel Version: Darwin 18.2.0

I think the problem is that on my computer malloc.h is in the malloc folder. If I change that offending line to

include <malloc/malloc.h>

the error goes away.

shazqadeer commented 5 years ago

Another option is to use stdlib.h. It looks like malloc.h is not standard on Mac OS.

https://stackoverflow.com/questions/44683812/how-do-install-c-header-files-in-mac-osx-sierra

daanx commented 5 years ago

Right, it seems including malloc.h was wrong in the first place and I should have used stdlib.h anyways, see https://stackoverflow.com/questions/12973311/difference-between-stdlib-h-and-malloc-h I'll fix this right away.

shazqadeer commented 5 years ago

@daanx : Did you get a chance to push a fix? Looks like we know what to do and the fix is simple.

daanx commented 5 years ago

Ah,I thought I had fixed this long ago but apperently not! Apologies. Fixed now, commit 2cb30098

daanx commented 5 years ago

Hi Shaz,

Ha, I thought I did this a long time ago. Fixed now I hope (in the master and dev branch)

Best Daan


From: Shaz Qadeer notifications@github.com Sent: Monday, February 11, 2019 3:21 AM To: koka-lang/libhandler Cc: Daan; Mention Subject: Re: [koka-lang/libhandler] compilation error on mac os (#8)

@daanxhttps://github.com/daanx : Did you get a chance to push a fix? Looks like we know what to do and the fix is simple.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/koka-lang/libhandler/issues/8#issuecomment-462293982, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACEg3HQCPR_zXBlEfpnLJydnxIM71nE-ks5vMVIggaJpZM4Y8Xwz.