obfsproxy: "warning: -fPIC ignored for target (all code is position independent)" when compilign on Windows
Compilation in Windows fails with
src/container.c:1: warning: -fPIC ignored for target (all code is position independent)
This was most probably introduced by #5131 (closed) and is around from obfsproxy-0.1.1.
- Show closed items
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Author
Trac:
KgQpWKG0.txt - Author
I attached a patch from 'rsavoye' that seems to solve the problem.
Note: When I initially tried the patch, I got this error:
gcc -Wall -Wwrite-strings -Werror -I/usr/local/include -I/usr/local/ssl/include -g -O2 -o obfsproxy.exe obfs_main.o libobfsproxy.a -L/usr/local/lib -levent -L/usr/local/ssl/lib -lssl -lcrypto -mwindows @ws32_LIBS@ gcc.exe: @ws32_LIBS@: No such file or directory
I had to revert the changes that the patch does to
configure.ac
(that is, I had to uncomment AX_LIB_WINSOCK2 again). Then the patch worked.Trac:
Status: new to needs_review hrm. Here's another idea:
diff --git a/m4/ax_build_hardening.m4 b/m4/ax_build_hardening.m4 index 590a00d..ad06fcc 100644 --- a/m4/ax_build_hardening.m4 +++ b/m4/ax_build_hardening.m4 @@ -46,18 +46,19 @@ AC_DEFUN_ONCE([AX_ENABLE_HARDENING], [ ### Compiler Hardening ### # This requires ax_check_compile_flag.m4 -AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2], [CFLAGS="$CFLAGS -D_FORTIFY_SOURCE -AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [CFLAGS="$CFLAGS -fstack-protect -AX_CHECK_COMPILE_FLAG([-fwrapv], [CFLAGS="$CFLAGS -fwrapv"]) -AX_CHECK_COMPILE_FLAG([-fPIE], [CFLAGS="$CFLAGS -fPIE"]) -AX_CHECK_COMPILE_FLAG([--param ssp-buffer-size=1], [CFLAGS="$CFLAGS --param ssp -AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-alia -AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CFLAGS="$CFLAGS -fno-strict-over +AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2], [CFLAGS="$CFLAGS -D_FORTIFY_SOURCE +AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [CFLAGS="$CFLAGS -fstack-protect +AX_CHECK_COMPILE_FLAG([-fwrapv], [CFLAGS="$CFLAGS -fwrapv"], [], [-Werror]) +AX_CHECK_COMPILE_FLAG([-fPIE], [CFLAGS="$CFLAGS -fPIE"], [], [-Werror]) +AX_CHECK_COMPILE_FLAG([--param ssp-buffer-size=1], [CFLAGS="$CFLAGS --param ssp +AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-alia +AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CFLAGS="$CFLAGS -fno-strict-over ### Linker Hardening ### # This requires ax_check_link_flag.m4 -AX_CHECK_LINK_FLAG([-pie], [LDFLAGS="$LDFLAGS -pie"]) -AX_CHECK_LINK_FLAG([-z relro], [LDFLAGS="$LDFLAGS -z relro"]) -AX_CHECK_LINK_FLAG([-z now], [LDFLAGS="$LDFLAGS -z now"]) +AX_CHECK_LINK_FLAG([-pie], [LDFLAGS="$LDFLAGS -pie"], [], [-Werror]) +AX_CHECK_LINK_FLAG([-Wl,-pie], [LDFLAGS="$LDFLAGS -Wl,-pie"], [], [-Werror]) +AX_CHECK_LINK_FLAG([-z relro], [LDFLAGS="$LDFLAGS -z relro"], [], [-Werror]) +AX_CHECK_LINK_FLAG([-z now], [LDFLAGS="$LDFLAGS -z now"], [], [-Werror]) ])
- Author
Replying to Sebastian:
hrm. Here's another idea:
oops, seems like your patch was cut-off in the edges. I tried to fix it:
Please see
bug5665
inhttps://git.gitorious.org/obfsproxy/obfsproxy.git
: https://gitorious.org/obfsproxy/obfsproxy/commit/a98c9b6494a93a91bf654db89f29dc6584fe06f9 branch bug5665 in my repo
- Author
Merged Sebastian's branch. Thanks!
Trac:
Resolution: N/A to fixed
Status: needs_review to closed - Trac closed
closed