AltraMayor / f3

F3 - Fight Flash Fraud
https://fight-flash-fraud.readthedocs.io/en/stable/
GNU General Public License v3.0
2.53k stars 141 forks source link

argp change broke building on Mac #42

Closed jmtd closed 8 years ago

jmtd commented 8 years ago

argp.h is a GLIBC-specific header and so f3 won't build on OS X (or presumably other non-GNU systems) since merging fb187b4c710714a56d74af8a50adccd6118445e7.

Rewinding to 599a79a7e4a81a89d3d41f0fb13120c3c8498e45 (prior to the merge) works fine.

AltraMayor commented 8 years ago

Hi @jmtd,

Thank you for the report.

Do you know an alternative available on OS X? Or, how are the GNU applications built on OS X?

AltraMayor commented 8 years ago

According to the following page, the problem is solved installing Gnulib:

https://www.gnu.org/software/gnulib/manual/html_node/argp_002eh.html

Gnulib is here:

https://www.gnu.org/software/gnulib/

Could you try it out and document the steps here?

jksinton commented 8 years ago

I'm using the homebrew argp-standalone and compiled it by changing LDFLAGS in the makefile:

LDFLAGS += -I/usr/local/Cellar/argp-standalone/1.3/include/ -L/usr/local/Cellar/argp-standalone/1.3/lib/ -largp

AltraMayor commented 8 years ago

Hi @jksinton,

Thank you for the information.

Can you give a step by step that includes installing homebrew, argp-standalone, and compiling F3? I'd like to include it in the README.md file of F3 to help Mac users.

Instead of editing the Makefile, you can define LDFLAGS before calling make like this:

export LDFLAGS = $LDFLAGS  -I/usr/local/Cellar/argp-standalone/1.3/include/ -L/usr/local/Cellar/argp-standalone/1.3/lib/ -largp

I think that the "-I/usr/local/Cellar/argp-standalone/1.3/include/" should be part of CFLAGS variable. So, could you test the following exports before calling make?:

export CFLAGS = $CFLAGS -I/usr/local/Cellar/argp-standalone/1.3/include/
export LDFLAGS = $LDFLAGS -L/usr/local/Cellar/argp-standalone/1.3/lib/ -largp
jksinton commented 8 years ago

I'll prepare a tutorial and test the argp settings without editing the makefile.

jksinton commented 8 years ago

These export statements work: export CFLAGS="$CFLAGS -I/usr/local/Cellar/argp-standalone/1.3/include/" export LDFLAGS="$LDFLAGS -L/usr/local/Cellar/argp-standalone/1.3/lib/ -largp" before calling make. I'll try to write the tutorial this weekend.

jksinton commented 8 years ago

Mac tutorial for 10.11 El Capitan:

1) Install Apple command line tools.

xcode-select --install

See http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/

2) Install Homebrew.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

See http://brew.sh/

3) Install argp library.

brew install argp-standalone

See http://brewformulas.org/ArgpStandalone See also https://www.freshports.org/devel/argp-standalone/

4) Set compilation flags.

export CFLAGS="$CFLAGS -I/usr/local/include/"
export LDFLAGS="$LDFLAGS -L/usr/local/lib/ -largp"

These flags are called in the Makefile and tell the compiler to use the argp library in /usr/local/.

5) Build F3, proceed with make.

make

AltraMayor commented 8 years ago

Thank you very much, @jksinton.

I'll push your steps into the README file later.

AltraMayor commented 8 years ago

Hi everyone,

If you try @jksinton's steps, please report your results on this thread.

thanarious commented 8 years ago

Followed tutorial steps, f3 compiles just fine, couple of warnings, though:

thanars-iMac:f3-master thanar$ make cc -I/usr/local/include/ -std=c99 -Wall -Wextra -pedantic -MMD -ggdb -c -o utils.o utils.c cc -I/usr/local/include/ -std=c99 -Wall -Wextra -pedantic -MMD -ggdb -c -o f3write.o f3write.c f3write.c:39:6: warning: missing field 'key' initializer [-Wmissing-field-initializers] { 0 } ^ 1 warning generated. cc -o f3write utils.o f3write.o -L/usr/local/lib/ -largp -lm cc -I/usr/local/include/ -std=c99 -Wall -Wextra -pedantic -MMD -ggdb -c -o f3read.o f3read.c f3read.c:37:6: warning: missing field 'key' initializer [-Wmissing-field-initializers] { 0 } ^ 1 warning generated. cc -o f3read utils.o f3read.o -L/usr/local/lib/ -largp

jmtd commented 8 years ago

Sorry for the delay. @jksinton's instructions work fine for me, thanks. I've just opened a PR that makes this more automatic for OS X users (assuming they do install argp-standalone via brew or other means) but leaves things working as they are for GNU systems.

AltraMayor commented 8 years ago

I've added @jksinton's instructions to the README.md file.

AltraMayor commented 8 years ago

Hi @thanarious,

Based on the following answer on stackoverflow, I've decided to leave those warning you found for now: http://stackoverflow.com/a/1539162

Thank you for your report, though.