ascii-boxes / boxes

Command line ASCII boxes unlimited!
https://boxes.thomasjensen.com/
GNU General Public License v3.0
614 stars 75 forks source link

Help building boxes 2.0.0 with additional include and library paths #74

Closed mathomp4 closed 3 years ago

mathomp4 commented 3 years ago

This isn't a bug report per se with boxes, but a request for help with building. Namely, I build boxes locally because I'm on a cluster where I don't have admin rights and I'll never convince the admins to zypper in boxes. So, I build myself.

Today I tried this and:

$ make
| For compilation info please refer to the boxes compilation FAQ
| at https://boxes.thomasjensen.com/docs/faq.html#q5
fatal: not a git repository (or any parent up to mount point /gpfsm)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
sed -e 's/--BVERSION--/2.0.0 ()/; s/--GLOBALCONF--/\/usr\/share\/boxes/' src/boxes.h.in > src/boxes.h
sed -e 's/--BVERSION--/2.0.0/; s/--GLOBALCONF--/\/usr\/share\/boxes/' doc/boxes.1.in > doc/boxes.1
make -C src BOXES_PLATFORM=unix build
make[1]: Entering directory '/gpfsm/dswdev/mathomp4/local-SLES12/src/boxes-2.0.0/src'
make BOXES_PLATFORM=unix ALL_OBJ="parser.o lex.yy.o boxes.o generate.o regulex.o remove.o shape.o tools.o unicode.o" CFLAGS_ADDTL="-O " STRIP=true flags_unix boxes
make[2]: Entering directory '/gpfsm/dswdev/mathomp4/local-SLES12/src/boxes-2.0.0/src'
make[2]: Nothing to be done for 'flags_unix'.
bison -o parser.c -d parser.y
gcc -I. -Wall -W -O    -c -o parser.o parser.c
In file included from parser.y:32:0:
boxes.h:33:22: fatal error: unitypes.h: No such file or directory
 #include <unitypes.h>
                      ^
compilation terminated.
<builtin>: recipe for target 'parser.o' failed
make[2]: *** [parser.o] Error 1
make[2]: Leaving directory '/gpfsm/dswdev/mathomp4/local-SLES12/src/boxes-2.0.0/src'
Makefile:43: recipe for target 'build' failed
make[1]: *** [build] Error 2
make[1]: Leaving directory '/gpfsm/dswdev/mathomp4/local-SLES12/src/boxes-2.0.0/src'
Makefile:38: recipe for target 'build' failed
make: *** [build] Error 2

Obviously, I need libunistring (at least). So I downloaded and built it locally, but now I'm wondering: How do I inform boxes of this? I tried staring at the Makefiles and tried:

$ make LDFLAGS_ADDTL='-I/discover/swdev/mathomp4/local-SLES12/include -L/discover/swdev/mathomp4/local-SLES12/lib'

but that didn't seem to help. Any ideas?

tsjensen commented 3 years ago

Cool, let's get this to run on SLES!

I have a few bits of information from building on Windows, where I also had to build a library myself.
I built PCRE like this. Mostly this means I built the static libs, which makes sense because on a random Windows system, the dynamic libs will not be available.
Then, for linking properly, I did this call, and specified the libs either dynamically (Linux) or statically (Windows). This -l stuff should already be good in your case.

In other words, try setting C_INCLUDE_PATH to point at the header files, and LDFLAGS_ADDTL to point at the libs.

Let me know how this works out!

mathomp4 commented 3 years ago

Okay. It took a bit. First I built pcre2 with:

./configure --enable-pcre2-8 --enable-pcre2-16 --enable-pcre2-32

because I didn't see you linked to how you built it. But it seemed happy. Then I was able to build boxes with:

make LDFLAGS_ADDTL='-L/discover/swdev/mathomp4/local-SLES12/lib' CFLAGS_ADDTL='-std=c99 -I/discover/swdev/mathomp4/local-SLES12/include'

It needed the -std=c99 it seems on my system (might be old GCC).

But boxes 2.0.0 works!

I guess next up is maybe figuring out how to fix the brew formula so my laptop can have it! (I really only know how to do brew bump-formula-pr but I think you might need a bit more updates with pcre2 and libunistring dependencies...)

tsjensen commented 3 years ago

Great! Now we have instructions on how to build on SLES. 😎 I might link to this in the compile faq.

Thank you for sharing!