Angora
Angora copied to clipboard
how to compile gif2png without discard libpng
Question
gif2png relies on libpng and zlib.
I want to build gif2png with certain version libpng, and want to keep track for libpng library. But libpng build failed. (discard libpng.so build successful.)
Compile libpng 1.5.19
wget https://master.dl.sourceforge.net/project/libpng/libpng15/older-releases/1.5.19/libpng-1.5.19.tar.gz
tar zxvf libpng-1.5.19.tar.gz
cd libpng-1.5.19
export CC=/angora/bin/angora-clang CXX=/angora/bin/angora-clang++
export USE_TRACK=1
/angora/tools/gen_library_abilist.sh /usr/lib/x86_64-linux-gnu/libz.so discard > /tmp/zlib_abilist.txt
export ANGORA_TAINT_RULE_LIST=/tmp/zlib_abilist.txt
./configure --prefix=`pwd`/install CFLAGS="-fPIC" CXXFLAGS="-fPIC" LDFLAGS="-fPIC"
make install -j10
build failure log
You can see functions like dfs$png_get_header_ver are missing for build binary pngtest, but function png_get_header_ver is present in current source folder.
libtool: link: /angora/bin/angora-clang -fPIC -fPIC -o .libs/pngtest pngtest.o ./.libs/libpng15.so -lm -lz -Wl,-rpath -Wl,/d/prog/libpng-1.5.19.angora/install/lib
rule_list : /d/prog/libpng-1.5.19.angora/zlib_abilist.txt
clang -fPIC -fPIC -o .libs/pngtest pngtest.o ./.libs/libpng15.so -lm -lz -Wl,-rpath -Wl,/d/prog/libpng-1.5.19.angora/install/lib -Xclang -load -Xclang /angora/bin/unfold-branch-pass.so -Xclang -load -Xclang /angora/bin/angora-llvm-pass.so -mllvm -TrackMode -mllvm -angora-dfsan-abilist=/angora/bin/angora_abilist.txt -mllvm -angora-dfsan-abilist=/angora/bin/dfsan_abilist.txt -mllvm -angora-exploitation-list=/angora/bin/exploitation_list.txt -mllvm -angora-dfsan-abilist=/d/prog/libpng-1.5.19.angora/zlib_abilist.txt -Xclang -load -Xclang /angora/bin/DFSanPass.so -mllvm -angora-dfsan-abilist2=/angora/bin/angora_abilist.txt -mllvm -angora-dfsan-abilist2=/angora/bin/dfsan_abilist.txt -mllvm -angora-dfsan-abilist2=/d/prog/libpng-1.5.19.angora/zlib_abilist.txt -pie -fpic -Qunused-arguments -g -O3 -funroll-loops -Wl,--whole-archive /angora/bin/DFSanRT.a -Wl,--no-whole-archive -Wl,--dynamic-list=/angora/bin/DFSanRT.a.syms /angora/bin/libruntime.a /angora/bin/io-func.o /angora/bin/stdalloc.o -lstdc++ -lrt -Wl,--no-as-needed -Wl,--gc-sections -ldl -lpthread -lm
pngtest.o: In function `main':
/d/prog/libpng-1.5.19.angora/pngtest.c:1702: undefined reference to `dfs$png_get_copyright'
/d/prog/libpng-1.5.19.angora/pngtest.c:1705: undefined reference to `dfs$png_access_version_number'
/d/prog/libpng-1.5.19.angora/pngtest.c:1706: undefined reference to `dfs$png_get_header_version'
/d/prog/libpng-1.5.19.angora/pngtest.c:1725: undefined reference to `dfs$png_get_header_ver'
/d/prog/libpng-1.5.19.angora/pngtest.c:1730: undefined reference to `dfs$png_get_header_ver'
pngtest.o: In function `test_one_file':
/d/prog/libpng-1.5.19.angora/pngtest.c:875: undefined reference to `dfs$png_create_read_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:877: undefined reference to `dfs$png_set_error_fn'
/d/prog/libpng-1.5.19.angora/pngtest.c:887: undefined reference to `dfs$png_create_write_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:889: undefined reference to `dfs$png_set_error_fn'
/d/prog/libpng-1.5.19.angora/pngtest.c:893: undefined reference to `dfs$png_create_info_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:894: undefined reference to `dfs$png_create_info_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:896: undefined reference to `dfs$png_create_info_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:897: undefined reference to `dfs$png_create_info_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:902: undefined reference to `dfs$png_set_read_user_chunk_fn'
/d/prog/libpng-1.5.19.angora/pngtest.c:908: undefined reference to `dfs$png_set_longjmp_fn'
/d/prog/libpng-1.5.19.angora/pngtest.c:911: undefined reference to `dfs$png_free'
/d/prog/libpng-1.5.19.angora/pngtest.c:913: undefined reference to `dfs$png_destroy_read_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:915: undefined reference to `dfs$png_destroy_info_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:916: undefined reference to `dfs$png_destroy_write_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:926: undefined reference to `dfs$png_set_longjmp_fn'
/d/prog/libpng-1.5.19.angora/pngtest.c:929: undefined reference to `dfs$png_destroy_read_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:930: undefined reference to `dfs$png_destroy_info_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:932: undefined reference to `dfs$png_destroy_write_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:944: undefined reference to `dfs$png_set_benign_errors'
/d/prog/libpng-1.5.19.angora/pngtest.c:960: undefined reference to `dfs$png_set_benign_errors'
/d/prog/libpng-1.5.19.angora/pngtest.c:(.text+0xc384): undefined reference to `dfs$png_set_benign_errors'
/d/prog/libpng-1.5.19.angora/pngtest.c:969: undefined reference to `dfs$png_init_io'
/d/prog/libpng-1.5.19.angora/pngtest.c:971: undefined reference to `dfs$png_init_io'
/d/prog/libpng-1.5.19.angora/pngtest.c:988: undefined reference to `dfs$png_set_write_status_fn'
/d/prog/libpng-1.5.19.angora/pngtest.c:996: undefined reference to `dfs$png_set_write_status_fn'
/d/prog/libpng-1.5.19.angora/pngtest.c:(.text+0xce3e): undefined reference to `dfs$png_set_read_status_fn'
/d/prog/libpng-1.5.19.angora/pngtest.c:1008: undefined reference to `dfs$png_set_read_user_transform_fn'
/d/prog/libpng-1.5.19.angora/pngtest.c:1013: undefined reference to `dfs$png_set_write_user_transform_fn'
/d/prog/libpng-1.5.19.angora/pngtest.c:1036: undefined reference to `dfs$png_read_info'
/d/prog/libpng-1.5.19.angora/pngtest.c:1051: undefined reference to `dfs$png_get_IHDR'
/d/prog/libpng-1.5.19.angora/pngtest.c:1054: undefined reference to `dfs$png_set_IHDR'
/d/prog/libpng-1.5.19.angora/pngtest.c:1084: undefined reference to `dfs$png_get_cHRM_fixed'
/d/prog/libpng-1.5.19.angora/pngtest.c:1087: undefined reference to `dfs$png_set_cHRM_fixed'
/d/prog/libpng-1.5.19.angora/pngtest.c:1096: undefined reference to `dfs$png_get_gAMA_fixed'
/d/prog/libpng-1.5.19.angora/pngtest.c:1097: undefined reference to `dfs$png_set_gAMA_fixed'
/d/prog/libpng-1.5.19.angora/pngtest.c:1132: undefined reference to `dfs$png_get_iCCP'
/d/prog/libpng-1.5.19.angora/pngtest.c:1135: undefined reference to `dfs$png_set_iCCP'
/d/prog/libpng-1.5.19.angora/pngtest.c:1144: undefined reference to `dfs$png_get_sRGB'
/d/prog/libpng-1.5.19.angora/pngtest.c:1145: undefined reference to `dfs$png_set_sRGB'
/d/prog/libpng-1.5.19.angora/pngtest.c:1152: undefined reference to `dfs$png_get_PLTE'
/d/prog/libpng-1.5.19.angora/pngtest.c:1153: undefined reference to `dfs$png_set_PLTE'
/d/prog/libpng-1.5.19.angora/pngtest.c:1159: undefined reference to `dfs$png_get_bKGD'
/d/prog/libpng-1.5.19.angora/pngtest.c:1161: undefined reference to `dfs$png_set_bKGD'
/d/prog/libpng-1.5.19.angora/pngtest.c:1169: undefined reference to `dfs$png_get_hIST'
/d/prog/libpng-1.5.19.angora/pngtest.c:1170: undefined reference to `dfs$png_set_hIST'
/d/prog/libpng-1.5.19.angora/pngtest.c:1178: undefined reference to `dfs$png_get_oFFs'
/d/prog/libpng-1.5.19.angora/pngtest.c:1181: undefined reference to `dfs$png_set_oFFs'
/d/prog/libpng-1.5.19.angora/pngtest.c:1192: undefined reference to `dfs$png_get_pCAL'
/d/prog/libpng-1.5.19.angora/pngtest.c:1195: undefined reference to `dfs$png_set_pCAL'
/d/prog/libpng-1.5.19.angora/pngtest.c:1205: undefined reference to `dfs$png_get_pHYs'
/d/prog/libpng-1.5.19.angora/pngtest.c:1206: undefined reference to `dfs$png_set_pHYs'
/d/prog/libpng-1.5.19.angora/pngtest.c:1213: undefined reference to `dfs$png_get_sBIT'
/d/prog/libpng-1.5.19.angora/pngtest.c:1214: undefined reference to `dfs$png_set_sBIT'
/d/prog/libpng-1.5.19.angora/pngtest.c:1224: undefined reference to `dfs$png_get_sCAL'
/d/prog/libpng-1.5.19.angora/pngtest.c:1227: undefined reference to `dfs$png_set_sCAL'
/d/prog/libpng-1.5.19.angora/pngtest.c:1251: undefined reference to `dfs$png_get_text'
/d/prog/libpng-1.5.19.angora/pngtest.c:1269: undefined reference to `dfs$png_set_text'
/d/prog/libpng-1.5.19.angora/pngtest.c:1277: undefined reference to `dfs$png_get_tIME'
/d/prog/libpng-1.5.19.angora/pngtest.c:1279: undefined reference to `dfs$png_set_tIME'
/d/prog/libpng-1.5.19.angora/pngtest.c:1286: undefined reference to `dfs$png_convert_to_rfc1123'
/d/prog/libpng-1.5.19.angora/pngtest.c:1301: undefined reference to `dfs$png_get_tRNS'
/d/prog/libpng-1.5.19.angora/pngtest.c:1312: undefined reference to `dfs$png_set_tRNS'
/d/prog/libpng-1.5.19.angora/pngtest.c:1320: undefined reference to `dfs$png_get_unknown_chunks'
/d/prog/libpng-1.5.19.angora/pngtest.c:1325: undefined reference to `dfs$png_set_unknown_chunks'
/d/prog/libpng-1.5.19.angora/pngtest.c:1335: undefined reference to `dfs$png_set_unknown_chunk_location'
/d/prog/libpng-1.5.19.angora/pngtest.c:1349: undefined reference to `dfs$png_write_info_before_PLTE'
/d/prog/libpng-1.5.19.angora/pngtest.c:1353: undefined reference to `dfs$png_write_info'
/d/prog/libpng-1.5.19.angora/pngtest.c:1361: undefined reference to `dfs$png_get_rowbytes'
/d/prog/libpng-1.5.19.angora/pngtest.c:1360: undefined reference to `dfs$png_malloc'
/d/prog/libpng-1.5.19.angora/pngtest.c:1368: undefined reference to `dfs$png_set_interlace_handling'
/d/prog/libpng-1.5.19.angora/pngtest.c:1369: undefined reference to `dfs$png_set_interlace_handling'
/d/prog/libpng-1.5.19.angora/pngtest.c:1392: undefined reference to `dfs$png_read_rows'
/d/prog/libpng-1.5.19.angora/pngtest.c:1400: undefined reference to `dfs$png_write_rows'
/d/prog/libpng-1.5.19.angora/pngtest.c:1427: undefined reference to `dfs$png_read_end'
/d/prog/libpng-1.5.19.angora/pngtest.c:1433: undefined reference to `dfs$png_get_text'
/d/prog/libpng-1.5.19.angora/pngtest.c:1451: undefined reference to `dfs$png_set_text'
/d/prog/libpng-1.5.19.angora/pngtest.c:1459: undefined reference to `dfs$png_get_tIME'
/d/prog/libpng-1.5.19.angora/pngtest.c:1461: undefined reference to `dfs$png_set_tIME'
/d/prog/libpng-1.5.19.angora/pngtest.c:1467: undefined reference to `dfs$png_convert_to_rfc1123'
/d/prog/libpng-1.5.19.angora/pngtest.c:1479: undefined reference to `dfs$png_get_unknown_chunks'
/d/prog/libpng-1.5.19.angora/pngtest.c:1484: undefined reference to `dfs$png_set_unknown_chunks'
/d/prog/libpng-1.5.19.angora/pngtest.c:1494: undefined reference to `dfs$png_set_unknown_chunk_location'
/d/prog/libpng-1.5.19.angora/pngtest.c:1508: undefined reference to `dfs$png_set_text_compression_strategy'
/d/prog/libpng-1.5.19.angora/pngtest.c:1519: undefined reference to `dfs$png_write_end'
/d/prog/libpng-1.5.19.angora/pngtest.c:1526: undefined reference to `dfs$png_get_image_width'
/d/prog/libpng-1.5.19.angora/pngtest.c:1527: undefined reference to `dfs$png_get_image_height'
/d/prog/libpng-1.5.19.angora/pngtest.c:1536: undefined reference to `dfs$png_free'
/d/prog/libpng-1.5.19.angora/pngtest.c:1540: undefined reference to `dfs$png_destroy_read_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:1543: undefined reference to `dfs$png_destroy_info_struct'
/d/prog/libpng-1.5.19.angora/pngtest.c:1545: undefined reference to `dfs$png_destroy_write_struct'
pngtest.o: In function `pngtest_check_text_support':
/d/prog/libpng-1.5.19.angora/pngtest.c:819: undefined reference to `dfs$png_error'
/d/prog/libpng-1.5.19.angora/pngtest.c:819: undefined reference to `dfs$png_error'
pngtest.o: In function `test_one_file':
/d/prog/libpng-1.5.19.angora/pngtest.c:1370: undefined reference to `dfs$png_error'
pngtest.o: In function `pngtest_warning':
/d/prog/libpng-1.5.19.angora/pngtest.c:439: undefined reference to `dfs$png_get_error_ptr'
/d/prog/libpng-1.5.19.angora/pngtest.c:439: undefined reference to `dfs$png_get_error_ptr'
pngtest.o: In function `read_user_chunk_callback':
/d/prog/libpng-1.5.19.angora/pngtest.c:674: undefined reference to `dfs$png_get_user_chunk_ptr'
/d/prog/libpng-1.5.19.angora/pngtest.c:724: undefined reference to `dfs$png_get_uint_31'
/d/prog/libpng-1.5.19.angora/pngtest.c:725: undefined reference to `dfs$png_get_uint_31'
/d/prog/libpng-1.5.19.angora/pngtest.c:677: undefined reference to `dfs$png_error'
pngtest.o: In function `write_vpAg_chunk':
/d/prog/libpng-1.5.19.angora/pngtest.c:756: undefined reference to `dfs$png_save_uint_32'
/d/prog/libpng-1.5.19.angora/pngtest.c:757: undefined reference to `dfs$png_save_uint_32'
pngtest.o: In function `write_chunks':
/d/prog/libpng-1.5.19.angora/pngtest.c:(.text+0x2d463): undefined reference to `dfs$png_write_chunk'
pngtest.o: In function `write_vpAg_chunk':
/d/prog/libpng-1.5.19.angora/pngtest.c:756: undefined reference to `dfs$png_save_uint_32'
/d/prog/libpng-1.5.19.angora/pngtest.c:757: undefined reference to `dfs$png_save_uint_32'
pngtest.o: In function `write_chunks':
/d/prog/libpng-1.5.19.angora/pngtest.c:(.text+0x2e5d9): undefined reference to `dfs$png_write_chunk'
pngtest.o: In function `set_location':
/d/prog/libpng-1.5.19.angora/pngtest.c:655: undefined reference to `dfs$png_get_valid'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:651: recipe for target 'pngtest' failed
make[1]: *** [pngtest] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/d/prog/libpng-1.5.19.angora'
Makefile:535: recipe for target 'all' failed
make: *** [all] Error 2
extra notes for continue build gif2png
wget http://www.catb.org/~esr/gif2png/gif2png-2.5.8.tar.gz
tar zxvf gif2png-2.5.8.tar.gz
./configure --with-png-lib=/d/prog/libpng-1.5.19.angora/install/lib --with-png-inc=/d/prog/libpng-1.5.19.angora/install/include
make
# I want to get a static build without need for libpng.so, so let's finish last step with a minor change `-lpng` to `-l:libpng.a`
# credit: https://stackoverflow.com/questions/6578484/telling-gcc-directly-to-link-a-library-statically
/angora/bin/angora-clang -I/d/prog/libpng-1.5.19.angora/install/include -g -O2 -L/d/prog/libpng-1.5.19.angora/install/lib -o gif2png 437_l1.o gif2png.o gifread.o memory.o version.o -l:libpng.a -lm -lz
configure libpng with --disable-shared can avoid this. Thanks @spinpx for point it out.
./configure --disable-shared --prefix=`pwd`/install CFLAGS="-fPIC" CXXFLAGS="-fPIC" LDFLAGS="-fPIC"