Configured for linux-x86_64. >>> Source configured. >>> Compiling source in /usr/i686-pc-mingw32/tmp/portage/dev-libs/openssl-1.0.0d/work/openssl-1.0.0d ... make -j6 -j1 depend making depend in crypto... make[1]: Entering directory `/usr/i686-pc-mingw32/tmp/portage/dev-libs/openssl-1.0.0d/work/openssl-1.0.0d/crypto' cc1: warnings being treated as errors cc1: error: -fPIC ignored for target (all code is position independent) cc1: warnings being treated as errors cc1: error: -fPIC ignored for target (all code is position independent) cc1: warnings being treated as errors cc1: error: -fPIC ignored for target (all code is position independent) cc1: warnings being treated as errors cc1: error: -fPIC ignored for target (all code is position independent) cc1: warnings being treated as errors cc1: error: -fPIC ignored for target (all code is position independent) cc1: warnings being treated as errors cc1: error: -fPIC ignored for target (all code is position independent) cc1: warnings being treated as errors cc1: error: -fPIC ignored for target (all code is position independent) cc1: warnings being treated as errors cc1: error: -fPIC ignored for target (all code is position independent) cc1: warnings being treated as errors cc1: error: -fPIC ignored for target (all code is position independent) cc1: warnings being treated as errors cc1: error: -fPIC ignored for target (all code is position independent) cc1: warnings being treated as errors cc1: error: -fPIC ignored for target (all code is position independent) cc1: warnings being treated as errors cc1: error: -fPIC ignored for target (all code is position independent) make[1]: *** [depend] Error 1 make[1]: Leaving directory `/usr/i686-pc-mingw32/tmp/portage/dev-libs/openssl-1.0.0d/work/openssl-1.0.0d/crypto' make: *** [depend] Error 1 emake failed * ERROR: dev-libs/openssl-1.0.0d failed (compile phase): * depend failed * * Call stack: * ebuild.sh, line 56: Called src_compile * environment, line 2494: Called die * The specific snippet of code: * emake -j1 depend || die "depend failed"; Reproducible: Always Steps to Reproduce: 1. i686-pc-mingw32-emerge -vat openssl 2. 3.
there is no mingw support in the openssl ebuild atm always post `emerge --info` with your bug reports as well as the full build log as an attachment
(In reply to comment #1) > there is no mingw support in the openssl ebuild atm There is a specific Makefile available here http://files.rfc2324.org/patches/openvpn/build-for-w32/openssl-Makefile-mingw32 But that kind of things could be incorporated in vanilla Makefile with some effort, this is the main goal. > always post `emerge --info` with your bug reports as well as the full build log > as an attachment Anyway, here they are # i686-pc-mingw32-emerge --info Portage 2.1.10.3 (embedded, gcc-4.4.5, unavailable, 2.6.38-gentoo-r1 x86_64) ================================================================= System uname: Linux-2.6.38-gentoo-r1-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9650_@_3.00GHz-with-gentoo-2.0.3 Timestamp of tree: Sun, 03 Jul 2011 13:15:01 +0000 app-shells/bash: 4.2_p10 dev-lang/python: 2.7.2, 3.2 dev-util/cmake: 2.8.4-r1 dev-util/pkgconfig: 0.26 sys-apps/baselayout: 2.0.3 sys-apps/openrc: 0.8.3-r1 sys-apps/sandbox: 2.5 sys-devel/autoconf: 2.13, 2.68 sys-devel/automake: 1.9.6-r3, 1.11.1-r1 sys-devel/binutils: 2.21.1 sys-devel/gcc: 4.5.2 sys-devel/gcc-config: 1.4.1-r1 sys-devel/libtool: 2.4-r1 sys-devel/make: 3.82-r1 sys-kernel/linux-headers: 2.6.38 (virtual/os-headers) sys-libs/glibc: 2.13-r2 Repositories: gentoo meleeweb sunrise ACCEPT_KEYWORDS="x86 ~x86" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-Os -pipe -fomit-frame-pointer -I/usr/i686-pc-mingw32/usr/include/ -I/usr/i686-pc-mingw32/include/" CHOST="i686-pc-mingw32" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-Os -pipe -fomit-frame-pointer -I/usr/i686-pc-mingw32/usr/include/ -I/usr/i686-pc-mingw32/include/" DISTDIR="/usr/portage/distfiles" FEATURES="assume-digests binpkg-logs buildpkg distlocks ebuild-locks fixlafiles fixpackages nodoc noinfo noman parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch" FFLAGS="" GENTOO_MIRRORS=" http://ftp.free.fr/mirrors/ftp.gentoo.org" LDFLAGS="-L/usr/i686-pc-mingw32/lib -L/usr/i686-pc-mingw32/usr/lib" LINGUAS="en" MAKEOPTS="-j6" PKGDIR="/usr/i686-pc-mingw32/packages/" PORTAGE_CONFIGROOT="/usr/i686-pc-mingw32/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/usr/i686-pc-mingw32/tmp/" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/var/lib/layman/sunrise /opt/meleeweb/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="bindist kdrive make-symlinks minimal modules multicall x86 zlib" ELIBC="__LIBC__" INPUT_DEVICES="evdev mouse keyboard tslib" KERNEL="linux" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="fbdev" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Created attachment 278939 [details] openssl-1.0.0d/temp/build.log
i'm not keen on maintaining more custom logic in the openssl ebuild. if the upstream package doesnt support mingw, then it should get fixed. then we can add the fixes they added upstream to the current ebuilds in the tree. in this case, at least files/gentoo.config-1.0.0 needs updating to handle mingw targets as the build atm is simply detecting your build system. --- files/gentoo.config-1.0.0 +++ files/gentoo.config-1.0.0 @@ -61,6 +61,7 @@ *-linux*) system="linux";; *-solaris*) system="solaris";; *-winnt*) system="winnt";; + *mingw*) system="mingw";; *) exit 0;; esac @@ -144,6 +145,10 @@ winnt) machine=parity ;; +mingw) + # special case ... no xxx-yyy style name + echo ${system} + ;; esac
Created attachment 278961 [details, diff] openssl-1.0.0d.ebuild-BJA-mingw-execstack.diff Building failed as we adjust CFLAGS to add -Wa,--noexecstack that is not supported by mingw32 make[1]: Entering directory `/usr/i686-pc-mingw32/tmp/portage/dev-libs/openssl-1.0.0d/work/openssl-1.0.0d/crypto' ( echo "#ifndef MK1MF_BUILD"; \ echo ' /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \ echo ' #define CFLAGS "i686-pc-mingw32-gcc -D_WINDLL -DOPENSSL_USE_APPLINK -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_MT -DDSO_WIN32 -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DWHIRLPOOL_ASM -Os -pipe -fomit-frame-pointer -I/usr/i686-pc-mingw32/usr/include/ -I/usr/i686-pc-mingw32/include/ -fno-strict-aliasing -Wa,--noexecstack"'; \ echo ' #define PLATFORM "mingw"'; \ echo " #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \ echo '#endif' ) >buildinf.h i686-pc-mingw32-gcc -I. -I.. -I../include -D_WINDLL -DOPENSSL_USE_APPLINK -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_MT -DDSO_WIN32 -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DWHIRLPOOL_ASM -Os -pipe -fomit-frame-pointer -I/usr/i686-pc-mingw32/usr/include/ -I/usr/i686-pc-mingw32/include/ -fno-strict-aliasing -Wa,--noexecstack -c -o cryptlib.o cryptlib.c /usr/libexec/gcc/i686-pc-mingw32/as: unrecognized option '--noexecstack' make[1]: *** [cryptlib.o] Error 2 The patch add conditional append-flags
Created attachment 278967 [details, diff] openssl-1.0.0d.ebuild-BJA-no-CC-AR-RANLIB.diff Building fail as ebuild set CC AR RANLIB but mingw32 need $(CROSS_COMPILE)windres. make[4]: Entering directory `/usr/i686-pc-mingw32/tmp/portage/dev-libs/openssl-1.0.0d/work/openssl-1.0.0d' /bin/sh: line 17: windres: command not found + LIBDEPS='-L. -lws2_32 -lgdi32 -lcrypt32 -lz' + SHAREDCMD=i686-pc-mingw32-gcc + SHAREDFLAGS='-D_WINDLL -DOPENSSL_USE_APPLINK -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_MT -DDSO_WIN32 -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DWHIRLPOOL_ASM -Os -pipe -fomit-frame-pointer -I/usr/i686-pc-mingw32/usr/include/ -I/usr/i686-pc-mingw32/include/ -fno-strict-aliasing -L/usr/i686-pc-mingw32/lib -L/usr/i686-pc-mingw32/usr/lib -shared -Wl,--image-base,0x63000000 -Wl,-s,-Bsymbolic -Wl,--out-implib,libcrypto.dll.a crypto.def rc.o' ++ for x in '$LIBDEPS' ++ echo -L. ++ for x in '$LIBDEPS' ++ echo -lws2_32 ++ for x in '$LIBDEPS' ++ echo -lgdi32 ++ for x in '$LIBDEPS' ++ echo -lcrypt32 ++ for x in '$LIBDEPS' ++ sed -e 's/^ *-L//;t' -e d ++ echo -lz ++ uniq + LIBPATH=. ++ echo . ++ sed -e 's/ /:/g' + LIBPATH=. + LD_LIBRARY_PATH=.: + i686-pc-mingw32-gcc -D_WINDLL -DOPENSSL_USE_APPLINK -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_MT -DDSO_WIN32 -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DWHIRLPOOL_ASM -Os -pipe -fomit-frame-pointer -I/usr/i686-pc-mingw32/usr/include/ -I/usr/i686-pc-mingw32/include/ -fno-strict-aliasing -L/usr/i686-pc-mingw32/lib -L/usr/i686-pc-mingw32/usr/lib -shared -Wl,--image-base,0x63000000 -Wl,-s,-Bsymbolic -Wl,--out-implib,libcrypto.dll.a crypto.def rc.o -o libeay32.dll -Wl,--whole-archive libcrypto.a -Wl,--no-whole-archive -L. -lws2_32 -lgdi32 -lcrypt32 -lz i686-pc-mingw32-gcc: rc.o: No such file or directory In place to export CC, AR and RANLIB, define -cross-compile-prefix at configure as Configure script use by default CC=$(CROSS_COMPILE)cc etc
Created attachment 278971 [details, diff] openssl-1.0.0d.ebuild-BJA-mingw-test-no-lcrypt.diff mingw32 build fail as test/ as LIBDIR is forced to -lcrypt that is glibc specific make[2]: Entering directory `/usr/i686-pc-mingw32/tmp/portage/dev-libs/openssl-1.0.0d/work/openssl-1.0.0d/test' + LIBDEPS='../crypto/applink.o -L.. -lssl -L.. -lcrypto -lcrypt -lws2_32 -lgdi32 -lcrypt32 -lz' + LDCMD=i686-pc-mingw32-gcc + LDFLAGS='-L/usr/i686-pc-mingw32/lib -L/usr/i686-pc-mingw32/usr/lib' ++ for x in '$LIBDEPS' ++ echo ../crypto/applink.o ++ for x in '$LIBDEPS' ++ echo -L.. ++ for x in '$LIBDEPS' ++ sed -e 's/^ *-L//;t' -e d ++ echo -lssl ++ for x in '$LIBDEPS' ++ echo -L.. ++ for x in '$LIBDEPS' ++ echo -lcrypto ++ for x in '$LIBDEPS' ++ echo -lcrypt ++ for x in '$LIBDEPS' ++ echo -lws2_32 ++ for x in '$LIBDEPS' ++ echo -lgdi32 ++ for x in '$LIBDEPS' ++ echo -lcrypt32 ++ for x in '$LIBDEPS' ++ echo -lz ++ uniq + LIBPATH=.. ++ echo .. ++ sed -e 's/ /:/g' + LIBPATH=.. + LD_LIBRARY_PATH=..: + i686-pc-mingw32-gcc -L/usr/i686-pc-mingw32/lib -L/usr/i686-pc-mingw32/usr/lib -o bntest.exe bntest.o ../crypto/applink.o -L.. -lssl -L.. -lcrypto -lcrypt -lws2_32 -lgdi32 -lcrypt32 -lz /usr/libexec/gcc/i686-pc-mingw32/ld: cannot find -lcrypt collect2: ld returned 1 exit status make[2]: *** [link_app.cygwin] Error 1 This patch add conditional epatch and the concern patch
With theses 3 patches, building is fine for i686-pc-mingw32 but not x86_64-w64-mingw32
Comment on attachment 278961 [details, diff] openssl-1.0.0d.ebuild-BJA-mingw-execstack.diff CTARGET has no bearing for ebuilds that arent cross-compilers. however, this would be better as a link test. i thought we had a test-flags-LD in flag-o-matic, but i guess we need one.
Comment on attachment 278967 [details, diff] openssl-1.0.0d.ebuild-BJA-no-CC-AR-RANLIB.diff this breaks handling of CC/etc... env vars. try adding "RC" to the tc-export line.
Comment on attachment 278971 [details, diff] openssl-1.0.0d.ebuild-BJA-mingw-test-no-lcrypt.diff this needs to be a link test. if -lcrypt exists, use it. if not, dont.
(In reply to comment #10) > Comment on attachment 278967 [details, diff] > openssl-1.0.0d.ebuild-BJA-no-CC-AR-RANLIB.diff > > this breaks handling of CC/etc... env vars. try adding "RC" to the tc-export > line. This could not work without patching sources as : Makefile.shared: link_a.cygwin: .. $(PERL) util/mkrc.pl $$dll_name | \ $(CROSS_COMPILE)windres -o rc.o; \ And all cc, ar .. are prefixed by $(CROSS_COMPILE) in every Makefile Also Configure perl script use the --cross-compile-prefix to sed Makefile approperly In normal case, users should not redefine CC/AR/.. ? This patch has been tested on x86_64-pc-linux-gnu too
(In reply to comment #11) > Comment on attachment 278971 [details, diff] > openssl-1.0.0d.ebuild-BJA-mingw-test-no-lcrypt.diff > > this needs to be a link test. if -lcrypt exists, use it. if not, dont. Yes, but this is done in "emake -j1 all rehash"
(In reply to comment #12) then patch the sources to respect env settings just like the other tool variables. i'm not interested in one-off hacks, so i'll only accept proper fixes that get sent upstream.
Created attachment 279111 [details, diff] openssl-windres.patch PoC havent actually tested, but this is probably the way to go
(In reply to comment #13) i dont know what you mean
(In reply to comment #14) > (In reply to comment #12) > > then patch the sources to respect env settings just like the other tool > variables. i'm not interested in one-off hacks, so i'll only accept proper > fixes that get sent upstream. CROSS_COMPILE is also used by kernel for example, but you are right, we just should have both way to define build tools. openssl-windres.patch is fine
(In reply to comment #16) > (In reply to comment #13) > > i dont know what you mean src_compile() { # depend is needed to use $confopts # rehash is needed to prep the certs/ dir emake -j1 depend || die "depend failed" emake -j1 all rehash || die "make all failed" } in Makefile: all: Makefile build_all openssl.pc libssl.pc libcrypto.pc build_all: build_libs build_apps build_tests build_tools build_tests: @dir=test; target=all; $(BUILD_ONE_CMD) tests are just builded, not executed. They should link correctly
(In reply to comment #17) by "fine" you mean you tested it and seems to work ? (In reply to comment #18) that's not what i meant by "link test". i mean the config/Configure files should determine if -lcrypt is necessary/available, and then conditionally add it. although in poking things a bit, i see it's a Gentoo patch that adds this. so all your patch did was revert it. see openssl-0.9.7e-gentoo.patch. in looking at the code and the history, this hasnt been needed in a long while as the local code has been defining crypt() to DES_crypt(). so ive punted the patch and that should fix things for you.
(In reply to comment #19) > (In reply to comment #17) > > by "fine" you mean you tested it and seems to work ? Yes, this is ok > (In reply to comment #18) > > that's not what i meant by "link test". i mean the config/Configure files > should determine if -lcrypt is necessary/available, and then conditionally add > it. although in poking things a bit, i see it's a Gentoo patch that adds this. > so all your patch did was revert it. see openssl-0.9.7e-gentoo.patch. > > in looking at the code and the history, this hasnt been needed in a long while > as the local code has been defining crypt() to DES_crypt(). so ive punted the > patch and that should fix things for you. Ok fine
Created attachment 279623 [details, diff] openssl-1.0.0d.ebuild-BJA.diff Here is a refreshed patch with all the changes : - openssl-windres.patch (+WINDRES need to be exported) - add tc-getWINDRES to eclass toolchain-funcs - noexecstack on mingw - config change to print system for mingw This allow to build with toolchains {i686,x86_64}-{pc,w64}-mingw32
Created attachment 279751 [details, diff] openssl-1.0.0d.ebuild-BJA.diff Updated patch pour x86_64-w64-mingw32
Comment on attachment 279751 [details, diff] openssl-1.0.0d.ebuild-BJA.diff we already have tc-getRC which is the common name used for the windres tool, and which my PoC patch defaults to using (RC and then WINDRES). so simply add "RC" to the tc-export line to have it work without adding any WINDRES stuff to the ebuild or eclass.
(In reply to comment #23) > Comment on attachment 279751 [details, diff] > openssl-1.0.0d.ebuild-BJA.diff > > we already have tc-getRC which is the common name used for the windres tool, > and which my PoC patch defaults to using (RC and then WINDRES). so simply add > "RC" to the tc-export line to have it work without adding any WINDRES stuff to > the ebuild or eclass. Oh, I didn't known RC was prefered, this is fine for me.
i had to rewrite some things, but should be fixed in the tree now. please sync up and double check for me.
(In reply to comment #25) > i had to rewrite some things, but should be fixed in the tree now. please sync > up and double check for me. build and exec tests OK with toolchains : - i686-w64-mingw32 - x86_64-w64-mingw32
Also, test-flags-CC is really interesting