Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not compile on OSX (fix provided) #8

Open
clauswitt opened this issue Dec 18, 2017 · 4 comments
Open

Could not compile on OSX (fix provided) #8

clauswitt opened this issue Dec 18, 2017 · 4 comments
Labels

Comments

@clauswitt
Copy link

I am not sure if this warrants a PR - or if it was just my system that had some weird issue.

I had compile errors because of lcms.h (on my system) defining TRUE and FALSE as 1 and 0, and the compiler then sees integers assigned to booleans. (Hope that makes sense).

Output from make

/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in ../imagecore
  CXX      formats/internal/libimagecore_la-jpeg.lo
formats/internal/jpeg.cpp:52:2: warning: libjpeg-turbo is strongly recommended, but not detected. performance will suffer. [-W#warnings]
#warning libjpeg-turbo is strongly recommended, but not detected. performance will suffer.
 ^
formats/internal/jpeg.cpp:225:10: error: cannot initialize return object of type 'boolean' with an rvalue of type 'int'
                return FALSE;
                       ^~~~~
/usr/local/include/lcms2.h:251:22: note: expanded from macro 'FALSE'
#       define FALSE 0
                     ^
formats/internal/jpeg.cpp:229:9: error: cannot initialize return object of type 'boolean' with an rvalue of type 'int'
        return TRUE;
               ^~~~
/usr/local/include/lcms2.h:254:22: note: expanded from macro 'TRUE'
#       define TRUE  1
                     ^
formats/internal/jpeg.cpp:251:2: error: no matching function for call to 'jpeg_read_header'
        jpeg_read_header(&m_JPEGDecompress, TRUE);
        ^~~~~~~~~~~~~~~~
/usr/local/include/jpeglib.h:1039:13: note: candidate function not viable: no known conversion from 'int' to 'boolean' for 2nd argument
EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
            ^
formats/internal/jpeg.cpp:337:42: error: assigning to 'boolean' from incompatible type 'int'
                m_JPEGDecompress.do_fancy_upsampling = FALSE;
                                                       ^~~~~
/usr/local/include/lcms2.h:251:22: note: expanded from macro 'FALSE'
#       define FALSE 0
                     ^
formats/internal/jpeg.cpp:339:41: error: assigning to 'boolean' from incompatible type 'int'
                m_JPEGDecompress.do_block_smoothing = FALSE;
                                                      ^~~~~
/usr/local/include/lcms2.h:251:22: note: expanded from macro 'FALSE'
#       define FALSE 0
                     ^
formats/internal/jpeg.cpp:343:35: error: assigning to 'boolean' from incompatible type 'int'
                m_JPEGDecompress.raw_data_out = TRUE;
                                                ^~~~
/usr/local/include/lcms2.h:254:22: note: expanded from macro 'TRUE'
#       define TRUE  1
                     ^
formats/internal/jpeg.cpp:779:9: error: cannot initialize return object of type 'boolean' with an rvalue of type 'int'
        return TRUE;
               ^~~~
/usr/local/include/lcms2.h:254:22: note: expanded from macro 'TRUE'
#       define TRUE  1
                     ^
formats/internal/jpeg.cpp:914:2: error: no matching function for call to 'jpeg_set_quality'
        jpeg_set_quality(&m_JPEGCompress, m_Quality, TRUE);
        ^~~~~~~~~~~~~~~~
/usr/local/include/jpeglib.h:991:14: note: candidate function not viable: no known conversion from 'int' to 'boolean' for 3rd argument
EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,
             ^
formats/internal/jpeg.cpp:918:3: error: no matching function for call to 'jpeg_add_quant_table'
                jpeg_add_quant_table(&m_JPEGCompress, 0, m_QuantTables, 100, TRUE);
                ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/jpeglib.h:998:14: note: candidate function not viable: no known conversion from 'int' to 'boolean' for 5th argument
EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
             ^
formats/internal/jpeg.cpp:919:3: error: no matching function for call to 'jpeg_add_quant_table'
                jpeg_add_quant_table(&m_JPEGCompress, 1, m_QuantTables + DCTSIZE2, 100, TRUE);
                ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/jpeglib.h:998:14: note: candidate function not viable: no known conversion from 'int' to 'boolean' for 5th argument
EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
             ^
formats/internal/jpeg.cpp:924:36: error: assigning to 'boolean' from incompatible type 'int'
                m_JPEGCompress.optimize_coding = TRUE;
                                                 ^~~~
/usr/local/include/lcms2.h:254:22: note: expanded from macro 'TRUE'
#       define TRUE  1
                     ^
formats/internal/jpeg.cpp:951:32: error: assigning to 'boolean' from incompatible type 'int'
                m_JPEGCompress.raw_data_in = TRUE;
                                             ^~~~
/usr/local/include/lcms2.h:254:22: note: expanded from macro 'TRUE'
#       define TRUE  1
                     ^
formats/internal/jpeg.cpp:958:2: error: no matching function for call to 'jpeg_start_compress'
        jpeg_start_compress(&m_JPEGCompress, TRUE);
        ^~~~~~~~~~~~~~~~~~~
/usr/local/include/jpeglib.h:1010:14: note: candidate function not viable: no known conversion from 'int' to 'boolean' for 2nd argument
EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo,
             ^
formats/internal/jpeg.cpp:1347:10: error: cannot initialize return object of type 'boolean' with an rvalue of type 'int'
                return FALSE;
                       ^~~~~
/usr/local/include/lcms2.h:251:22: note: expanded from macro 'FALSE'
#       define FALSE 0
                     ^
formats/internal/jpeg.cpp:1351:9: error: cannot initialize return object of type 'boolean' with an rvalue of type 'int'
        return TRUE;
               ^~~~
/usr/local/include/lcms2.h:254:22: note: expanded from macro 'TRUE'
#       define TRUE  1
                     ^
1 warning and 15 errors generated.
make[2]: *** [formats/internal/libimagecore_la-jpeg.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

The following diff fixes that problem:

diff --git a/imagecore/formats/internal/jpeg.cpp b/imagecore/formats/internal/jpeg.cpp
index 8695e16..fbe2092 100644
--- a/imagecore/formats/internal/jpeg.cpp
+++ b/imagecore/formats/internal/jpeg.cpp
@@ -222,11 +222,11 @@ boolean ImageReaderJPEG::handleJPEGMarker(j_decompress_ptr dinfo)
 	uint8_t* segmentData = (uint8_t*)malloc(segmentLength);
 	if( segmentData == NULL ) {
 		reader->m_MarkerReadError = true;
-		return FALSE;
+		return (boolean)FALSE;
 	}
 	jpegRead(dinfo, segmentData, segmentLength);
 	reader->processJPEGSegment(dinfo->unread_marker, segmentData, segmentLength);
-	return TRUE;
+	return (boolean)TRUE;
 }
 
 void ImageReaderJPEG::processJPEGSegment(unsigned int marker, uint8_t* segmentData, unsigned int segmentLength)
@@ -248,7 +248,7 @@ bool ImageReaderJPEG::readHeader()
 		return false;
 	}
 
-	jpeg_read_header(&m_JPEGDecompress, TRUE);
+	jpeg_read_header(&m_JPEGDecompress, (boolean)TRUE);
 
 	if( m_MarkerReadError ) {
 		return false;
@@ -334,13 +334,13 @@ bool ImageReaderJPEG::beginReadInternal(unsigned int destWidth, unsigned int des
 	m_JPEGDecompress.dct_method = JDCT_ISLOW;
 
 	if( (m_ReadOptions & kReadOption_DecompressQualityFast) != 0) {
-		m_JPEGDecompress.do_fancy_upsampling = FALSE;
+		m_JPEGDecompress.do_fancy_upsampling = (boolean)FALSE;
 		m_JPEGDecompress.dct_method = JDCT_FASTEST;
-		m_JPEGDecompress.do_block_smoothing = FALSE;
+		m_JPEGDecompress.do_block_smoothing = (boolean)FALSE;
 	}
 
 	if( destColorModel == kColorModel_YUV_420 ) {
-		m_JPEGDecompress.raw_data_out = TRUE;
+		m_JPEGDecompress.raw_data_out = (boolean)TRUE;
 	}
 
 	if( setjmp(m_JPEGError.jmp) ) {
@@ -776,7 +776,7 @@ boolean ImageReaderJPEG::SourceManager::fillInputBuffer(j_decompress_ptr cinfo)
 	self->bytes_in_buffer = nbytes;
 	self->startOfFile = false;
 
-	return TRUE;
+	return (boolean)TRUE;
 }
 
 void ImageReaderJPEG::SourceManager::skipInputData(j_decompress_ptr cinfo, long numBytes)
@@ -911,17 +911,17 @@ bool ImageWriterJPEG::beginWrite(unsigned int width, unsigned int height, EImage
 	}
 
 	jpeg_set_defaults(&m_JPEGCompress);
-	jpeg_set_quality(&m_JPEGCompress, m_Quality, TRUE);
+	jpeg_set_quality(&m_JPEGCompress, m_Quality, (boolean)TRUE);
 	jpeg_set_colorspace(&m_JPEGCompress, JCS_YCbCr);
 
 	if( m_QuantTables != NULL ) {
-		jpeg_add_quant_table(&m_JPEGCompress, 0, m_QuantTables, 100, TRUE);
-		jpeg_add_quant_table(&m_JPEGCompress, 1, m_QuantTables + DCTSIZE2, 100, TRUE);
+		jpeg_add_quant_table(&m_JPEGCompress, 0, m_QuantTables, 100, (boolean)TRUE);
+		jpeg_add_quant_table(&m_JPEGCompress, 1, m_QuantTables + DCTSIZE2, 100, (boolean)TRUE);
 	}
 
 	if( (m_WriteOptions & kWriteOption_QualityFast) == 0 ) {
 		// Compressing takes about 50% longer with this on, but produces files a few percent smaller.
-		m_JPEGCompress.optimize_coding = TRUE;
+		m_JPEGCompress.optimize_coding = (boolean)TRUE;
 	}
 
 	// This makes more of a difference than the documentation suggests, and it's not really slower (faster in some tests).
@@ -948,14 +948,14 @@ bool ImageWriterJPEG::beginWrite(unsigned int width, unsigned int height, EImage
 			m_JPEGCompress.comp_info[0].v_samp_factor = 2;
 		}
 	} else if( colorModel == kColorModel_YUV_420 ) {
-		m_JPEGCompress.raw_data_in = TRUE;
+		m_JPEGCompress.raw_data_in = (boolean)TRUE;
 		m_JPEGCompress.comp_info[0].h_samp_factor = 2;
 		m_JPEGCompress.comp_info[0].v_samp_factor = 2;
 	} else {
 		SECURE_ASSERT(0);
 	}
 
-	jpeg_start_compress(&m_JPEGCompress, TRUE);
+	jpeg_start_compress(&m_JPEGCompress, (boolean)TRUE);
 
 	if( !writeMarkers() ) {
 		jpeg_destroy_compress(&m_JPEGCompress);
@@ -1344,11 +1344,11 @@ boolean ImageWriterJPEG::DestinationManager::emptyOutputBuffer(j_compress_ptr ci
 	ImageWriterJPEG::DestinationManager* dest = (ImageWriterJPEG::DestinationManager*)cinfo->dest;
 	uint64_t written = dest->storage->write(dest->m_Buffer, kWriteBufferSize);
 	if( written < kWriteBufferSize ) {
-		return FALSE;
+		return (boolean)FALSE;
 	}
 	dest->next_output_byte = dest->m_Buffer;
 	dest->free_in_buffer = kWriteBufferSize;
-	return TRUE;
+	return (boolean)TRUE;
 }
 
 void ImageWriterJPEG::DestinationManager::termDestination(j_compress_ptr cinfo)
@lukealonso
Copy link
Contributor

Thanks for the report, that's definitely something that should get fixed.

@canbal This should just be using true/false, I probably had some Objective-C YES/NO brain damage the day I wrote this.

@canbal
Copy link
Contributor

canbal commented Dec 22, 2017

@lukealonso: libjpeg is defining TRUE/FALSE as an int. https://github.com/LuaDist/libjpeg/blob/master/jmorecfg.h#L306.
https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/jmorecfg.h#L241
I don't think true/false is going to fix this. I'm a bit confused to why an explicit cast is required though, maybe a compiler difference?

@clauswitt: Can you provide info about your system and attach the full compilation log?

@canbal canbal added the bug label Dec 23, 2017
@clauswitt
Copy link
Author

System:

macOS High Sierra 10.13.2 (was Sierra, latest, when I first tried).

gcc version:

❯ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Output from configure:

checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-apple-darwin17.3.0
checking host system type... x86_64-apple-darwin17.3.0
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gawk... (cached) gawk
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for ranlib... ranlib
checking whether g++ supports C++14 features by default... no
checking whether g++ supports C++14 features with -std=gnu++14... yes
checking whether C++ compiler accepts -fvisibility=hidden... yes
checking for lsmash_free in -llsmash... yes
checking for aacDecoder_Open in -lfdk-aac... yes
checking for ogg_packet_clear in -logg... yes
checking for pthread_create in -lpthread... yes
checking for vorbis_block_init in -lvorbis... yes
checking for vorbis_encode_init in -lvorbisenc... yes
checking for vpx_free in -lvpx... yes
checking for _ZN8mkvmuxer10AudioTrackC1EPj in -lwebm... yes
checking for deflate in -lz... yes
checking how to run the C++ preprocessor... g++ -std=gnu++14 -E
checking for grep that handles long lines and -e... /usr/local/bin/ggrep
checking for egrep... /usr/local/bin/ggrep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking for unistd.h... (cached) yes
checking for stdbool.h that conforms to C99... no
checking for _Bool... no
checking for inline... inline
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for size_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uint8_t... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... yes
checking for getcwd... yes
checking for memset... yes
checking for mkdir... yes
checking for munmap... yes
checking for sqrt... yes
checking for strrchr... yes
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/local/bin/gsed
checking for fgrep... /usr/local/bin/ggrep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 196608
checking how to convert x86_64-apple-darwin17.3.0 file names to x86_64-apple-darwin17.3.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin17.3.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... (cached) ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -std=gnu++14 -E
checking for ld used by g++ -std=gnu++14... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking whether the g++ -std=gnu++14 linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking for g++ -std=gnu++14 option to produce PIC... -fno-common -DPIC
checking if g++ -std=gnu++14 PIC flag -fno-common -DPIC works... yes
checking if g++ -std=gnu++14 static flag -static works... no
checking if g++ -std=gnu++14 supports -c -o file.o... yes
checking if g++ -std=gnu++14 supports -c -o file.o... (cached) yes
checking whether the g++ -std=gnu++14 linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating vireo.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
=== configuring in ../imagecore (/Users/clauswitt/Documents/Projects/fliva/vireo/vireo/../imagecore)
configure: running /bin/sh ./configure --disable-option-checking '--prefix=/usr/local'  --cache-file=/dev/null --srcdir=.
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for jpeg_mem_src in -ljpeg... yes
checking for png_create_read_struct in -lpng16... yes
checking for WebPDecode in -lwebp... yes
checking for cmsCloseProfile in -llcms2... yes
checking whether C++ compiler accepts -msse4.1... yes
checking whether g++ supports C++11 features by default... no
checking whether g++ supports C++11 features with -std=gnu++11... yes
checking build system type... x86_64-apple-darwin17.3.0
checking host system type... x86_64-apple-darwin17.3.0
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/local/bin/gsed
checking for grep that handles long lines and -e... /usr/local/bin/ggrep
checking for egrep... /usr/local/bin/ggrep -E
checking for fgrep... /usr/local/bin/ggrep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking how to convert x86_64-apple-darwin17.3.0 file names to x86_64-apple-darwin17.3.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin17.3.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -std=gnu++11 -E
checking for ld used by g++ -std=gnu++11... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking whether the g++ -std=gnu++11 linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking for g++ -std=gnu++11 option to produce PIC... -fno-common -DPIC
checking if g++ -std=gnu++11 PIC flag -fno-common -DPIC works... yes
checking if g++ -std=gnu++11 static flag -static works... no
checking if g++ -std=gnu++11 supports -c -o file.o... yes
checking if g++ -std=gnu++11 supports -c -o file.o... (cached) yes
checking whether the g++ -std=gnu++11 linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
config.status: executing libtool commands

Output from make:

/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in ../imagecore
  CXX      libimagecore_la-imagecore.lo
  CXX      formats/libimagecore_la-reader.lo
  CXX      formats/libimagecore_la-writer.lo
  CXX      formats/exif/libimagecore_la-exifreader.lo
  CXX      formats/exif/libimagecore_la-exifcommon.lo
  CXX      formats/exif/libimagecore_la-exifwriter.lo
  CXX      formats/internal/libimagecore_la-raw.lo
  CXX      formats/internal/libimagecore_la-register.lo
  CXX      image/libimagecore_la-image.lo
  CXX      image/libimagecore_la-kernel.lo
  CXX      image/internal/libimagecore_la-filters.lo
  CXX      image/internal/libimagecore_la-filters_intrinsics.lo
  CXX      image/internal/libimagecore_la-conversions.lo
  CXX      image/internal/libimagecore_la-platform_support.lo
  CXX      image/internal/libimagecore_la-sse.lo
  CXX      image/libimagecore_la-resizecrop.lo
  CXX      image/libimagecore_la-tiledresize.lo
  CXX      image/libimagecore_la-colorspace.lo
  CXX      image/libimagecore_la-rgba.lo
  CXX      image/libimagecore_la-yuv.lo
  CXX      image/libimagecore_la-yuv_semiplanar.lo
  CXX      image/libimagecore_la-grayscale.lo
  CXX      image/libimagecore_la-colorpalette.lo
  CXX      formats/internal/libimagecore_la-bmp.lo
  CXX      formats/internal/libimagecore_la-gif.lo
  CC       ../thirdparty/giflib/libimagecore_la-dgif_lib.lo
  CC       ../thirdparty/giflib/libimagecore_la-gif_err.lo
  CC       ../thirdparty/giflib/libimagecore_la-gif_hash.lo
  CC       ../thirdparty/giflib/libimagecore_la-gifalloc.lo
  CXX      formats/internal/libimagecore_la-jpeg.lo
formats/internal/jpeg.cpp:52:2: warning: libjpeg-turbo is strongly recommended, but not detected. performance will suffer. [-W#warnings]
#warning libjpeg-turbo is strongly recommended, but not detected. performance will suffer.
 ^
formats/internal/jpeg.cpp:225:10: error: cannot initialize return object of type 'boolean' with an rvalue of type 'int'
                return FALSE;
                       ^~~~~
/usr/local/include/lcms2.h:251:22: note: expanded from macro 'FALSE'
#       define FALSE 0
                     ^
formats/internal/jpeg.cpp:229:9: error: cannot initialize return object of type 'boolean' with an rvalue of type 'int'
        return TRUE;
               ^~~~
/usr/local/include/lcms2.h:254:22: note: expanded from macro 'TRUE'
#       define TRUE  1
                     ^
formats/internal/jpeg.cpp:251:2: error: no matching function for call to 'jpeg_read_header'
        jpeg_read_header(&m_JPEGDecompress, TRUE);
        ^~~~~~~~~~~~~~~~
/usr/local/include/jpeglib.h:1039:13: note: candidate function not viable: no known conversion from 'int' to 'boolean' for 2nd argument
EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
            ^
formats/internal/jpeg.cpp:337:42: error: assigning to 'boolean' from incompatible type 'int'
                m_JPEGDecompress.do_fancy_upsampling = FALSE;
                                                       ^~~~~
/usr/local/include/lcms2.h:251:22: note: expanded from macro 'FALSE'
#       define FALSE 0
                     ^
formats/internal/jpeg.cpp:339:41: error: assigning to 'boolean' from incompatible type 'int'
                m_JPEGDecompress.do_block_smoothing = FALSE;
                                                      ^~~~~
/usr/local/include/lcms2.h:251:22: note: expanded from macro 'FALSE'
#       define FALSE 0
                     ^
formats/internal/jpeg.cpp:343:35: error: assigning to 'boolean' from incompatible type 'int'
                m_JPEGDecompress.raw_data_out = TRUE;
                                                ^~~~
/usr/local/include/lcms2.h:254:22: note: expanded from macro 'TRUE'
#       define TRUE  1
                     ^
formats/internal/jpeg.cpp:779:9: error: cannot initialize return object of type 'boolean' with an rvalue of type 'int'
        return TRUE;
               ^~~~
/usr/local/include/lcms2.h:254:22: note: expanded from macro 'TRUE'
#       define TRUE  1
                     ^
formats/internal/jpeg.cpp:914:2: error: no matching function for call to 'jpeg_set_quality'
        jpeg_set_quality(&m_JPEGCompress, m_Quality, TRUE);
        ^~~~~~~~~~~~~~~~
/usr/local/include/jpeglib.h:991:14: note: candidate function not viable: no known conversion from 'int' to 'boolean' for 3rd argument
EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,
             ^
formats/internal/jpeg.cpp:918:3: error: no matching function for call to 'jpeg_add_quant_table'
                jpeg_add_quant_table(&m_JPEGCompress, 0, m_QuantTables, 100, TRUE);
                ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/jpeglib.h:998:14: note: candidate function not viable: no known conversion from 'int' to 'boolean' for 5th argument
EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
             ^
formats/internal/jpeg.cpp:919:3: error: no matching function for call to 'jpeg_add_quant_table'
                jpeg_add_quant_table(&m_JPEGCompress, 1, m_QuantTables + DCTSIZE2, 100, TRUE);
                ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/jpeglib.h:998:14: note: candidate function not viable: no known conversion from 'int' to 'boolean' for 5th argument
EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
             ^
formats/internal/jpeg.cpp:924:36: error: assigning to 'boolean' from incompatible type 'int'
                m_JPEGCompress.optimize_coding = TRUE;
                                                 ^~~~
/usr/local/include/lcms2.h:254:22: note: expanded from macro 'TRUE'
#       define TRUE  1
                     ^
formats/internal/jpeg.cpp:951:32: error: assigning to 'boolean' from incompatible type 'int'
                m_JPEGCompress.raw_data_in = TRUE;
                                             ^~~~
/usr/local/include/lcms2.h:254:22: note: expanded from macro 'TRUE'
#       define TRUE  1
                     ^
formats/internal/jpeg.cpp:958:2: error: no matching function for call to 'jpeg_start_compress'
        jpeg_start_compress(&m_JPEGCompress, TRUE);
        ^~~~~~~~~~~~~~~~~~~
/usr/local/include/jpeglib.h:1010:14: note: candidate function not viable: no known conversion from 'int' to 'boolean' for 2nd argument
EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo,
             ^
formats/internal/jpeg.cpp:1347:10: error: cannot initialize return object of type 'boolean' with an rvalue of type 'int'
                return FALSE;
                       ^~~~~
/usr/local/include/lcms2.h:251:22: note: expanded from macro 'FALSE'
#       define FALSE 0
                     ^
formats/internal/jpeg.cpp:1351:9: error: cannot initialize return object of type 'boolean' with an rvalue of type 'int'
        return TRUE;
               ^~~~
/usr/local/include/lcms2.h:254:22: note: expanded from macro 'TRUE'
#       define TRUE  1
                     ^
1 warning and 15 errors generated.
make[2]: *** [formats/internal/libimagecore_la-jpeg.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Output from brew list:

ack
adns
ant
anttweakbar
apitrace
arpack
asciidoc
aspell
atk
atkmm
atomicparsley
augeas
autoconf
automake
bash
binutils
binutils-fb
binutilsfb
boost
boost-python
bsdmake
cairo
cairomm
certbot
chaiscript
chicken
clang-format
clang-omp
clisp
cloc
cloog
cloog018
cmake
coreutils
cppcheck
cpputest
cscope
ctags
curl
czmq
dart
dartium
dialog
diff-so-fancy
dmd
dnsmasq
docbook
docbook-xsl
dos2unix
double-conversion
doxygen
dwarfutils
e2fsprogs
editorconfig
eigen
elasticsearch
elixir
emacs
emscripten
epstool
erlang
exercism
exiftool
ext2fuse
faac
fdk-aac
ffmpeg
fftw
fig2dev
figlet
findutils
fish
flac
flow
fltk
fontconfig
fop
freeglut
freetype
freexl
frei0r
fribidi
fzf
gawk
gcc
gcc49
gcc@4.9
gd
gdal
gdb
gdbm
gdk-pixbuf
geos
gettext
gflags
gh
ghc
ghostscript
giflib
git
git-extras
git-when-merged
gitsh
gl2ps
glew
glfw
glfw3
glib
glibmm
glm
global
glog
glpk
gmp
gmp4
gmp@4
gnu-sed
gnupg
gnupg@1.4
gnuplot
gnutls
go
gobject-introspection
gpp
graphicsmagick
graphite2
graphviz
grep
gsettings-desktop-schemas
gtk+
gtk+3
gtkmm3
gtksourceview3
gtksourceviewmm3
h264bitstream
harfbuzz
hdf5
heroku
heroku-node
heroku-toolbelt
hicolor-icon-theme
html2text
htop
htop-osx
hub
icu4c
ilmbase
imagemagick
imagesnap
imap-uw
infer
intltool
isl
isl011
isl@0.11
isl@0.12
isync
jasper
jbig2dec
jemalloc
jemalloc-fb
jemallocfb
jpeg
jpeg-turbo
json-c
kakoune
kotlin
l-smash
lame
ledger
leiningen
letsencrypt
libarchive
libass
libassuan
libbluray
libcaca
libcroco
libdwarf
libdwarf-fb
libelf
libepoxy
libevent
libffi
libgcrypt
libgeotiff
libgpg-error
libgphoto2
libgsm
libicns
libiconv
libiomp
libksba
liblwgeom
libmagic
libmemcached
libmpc
libmpc08
libmpc@0.8
libogg
libpng
libquvi
librsvg
libsigc++
libsigsegv
libsndfile
libsodium
libspatialite
libspectre
libssh2
libtasn1
libtiff
libtool
libunistring
libusb
libusb-compat
libuv
libvo-aacenc
libvorbis
libvpx
libwebm
libxml++
libxml2
libxslt
libyaml
libzip
little-cms2
llvm
llvm35
lua
lua@5.3
lynx
lz4
lzlib
mackup
macvim
mad
makedepend
markdown
maven
mcrypt
md5sha1sum
memcached
mercurial
metis
mhash
mobile-shell
mongodb
mono
mosh
mp3info
mpfr
mpfr2
mpfr@2
mutt
mysql
mysql-connector-c++
nasm
ncurses
net-snmp
nettle
nginx
ninja
node
normalize
npth
numpy
nvm
objective-caml
ocaml
ocamlbuild
octave
oniguruma
openal-soft
opencore-amr
openexr
openjpeg
openldap
openssl
openssl@1.1
opus
orc
p11-kit
pandoc
pango
pangomm
pcre
pcre2
perf
perl
phantomjs
php-version
php56
php56-igbinary
php56-mcrypt
php56-memcache
php56-memcached
php56-mongo
php56-pthreads
php56-xdebug
php56-zmq
php70
php70-mcrypt
php70-opcache
php70-pcntl
php70-pdo-pgsql
pinentry
pixman
pkg-config
plotutils
poppler
portaudio
postgresql
pqiv
proj
protobuf
pstoedit
pyqt
python
python3
qcachegrind
qhull
qrupdate
qt
qt5
r
rbenv
rbenv-gemset
re2c
readline
reattach-to-user-namespace
redis
rename
rhino
ripgrep
rtmpdump
ruby
ruby-build
sane-backends
scala
schroedinger
sdl
sdl2
selecta
serveit
sfml
shared-mime-info
siege
sip
snappy
sox
speex
sqlite
ssh-copy-id
suite-sparse
suite-sparse421
swig
szip
tag-ag
tbb
termbox
texi2html
texinfo
the_silver_searcher
theora
tmux
tokyo-cabinet
transfig
tree
ttfautohint
unixodbc
unoconv
utf8proc
veclibfort
vim
watch
watchman
webkit2png
webp
weechat
wget
wkhtmltopdf
wxmac
x264
x265
xmlstarlet
xvid
xz
yarn
yasm
youtube-dl
yuicompressor
z
zeromq
zlib
zsh
zsh-syntax-highlighting

@sr1990
Copy link

sr1990 commented Sep 8, 2021

Hi, I can still see this issue while compiling on mac.

As mentioned above:
I had compile errors because of lcms.h (on my system) defining TRUE and FALSE as 1 and 0:

Definition of TRUE and FALSE in /usr/local/include/lcms2.h

 268 #ifndef FALSE
 269 #       define FALSE 0
 270 #endif
 271 #ifndef TRUE
 272 #       define TRUE  1
 273 #endif

and looks like it is not able to access boolean definition from /usr/local/include/jmorecfg.h

299 /*
300  * On a few systems, type boolean and/or its values FALSE, TRUE may appear
301  * in standard header files.  Or you may have conflicts with application-
302  * specific header files that you want to include together with these files.
303  * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
304  */
305
306 #ifndef HAVE_BOOLEAN
307 #if defined FALSE || defined TRUE || defined QGLOBAL_H
308 /* Qt3 defines FALSE and TRUE as "const" variables in qglobal.h */
309 typedef int boolean;
310 #ifndef FALSE                   /* in case these macros already exist */
311 #define FALSE   0               /* values of boolean */
312 #endif
313 #ifndef TRUE
314 #define TRUE    1
315 #endif
316 #else
317 typedef enum { FALSE = 0, TRUE = 1 } boolean;
318 #endif
319 #endif

The explicit typecasting mentioned above works but I made the following changes in ../imagecore/formats/internal/jpeg.h
add

 34 #define HAVE_BOOLEAN
 35 typedef int boolean; 

and was able to compile.

@canbal Let me know what you think.

System config:
MacOS Big Sur 11.4

  gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants