pts / sam2p

raster (bitmap) image converter with smart PDF and PostScript (EPS) output
http://pts.50.hu/sam2p/
GNU General Public License v2.0
42 stars 15 forks source link

compilation on macOS fails in configure stage #4

Closed MNMikeN closed 7 years ago

MNMikeN commented 7 years ago

Don't know from where I should get the lzw dependency. But even without lzw ./configure fails:

$ ./configure --enable-lzw --enable-gif checking for --enable-debug... assert checking for --enable-lzw... yes checking for --enable-zip... yes checking for --enable-fax... yes checking for --enable-gif... yes configure: WARNING: GIF is a resistered trademark of Compuserve; ask permission from them to use it! checking for g++... g++ checking for C++ compiler default output... a.out checking whether the C++ compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking whether g++ accepts -fsigned-char... yes checking whether g++ accepts -fno-rtti -fno-exceptions... yes checking whether g++ accepts -ansi -pedantic -Wall -W... yes checking whether g++ accepts -Wextra... yes checking whether g++ accepts -felide-constructors -Wstrict-prototypes -Wpointer-arith -Wcast-align -Winline -Wcast-qual -Wmissing-prototypes... yes checking for ignored -W -Wall -Wnested-externs -Wbad-function-cast -Wmissing-declarations... no checking whether g++ accepts -Wnested-externs -Wbad-function-cast -Wmissing-declarations... yes checking whether gcc can link C++ code... yes-with-help checking for cjpeg... /opt/local/bin/cjpeg checking for djpeg... /opt/local/bin/djpeg checking for tif22pnm... /usr/local/bin/tif22pnm checking for tifftopnm... /sw/bin/tifftopnm checking for pngtopnm... /sw/bin/pngtopnm checking for gs... /sw/bin/gs checking for lzw_codec... no configure: WARNING: lzw_codec would provide increased functionality to this program: configure: WARNING: lzwcodec might become recommended for /Compression/LZW checking for gzip... /sw/bin/gzip checking for zip... /usr/bin/zip checking for bash... /sw/bin/bash checking for make... /sw/bin/make checking for perl... /usr/bin/perl checking how to run the C++ preprocessor... g++ -E checking for egrep... grep -E checking for ANSI C header files... no checking whether cc supports prototypes... yes checking whether cc compiles standard C... yes checking for switch(enum) bug... no checking for ASCII system... yes checking for an ANSI C-conforming const... yes checking for C keyword volatile... yes checking whether c++ supports static const... yes checking for working getc in stdio.h... yes checking for working fgetc in stdio.h... yes checking for working putc in stdio.h... yes checking for working fputc in stdio.h... yes checking for working sprintf in stdio.h... yes checking for working atoi in stdlib.h... yes checking for working write in unistd.h... yes checking for working system in stdlib.h... yes checking for working lstat in sys/stat.h... yes checking for working strcpy in string.h... yes checking for working memcpy in string.h... yes checking whether memcmp and memcpy are built-in... no checking for working malloc in stdlib.h... yes checking for working alloca.h... yes checking for alloca... yes checking for width of printf .g... ".16" checking for tmpdir... "/var/tmp/" checking for binary popen... yes checking for binary popen_b... (cached) no checking for working vsnprintf... c99 checking for working system(3)... unix checking whether char is unsigned... no checking size of char... 1 checking size of short... (cached) 2 checking size of int... (cached) 4 checking size of long... (cached) 8 checking size of long long... 8 checking size of very long... (cached) 0 checking size of __int64... (cached) 0 configure: WARNING: cannot find inttype: sizeof(inttype)==16 checking size of char ... (cached) 8 checking size of void ... 8 checking for an integral type to hold a ptr... long checking for ptr <-> integral conversion... yes checking for integral type size_t... unsigned long checking size of bool... 1 configure: creating ./config.status config.status: creating Makehelp config.status: creating config.h config.status: config.h is unchanged running make Makedep... error configure: error: cannot compute depends

pts commented 7 years ago

Thank you for reporting this!

This error (cannot compute depends) should be easy fo fix, but for that I need additional input from you. In the file config.log, search for running make Makedep, and copy-paste the lines following it here. (Anything after ------ is not needed.) These log lines help me diagnose and fix the problem in ccdep.pl.

Please use ./configure --enable-lzw --enable-gif, and ignore the warnings about lzw_codec.

MNMikeN commented 7 years ago

With pleasure. The requested lines:

configure:7504: running make Makedep perl -x -S ./ccdep.pl --FAL=assert,no,yes,checker g++ ./ccdep.pl: running.

----------------

Cache variables.

----------------

########[…]######### More warnings (just in case):

configure:1978:7: warning: delete called on 'B' that is abstract but has non-virtual destructor [-Wdelete-non-virtual-dtor] delete p; ^ 1 warning generated. […] configure:2017: gcc -o conftest -fsigned-char -fno-rtti -fno-exceptions conftest.o >&5 Undefined symbols for architecture x86_64: "operator delete(void*)", referenced from: _main in conftest.o "operator new(unsigned long)", referenced from: _main in conftest.o "___cxa_pure_virtual", referenced from: vtable for B in conftest.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) […]

configure:2689:10: fatal error: 'ac_nonexistent.h' file not found

include

     ^
1 error generated. configure:2690: $? = 1 configure: failed program was: #line 2675 "configure" / confdefs.h. /
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define USE_BUILTIN_LZW 1
#define USE_BUILTIN_ZIP 1
#define USE_BUILTIN_FAXE 1
#define USE_IN_GIF 1
#define USE_OUT_GIF 1
#define HAVE_PTS_C_LGCC_CPP_REQUIRED 1
/ end confdefs.h. /
#include

[…]

include

     ^
1 error generated. configure:2797: $? = 1 configure: failed program was: #line 2782 "configure" / confdefs.h. /
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define USE_BUILTIN_LZW 1
#define USE_BUILTIN_ZIP 1
#define USE_BUILTIN_FAXE 1
#define USE_IN_GIF 1
#define USE_OUT_GIF 1
#define HAVE_PTS_C_LGCC_CPP_REQUIRED 1
/ end confdefs.h. /
#include
configure:2840: checking for egrep configure:2850: result: grep -E configure:2855: checking for ANSI C header files configure:2881: g++ -c -fsigned-char -fno-rtti -fno-exceptions conftest.cc >&5 configure:2884: $? = 0 configure:2887: test -s conftest.o configure:2890: $? = 0 configure:2982: g++ -o conftest -fsigned-char -fno-rtti -fno-exceptions conftest.cc >&5 configure:2981:7: error: use of undeclared identifier 'exit' exit(2); ^ configure:2982:3: error: use of undeclared identifier 'exit' exit (0); ^ 2 errors generated. configure:2985: $? = 1 configure: program exited with status 1 configure: failed program was: #line 2950 "configure" / confdefs.h. /
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define USE_BUILTIN_LZW 1
#define USE_BUILTIN_ZIP 1
#define USE_BUILTIN_FAXE 1
#define USE_IN_GIF 1
#define USE_OUT_GIF 1
#define HAVE_PTS_C_LGCC_CPP_REQUIRED 1
/ end confdefs.h. /
#include
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') ('j' <= (c) && (c) <= 'r') ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
toupper (i) != TOUPPER (i))
exit(2);
exit (0);
}

configure:3005: result: no

[…]

configure:5209: checking for working vsnprintf configure:5315: g++ -o conftest -fsigned-char -fno-rtti -fno-exceptions conftest.cc >&5 configure:5309:25: warning: conversion from string literal to 'char ' is deprecated [-Wc++11-compat-deprecated-writable-strings] i=myprintf(10, buf, "%s-%ld", "Alma", -1234567L); ^ configure:5315:25: warning: conversion from string literal to 'char ' is deprecated [-Wc++11-compat-deprecated-writable-strings] i=myprintf(10, buf, "%s-%ld", "Alma", -123L); ^ configure:5320:25: warning: conversion from string literal to 'char ' is deprecated [-Wc++11-compat-deprecated-writable-strings] i=myprintf(10, buf, "%s-%ld", "Alma", -1234L); ^ configure:5325:24: warning: conversion from string literal to 'char ' is deprecated [-Wc++11-compat-deprecated-writable-strings] i=myprintf(0, buf, "%s-%ld", "Alma", -1234L); ^ configure:5331:24: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings] i=myprintf(1, buf, "%s-%ld", "Alma", -1234L); ^ 5 warnings generated.

[…]

configure:5567:21: warning: implicit conversion from 'int' to 'volatile char' changes value from 255 to -1 [-Wconstant-conversion] volatile char c = 255; return(c < 0); ~ ^~~ 1 warning generated. configure:5543: $? = 0 configure:5545: ./conftest configure:5548: $? = 1 configure: program exited with status 1 configure: failed program was: #line 5524 "configure" / confdefs.h. /
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define USE_BUILTIN_LZW 1
#define USE_BUILTIN_ZIP 1
#define USE_BUILTIN_FAXE 1
#define USE_IN_GIF 1
#define USE_OUT_GIF 1
#define HAVE_PTS_C_LGCC_CPP_REQUIRED 1
#define HAVE_PROTOTYPES 1
#define HAVE_PTS_STDC 1
#define HAVE_ASCII_SYSTEM 1
#define HAVE_STATIC_CONST 1
#define HAVE_getc_in_stdio 1
#define HAVE_fgetc_in_stdio 1
#define HAVE_putc_in_stdio 1
#define HAVE_fputc_in_stdio 1
#define HAVE_sprintf_in_stdio 1
#define HAVE_atoi_in_stdlib 1
#define HAVE_write_in_unistd 1
#define HAVE_system_in_stdlib 1
#define HAVE_lstat_in_sys_stat 1
#define HAVE_strcpy_in_string 1
#define HAVE_STRING 1
#define HAVE_memcpy_in_stringxs 1
#define HAVE_malloc_in_stdlib 1
#define HAVE_ALLOCA_H 1
#define HAVE_ALLOCA 1
#define PTS_CFG_PRINTFGLEN ".16"
#define PTS_CFG_P_TMPDIR "/var/tmp/"
#define HAVE_PTSPOPEN 1
#define HAVE_PTS_SYSTEMF 1
#define HAVE_PTS_SYSTEMF_UNIX 1
/ end confdefs.h. /
/ volatile prevents gcc2 from optimizing the test away on sparcs. /
#if !defined(STDC) STDC != 1
#define volatile
#endif
int main() {
volatile char c = 255; return(c < 0);
}

configure:5563: result: no configure:5574: checking size of char configure:5607: g++ -o conftest -fsigned-char -fno-rtti -fno-exceptions conftest.cc >&5 configure:5629:40: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] fprintf(f, "ac_cv_sizeof_char=%d\n", sizeof(char)); ~~ ^~~~ %lu configure:5630:42: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] fprintf(f, "ac_cv_sizeof_char_p=%d\n", sizeof(char*)); ~~ ^~~~~ %lu configure:5631:41: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] fprintf(f, "ac_cv_sizeof_short=%d\n", sizeof(short)); ~~ ^~~~~ %lu configure:5632:39: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] fprintf(f, "ac_cv_sizeof_int=%d\n", sizeof(int)); ~~ ^~~ %lu configure:5633:40: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] fprintf(f, "ac_cv_sizeof_long=%d\n", sizeof(long)); ~~ ^~~~ %lu 5 warnings generated.

[…]

configure:5878:22: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] fprintf(f, "%d\n", sizeof(long long)); ~~ ^~~~~ %lu 1 warning generated.

[…]

configure:6110: checking size of void configure:6135: g++ -o conftest -fsigned-char -fno-rtti -fno-exceptions conftest.cc >&5 configure:6177:22: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] fprintf(f, "%d\n", sizeof(void )); ~~ ^~~~~~ %lu 1 warning generated.

[…]

configure:6442:22: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] fprintf(f, "%d\n", sizeof(bool)); ~~ ^~~~ %lu 1 warning generated.

[…]

./ccdep.pl: running.

[…]

pts commented 7 years ago

Please do a git pull, then ./configure --enable-lzw --enable-gif, then make. It should work now.

I'll follow up with a more permanent fix.

MNMikeN commented 7 years ago

Fresh clone. Superficially the same error. Log attached with extension txt.

config.txt

pts commented 7 years ago

Done more fixes 7eac929bb41cdb41aeef15fd56334b31cd618206. The latest sam2p should work now.

MNMikeN commented 7 years ago

Yep. Configured and made successfully. Many thanks.

pts commented 7 years ago

Actually, sam2p is now providing official binaries for macOS. (I've just added them.) Could you please check if they work on your Mac equivalently to the binary you compiled from source?

After downloading you need to do chmod 755 *.darwinc*, and also cp png22pnm.darwinc32 png22pnm, and copy png22pnm to your $PATH so that sam2p will find it.

MNMikeN commented 7 years ago

Very limited testing says: the downloaded sam2p.darwin64 binary works. Tried it on the beauty of try.eps. File size is identical to the produced with the compiled binary.

If you want more testing, please advise on the testing routines you might want to see.

pts commented 7 years ago

Please test (with a test.png and test.jpg of your choice):

Reading png files needs png22pnm. Please use png22pnm.darwinc32 above:

chmod 755 png22pnm.darwinc32
sudo cp png22pnm /usr/local/bin/png22pnm

Then test it with these commands:

./sam2p test.jpg testj.pdf
./sam2p test.jpg testj.eps
./sam2p test.png testp.pdf
./sam2p test.png testp.eps
./sam2p.darwinc32 test.jpg testj3.pdf
./sam2p.darwinc32 test.jpg testj3.eps
./sam2p.darwinc32 test.png testp3.pdf
./sam2p.darwinc32 test.png testp3.eps
./sam2p.darwinc64 test.jpg testj6.pdf
./sam2p.darwinc64 test.jpg testj6.eps
./sam2p.darwinc64 test.png testp6.pdf
./sam2p.darwinc64 test.png testp6.eps
cmp testj.pdf testj3.pdf
cmp testj.eps testj3.eps
cmp testp.pdf testp3.pdf
cmp testp.eps testp3.eps
cmp testj.pdf testj6.pdf
cmp testj.eps testj6.eps
cmp testp.pdf testp6.pdf
cmp testp.eps testp6.eps
MNMikeN commented 7 years ago

All cmp commands came out clean on two sets of paired jpeg and png files.

pts commented 7 years ago

Excellent news about the successful comparison, thank you very much for running them! Then I consider the macOS binary release of sam2p a success.

I've created a new issue https://github.com/pts/sam2p/issues/5 to make ccdep.pl more resilient, thus make such ./configure issues happen much less likely in the future.