justanhduc/task-spooler

Compilation errors in macos bigsur

acmaggs opened this issue · 4 comments

I have error messages when compiling on a recent mac, with the system compiler. Which is clang based

Apple clang version 12.0.5 (clang-1205.0.22.11)

list.c:22:5: error: implicitly declaring library function 'snprintf' with type 'int (char *, unsigned long, const char *, ...)'

I solved this with a change:
remove
-D_XOPEN_SOURCE=500 -D__STRICT_ANSI__
in Makefile
which seems to block the use of snprintf

@acmaggs Thanks for reporting. I have never used clang and don't have a Mac to test, but _XOPEN_SOURCE=500 standard includes snprintf on Linux, so probably there's some conflict here(?). Anw I will include this in the FAQ. thanks again!

On macOS Monterey 12.6 (with M1 chip) I removed that Makefile line:

GLIBCFLAGS=-D_XOPEN_SOURCE=500 -D__STRICT_ANSI__

Then running make cpu I get a new error message:

cc main.o server.o server_start.o client.o msgdump.o jobs.o execute.o msg.o mail.o error.o signals.o list.o print.o info.o env.o tail.o cjson/cJSON.o  -lpthread -fopenmp -o ts
clang: error: unsupported option '-fopenmp'
make: *** [ts] Error 1

Next, per microsoft/LightGBM#3, I tried:

brew install gcc llvm
brew link gcc

And yet I get the same -fopenmp error. Looks like there's some more possible solutions, but I don't wanna go down a rabbit hole right now.

hi @jamesbraza. Upon looking at the code and try compiling, I don't think -fopenmp is needed. It is a legacy flag that I didn't touch. Could you try removing that flag in the Makefile and try again?

Hello @justanhduc yes, the install succeeds in that case! Thank you!