Closed mathomp4 closed 1 year ago
Dang, this looks like a bug to me. In parser.y, line "74.5", I really don't find #include <string.h>
.
Weird that it didn't show up before. Maybe the parser/lexer somehow caused the string.h include on my machines via the generated headers.
It seems to me that the problem is gone on the current master branch because the call to strdup()
is also gone. So how shall we fix it? Can you get 2.2.0 to install via brew by providing a brew-side patch? Or do you see something that we can do on the boxes side?
Dang, this looks like a bug to me. In parser.y, line "74.5", I really don't find
#include <string.h>
.Weird that it didn't show up before. Maybe the parser/lexer somehow caused the string.h include on my machines via the generated headers.
It seems to me that the problem is gone on the current master branch because the call to
strdup()
is also gone. So how shall we fix it? Can you get 2.2.0 to install via brew by providing a brew-side patch? Or do you see something that we can do on the boxes side?
Well, I am a Fortran programmer, so coding in C is a bit above me at times. 😄 It's possible it just needs another brew dependency?
So, I just now tried on my home laptop:
brew install --build-from-source --HEAD boxes
and it failed the same:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C ../out -f ../src/Makefile BOXES_PLATFORM=unix ALL_OBJ="parser.o lex.yy.o boxes.o bxstring.o cmdline.o discovery.o generate.o input.o list.o parsecode.o parsing.o query.o regulex.o remove.o shape.o tools.o unicode.o" STRIP=true \
CFLAGS_ADDTL="-O " flags_unix boxes
echo parser.o lex.yy.o bxstring.o cmdline.o discovery.o generate.o input.o list.o parsecode.o parsing.o query.o regulex.o remove.o shape.o tools.o unicode.o > ../out/modules.txt
flex --header-file=lex.yy.h ../src/lexer.l
bison --warnings=all --verbose --defines=parser.h --output=parser.c ../src/parser.y
clang -I. -I../src -Wall -W -O -c -o parser.o parser.c
clang -I. -I../src -Wall -W -O -c -o lex.yy.o lex.yy.c
../src/lexer.l:144:26: error: call to undeclared library function 'strdup' with type 'char *(const char *)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
char *str = (char *) strdup(yytext);
^
../src/lexer.l:144:26: note: include the header <string.h> or explicitly provide a declaration for 'strdup'
1 error generated.
make[2]: *** [lex.yy.o] Error 1
make[1]: *** [build] Error 2
make: *** [build] Error 2
I see something similar-ish here: https://github.com/gphoto/libgphoto2/issues/552
Can you read through that and understand it? Maybe something needs to be added to... src/config.h
maybe?
Ah, that's a different issue, and one where I really couldn't say why it should happen, because in that case, the include statement is present in lexer.l.
Unfortunately, I still don't have access to a Mac which, afaik, would be necessary in order for me to reproduce the problem myself. Would you be able to try out a few things?
_DARWIN_C_SOURCE
as per gphoto/libgphoto2#553 (by just adding a #define _DARWIN_C_SOURCE
in config.h)From the results, maybe we can deduce a fix. 🤞
Okay. So, I did some things. I'm going to record it here so I can remember how to do it in the future. 😄
src/config.h
as seen in https://github.com/ascii-boxes/boxes/pull/119boxes.rb
from the "mainline" homebrew-core and then edited the urls to point to my forkbrew tap mathomp4/self
brew install --build-from-source --HEAD mathomp4/self/boxes
and it seems to build and install.
Now, do we need a release in order to get brew back on track?
Now, do we need a release in order to get brew back on track?
Yes, please, if you can make a 2.2.1 then I can make a PR to brew to update the version there.
Will do as soon as possible. I am currently traveling, so it may be a few days.
@mathomp4 Alright, we have v2.2.1 now! (Still traveling though, but I get GitHub notifications on my mobile.)
I seem to be having issues building/installing boxes in brew. Note that due to not having root access to my laptop, I build my homebrew stuff in
$HOME/.homebrew/brew
and so many codes are built from source.To Reproduce
So this is what happens when I try to install
boxes
:I wonder if it's expecting some library that Clang/macOS doesn't automatically provide?
Expected behavior
Well, boxes builds. 😄
Environment (please complete the following information):
This is on macOS 13.5.1.