metapixel
metapixel copied to clipboard
Does not compile under Mac OSX
system info: gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer//usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin16.4.0 Thread model: posix
what i did: git clone https://github.com/schani/metapixel.git cd metapixel git submodule update --init make
gcc -g -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Wall -DMETAPIXEL_VERSION="1.1.0" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -DCONSOLE_OUTPUT pkg-config --cflags glib-2.0
-c search.c
search.c:59:2: error: function definition is not allowed here
{
^
search.c:127:2: error: function definition is not allowed here
{
^
search.c:155:2: warning: implicit declaration of function 'check_orientation' is invalid in C99 [-Wimplicit-function-declaration]
check_orientation(pixel, pixel_index, compare_func_set->compare_no_flip, 0);
^
1 warning and 2 errors generated.
make: *** [Makefile:60: search.o] Error 1
Any idea? thanks
had similar error. Checking out the v1.0
branch leads to a different error:
➜ metapixel git:(v1.0) make
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C rwimg
gcc -DRWIMG_PNG -DRWIMG_JPEG -DRWIMG_GIF -g -c rwpng.c
rwpng.c:61:29: error: incomplete definition of type 'struct png_struct_def'
if (setjmp(data->png_ptr->jmpbuf))
~~~~~~~~~~~~~^
/usr/local/include/png.h:470:16: note: forward declaration of 'struct png_struct_def'
typedef struct png_struct_def png_struct;
^
rwpng.c:68:28: error: incomplete definition of type 'struct png_info_def'
*width = data->info_ptr->width;
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:69:29: error: incomplete definition of type 'struct png_info_def'
*height = data->info_ptr->height;
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:71:23: error: incomplete definition of type 'struct png_info_def'
if (data->info_ptr->bit_depth != 8 && data->info_ptr->bit_depth != 16)
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:71:57: error: incomplete definition of type 'struct png_info_def'
if (data->info_ptr->bit_depth != 8 && data->info_ptr->bit_depth != 16)
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:78:23: error: incomplete definition of type 'struct png_info_def'
if (data->info_ptr->color_type != PNG_COLOR_TYPE_RGB
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:79:19: error: incomplete definition of type 'struct png_info_def'
&& data->info_ptr->color_type != PNG_COLOR_TYPE_RGB_ALPHA
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:80:19: error: incomplete definition of type 'struct png_info_def'
&& data->info_ptr->color_type != PNG_COLOR_TYPE_GRAY
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:81:19: error: incomplete definition of type 'struct png_info_def'
&& data->info_ptr->color_type != PNG_COLOR_TYPE_GRAY_ALPHA)
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:88:23: error: incomplete definition of type 'struct png_info_def'
if (data->info_ptr->interlace_type != PNG_INTERLACE_NONE)
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:108:29: error: incomplete definition of type 'struct png_struct_def'
if (setjmp(data->png_ptr->jmpbuf))
~~~~~~~~~~~~~^
/usr/local/include/png.h:470:16: note: forward declaration of 'struct png_struct_def'
typedef struct png_struct_def png_struct;
^
rwpng.c:111:23: error: incomplete definition of type 'struct png_info_def'
if (data->info_ptr->color_type == PNG_COLOR_TYPE_GRAY)
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:113:28: error: incomplete definition of type 'struct png_info_def'
else if (data->info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:115:28: error: incomplete definition of type 'struct png_info_def'
else if (data->info_ptr->color_type == PNG_COLOR_TYPE_RGB)
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:120:23: error: incomplete definition of type 'struct png_info_def'
if (data->info_ptr->bit_depth == 16)
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:125:48: error: incomplete definition of type 'struct png_info_def'
row = (unsigned char*)malloc(data->info_ptr->width * spp * bps);
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:134:36: error: incomplete definition of type 'struct png_info_def'
for (j = 0; j < data->info_ptr->width; ++j)
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:136:31: error: incomplete definition of type 'struct png_info_def'
lines[i * data->info_ptr->width * 3 + j * 3 + channel] = row[j * spp * bps];
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
rwpng.c:138:36: error: incomplete definition of type 'struct png_info_def'
for (j = 0; j < data->info_ptr->width; ++j)
~~~~~~~~~~~~~~^
/usr/local/include/png.h:484:16: note: forward declaration of 'struct png_info_def'
typedef struct png_info_def png_info;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[1]: *** [rwpng.o] Error 1
make: *** [librwimg] Error 2
This should be fixed now on branch v1.0
.
I get the following error when trying to make
on Mac OS 10.13.3.
gcc -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Irwimg -Wall -O2 -DMETAPIXEL_VERSION=\"1.0.2\" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -c metapixel.c
gcc -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Irwimg -Wall -O2 -DMETAPIXEL_VERSION=\"1.0.2\" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -c vector.c
gcc -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Irwimg -Wall -O2 -DMETAPIXEL_VERSION=\"1.0.2\" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -c zoom.c
gcc -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Irwimg -Wall -O2 -DMETAPIXEL_VERSION=\"1.0.2\" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -c lispreader.c
gcc -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Irwimg -Wall -O2 -DMETAPIXEL_VERSION=\"1.0.2\" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -c pools.c
gcc -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Irwimg -Wall -O2 -DMETAPIXEL_VERSION=\"1.0.2\" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -c allocator.c
gcc -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Irwimg -Wall -O2 -DMETAPIXEL_VERSION=\"1.0.2\" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -c getopt.c
getopt.c:354:54: warning: implicit declaration of function 'getpid' is invalid in C99 [-Wimplicit-function-declaration]
sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
^
getopt.c:359:24: warning: implicitly declaring library function 'strlen' with type 'unsigned long (const char *)' [-Wimplicit-function-declaration]
nonoption_flags_len = strlen (nonoption_flags);
^
getopt.c:359:24: note: include the header <string.h> or explicitly provide a declaration for 'strlen'
getopt.c:479:30: warning: implicitly declaring library function 'strcmp' with type 'int (const char *, const char *)' [-Wimplicit-function-declaration]
if (optind != argc && !strcmp (argv[optind], "--"))
^
getopt.c:479:30: note: include the header <string.h> or explicitly provide a declaration for 'strcmp'
getopt.c:559:7: warning: implicitly declaring library function 'strncmp' with type 'int (const char *, const char *, unsigned long)' [-Wimplicit-function-declaration]
if (!strncmp (p->name, nextchar, nameend - nextchar))
^
getopt.c:559:7: note: include the header <string.h> or explicitly provide a declaration for 'strncmp'
getopt.c:609:7: warning: add explicit braces to avoid dangling else [-Wdangling-else]
else
^
5 warnings generated.
gcc -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Irwimg -Wall -O2 -DMETAPIXEL_VERSION=\"1.0.2\" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -c getopt1.c
/Applications/Xcode.app/Contents/Developer/usr/bin/make CFLAGS="`pkg-config --cflags libpng` -I/usr/local/include" -C rwimg
gcc -I/usr/local/Cellar/libpng/1.6.34/include/libpng16 -I/usr/local/include -DRWIMG_PNG -DRWIMG_JPEG -DRWIMG_GIF -g -c readimage.c
gcc -I/usr/local/Cellar/libpng/1.6.34/include/libpng16 -I/usr/local/include -DRWIMG_PNG -DRWIMG_JPEG -DRWIMG_GIF -g -c writeimage.c
gcc -I/usr/local/Cellar/libpng/1.6.34/include/libpng16 -I/usr/local/include -DRWIMG_PNG -DRWIMG_JPEG -DRWIMG_GIF -g -c rwpng.c
gcc -I/usr/local/Cellar/libpng/1.6.34/include/libpng16 -I/usr/local/include -DRWIMG_PNG -DRWIMG_JPEG -DRWIMG_GIF -g -c rwjpeg.c
gcc -I/usr/local/Cellar/libpng/1.6.34/include/libpng16 -I/usr/local/include -DRWIMG_PNG -DRWIMG_JPEG -DRWIMG_GIF -g -c rwgif.c
ar rcu librwimg.a readimage.o writeimage.o rwpng.o rwjpeg.o rwgif.o
gcc `pkg-config --libs libpng` -L/usr/local/lib -ljpeg -lgif -L/usr/X11R6/lib -o metapixel metapixel.o vector.o zoom.o lispreader.o pools.o allocator.o getopt.o getopt1.o rwimg/librwimg.a -lpng -ljpeg -lgif -lm -lz
gcc -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Irwimg -Wall -O2 -DMETAPIXEL_VERSION=\"1.0.2\" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -c convert.c
gcc `pkg-config --libs libpng` -L/usr/local/lib -ljpeg -lgif -L/usr/X11R6/lib -o convert convert.o lispreader.o pools.o allocator.o getopt.o getopt1.o
gcc -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Irwimg -Wall -O2 -DMETAPIXEL_VERSION=\"1.0.2\" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -c imagesize.c
gcc `pkg-config --libs libpng` -L/usr/local/lib -ljpeg -lgif -L/usr/X11R6/lib -o metapixel-imagesize imagesize.o rwimg/librwimg.a -lpng -ljpeg -lgif -lm -lz
I've installed XQuartz, Xcode, ran brew install libpng jpeg giflib
and git submodule update --init
.
I don't see an error there.
Does that output mean it compiled without errors?
When I run make install
afterwards I get this:
/Applications/Xcode.app/Contents/Developer/usr/bin/make CFLAGS="`pkg-config --cflags libpng` -I/usr/local/include" -C rwimg
make[1]: Nothing to be done for `all'.
gcc `pkg-config --libs libpng` -L/usr/local/lib -ljpeg -lgif -L/usr/X11R6/lib -o metapixel metapixel.o vector.o zoom.o lispreader.o pools.o allocator.o getopt.o getopt1.o rwimg/librwimg.a -lpng -ljpeg -lgif -lm -lz
xsltproc --nonet /usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl metapixel.xml
warning: failed to load external entity "/usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl"
cannot parse /usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl
make: *** [metapixel.1] Error 4
When I run make install afterwards I get this: [ERROR]
Since make install
triggered the same error as you, I just executed
sudo cp metapixel metapixel-prepare metapixel-imagesize metapixel-sizesort /usr/local/bin
and it was enough to make it work without any issue.