Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
freetype-2.5.0.1 fails to cross-compile
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
gemarcano
n00b
n00b


Joined: 04 Jun 2012
Posts: 72
Location: Virginia

PostPosted: Mon Oct 14, 2013 8:39 pm    Post subject: freetype-2.5.0.1 fails to cross-compile Reply with quote

Heh, there is no end of packages that won't neatly cross-compile.

Before I forget, I'm cross-compiling from ~amd64 to ~arm (armv6zk).

The cross-compilation fails with this error:
Code:
/usr/libexec/gcc/armv6zk-hardfloat-linux-gnueabihf/ld: skipping incompatible /usr/lib64/libz.so when searching for -lz
/usr/lib64/libz.a: could not read symbols: File format not recognized
collect2: error: ld returned 1 exit status

Out of curiosity I grepped for warnings, and got all of this:
Code:
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libpng16" is unsafe for cross-compilation [-Wpoison-system-directories]

From my experience this weekend with mpfr and coreutils, these warnings hint that the build is using my system libraries and includes instead of the ones found in the cross-compile environment. A quick glance at the config.log file reveals just that:
Code:
CFLAGS='-O2 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe  -fomit-frame-pointer -fno-strict-aliasing -DFT_CONFIG_OPTION_SYSTEM_ZLIB -DFT_CONFIG_OPTION_USE_BZIP2 -I/usr/include/libpng16 -DFT_CONFIG_OPTION_USE_PNG'

It seems configure finds the libpng16 includes on its own:
Code:
configure:4772: checking for libpng
configure:4784: result: -L/usr/lib64 -lpng16

As best as I can tell there is not configure parameter available for changing this specific library location... it may be possible to provide configure a cached result of the location of the library, but then that implies that the library exists, which may not always be true (well, portage makes sure that the dependencies are installed, but sometimes things slip through the cracks). I'll keep working on this as I have time this upcoming week. Thoughts?
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8592

PostPosted: Mon Oct 14, 2013 9:32 pm    Post subject: Reply with quote

The correct way for a configure script to find a package is to ask pkg-config for the CFLAGS/LDFLAGS required to use it. In turn, a properly prepared cross-compile environment should cause pkg-config to return the flags for the cross-system directories instead of the native directories. Could you provide the config.log context (~100 lines) around where it reports result: -L/usr/lib64 -lpng16?
Back to top
View user's profile Send private message
gemarcano
n00b
n00b


Joined: 04 Jun 2012
Posts: 72
Location: Virginia

PostPosted: Mon Oct 14, 2013 9:55 pm    Post subject: Reply with quote

Here are about 100 lines around where the config.log presents that configure has found -lpng16:
Code:
configure:4568: armv6zk-hardfloat-linux-gnueabihf-gcc -o conftest -O2 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe  -fomit-frame-pointer -fno-strict-aliasing  -Wl,-O1 -Wl,--as-needed conftest.c  >&5
conftest.c:50:6: warning: conflicting types for built-in function 'memcpy' [enabled by default]
 char memcpy ();
      ^
configure:4568: $? = 0
configure:4568: result: yes
configure:4568: checking for memmove
configure:4568: armv6zk-hardfloat-linux-gnueabihf-gcc -o conftest -O2 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe  -fomit-frame-pointer -fno-strict-aliasing  -Wl,-O1 -Wl,--as-needed conftest.c  >&5
conftest.c:51:6: warning: conflicting types for built-in function 'memmove' [enabled by default]
 char memmove ();
      ^
configure:4568: $? = 0
configure:4568: result: yes
configure:4591: checking gcc compiler flag -pedantic to assure ANSI C works correctly
configure:4608: armv6zk-hardfloat-linux-gnueabihf-gcc -c -O2 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe  -fomit-frame-pointer -fno-strict-aliasing  -pedantic  conftest.c >&5
configure:4608: $? = 0
configure:4610: result: ok, add it to XX_ANSIFLAGS
configure:4591: checking gcc compiler flag -ansi to assure ANSI C works correctly
configure:4608: armv6zk-hardfloat-linux-gnueabihf-gcc -c -O2 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe  -fomit-frame-pointer -fno-strict-aliasing  -pedantic -ansi  conftest.c >&5
configure:4608: $? = 0
configure:4610: result: ok, add it to XX_ANSIFLAGS
configure:4650: checking for gzsetparams in -lz
configure:4675: armv6zk-hardfloat-linux-gnueabihf-gcc -o conftest -O2 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe  -fomit-frame-pointer -fno-strict-aliasing  -Wl,-O1 -Wl,--as-needed conftest.c -lz   >&5
configure:4675: $? = 0
configure:4684: result: yes
configure:4687: checking zlib.h usability
configure:4687: armv6zk-hardfloat-linux-gnueabihf-gcc -c -O2 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe  -fomit-frame-pointer -fno-strict-aliasing  conftest.c >&5
configure:4687: $? = 0
configure:4687: result: yes
configure:4687: checking zlib.h presence
configure:4687: armv6zk-hardfloat-linux-gnueabihf-gcc -E  conftest.c
configure:4687: $? = 0
configure:4687: result: yes
configure:4687: checking for zlib.h
configure:4687: result: yes
configure:4711: checking for BZ2_bzDecompress in -lbz2
configure:4736: armv6zk-hardfloat-linux-gnueabihf-gcc -o conftest -O2 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe  -fomit-frame-pointer -fno-strict-aliasing  -Wl,-O1 -Wl,--as-needed conftest.c -lbz2   >&5
configure:4736: $? = 0
configure:4745: result: yes
configure:4748: checking bzlib.h usability
configure:4748: armv6zk-hardfloat-linux-gnueabihf-gcc -c -O2 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe  -fomit-frame-pointer -fno-strict-aliasing  conftest.c >&5
configure:4748: $? = 0
configure:4748: result: yes
configure:4748: checking bzlib.h presence
configure:4748: armv6zk-hardfloat-linux-gnueabihf-gcc -E  conftest.c
configure:4748: $? = 0
configure:4748: result: yes
configure:4748: checking for bzlib.h
configure:4748: result: yes
configure:4772: checking for libpng
configure:4784: result: -L/usr/lib64 -lpng16
configure:4817: checking whether CFLAGS and LDFLAGS share -march=armv6zk
configure:4824: result: no, copy to LDFLAGS
configure:5421: checking how to print strings
configure:5448: result: printf
configure:5469: checking for a sed that does not truncate output
configure:5533: result: /bin/sed
configure:5551: checking for fgrep
configure:5613: result: /bin/grep -F
configure:5648: checking for ld used by armv6zk-hardfloat-linux-gnueabihf-gcc
configure:5715: result: /usr/libexec/gcc/armv6zk-hardfloat-linux-gnueabihf/ld
configure:5722: checking if the linker (/usr/libexec/gcc/armv6zk-hardfloat-linux-gnueabihf/ld) is GNU ld
configure:5737: result: yes
configure:5749: checking for BSD- or MS-compatible name lister (nm)
configure:5798: result: /usr/bin/armv6zk-hardfloat-linux-gnueabihf-nm -B
configure:5928: checking the name lister (/usr/bin/armv6zk-hardfloat-linux-gnueabihf-nm -B) interface
configure:5935: armv6zk-hardfloat-linux-gnueabihf-gcc -c -O2 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe  -fomit-frame-pointer -fno-strict-aliasing  conftest.c >&5
configure:5938: /usr/bin/armv6zk-hardfloat-linux-gnueabihf-nm -B "conftest.o"
configure:5941: output
00000000 B some_variable
configure:5948: result: BSD nm
configure:5951: checking whether ln -s works
configure:5955: result: yes
configure:5963: checking the maximum length of command line arguments
configure:6093: result: 1572864
configure:6110: checking whether the shell understands some XSI constructs
configure:6120: result: yes
configure:6124: checking whether the shell understands "+="
configure:6130: result: yes
configure:6165: checking how to convert x86_64-pc-linux-gnu file names to armv6zk-hardfloat-linux-gnueabihf format
configure:6205: result: func_convert_file_noop
configure:6212: checking how to convert x86_64-pc-linux-gnu file names to toolchain format
configure:6232: result: func_convert_file_noop
configure:6239: checking for /usr/libexec/gcc/armv6zk-hardfloat-linux-gnueabihf/ld option to reload object files
configure:6246: result: -r
configure:6280: checking for armv6zk-hardfloat-linux-gnueabihf-objdump
configure:6296: found /usr/bin/armv6zk-hardfloat-linux-gnueabihf-objdump
configure:6307: result: armv6zk-hardfloat-linux-gnueabihf-objdump
configure:6376: checking how to recognize dependent libraries
configure:6578: result: pass_all
configure:6623: checking for armv6zk-hardfloat-linux-gnueabihf-dlltool
configure:6653: result: no
configure:6663: checking for dlltool
configure:6693: result: no
configure:6720: checking how to associate runtime and link libraries
configure:6747: result: printf %s\n
configure:6763: checking for armv6zk-hardfloat-linux-gnueabihf-ar
configure:6779: found /usr/bin/armv6zk-hardfloat-linux-gnueabihf-ar
configure:6790: result: armv6zk-hardfloat-linux-gnueabihf-ar
configure:6871: checking for archiver @FILE support
configure:6888: armv6zk-hardfloat-linux-gnueabihf-gcc -c -O2 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe  -fomit-frame-pointer -fno-strict-aliasing  conftest.c >&5
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum