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

windows build failure #23

Closed
mclycan opened this issue Jun 12, 2015 · 7 comments
Closed

windows build failure #23

mclycan opened this issue Jun 12, 2015 · 7 comments
Labels

Comments

@mclycan
Copy link

mclycan commented Jun 12, 2015

I have all the dependencies for bitcoind installed and successfully built it in windows(can build bitcoin-qt in windows successfully), but when trying to build alpha it fails with the following error:
CXXLD alpha-tx.exe
c:/deps/openssl-1.0.1l\libssl.a(ssl_err2.o):ssl_err2.c:(.text+0x4): undefined reference to ERR_load_crypto_strings' c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x1e6): undefined reference toCOMP_CTX_free'
c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x202): undefined reference to COMP_CTX_free' c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0xa2a): undefined reference toBIO_s_socket'
c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0xb25): undefined reference to BIO_s_socket' c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0xc95): undefined reference toBIO_s_socket'
c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x1460): undefined reference to COMP_CTX_free' c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x147c): undefined reference toCOMP_CTX_free'
c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x1580): undefined reference to COMP_CTX_free' c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x159c): undefined reference toCOMP_CTX_free'
c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x309a): undefined reference to COMP_CTX_free' c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x30b6): more undefined references toCOMP_CTX_free' follow
c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x5ca1): undefined reference to BIO_f_buffer' c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x5f9c): undefined reference toX509_STORE_set_default_paths'
c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x5fac): undefined reference to X509_STORE_load_locations' c:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: c:/deps/openssl-1.0.1l\libssl.a(ssl_lib.o): bad reloc address 0x80 in section.data'
c:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
make[2]: *** [alpha-tx.exe] Error 1
make[2]: Leaving directory /c/elements-alpha/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/c/elements-alpha/src'
make: *** [all-recursive] Error 1

@gwillen
Copy link
Contributor

gwillen commented Jun 12, 2015

It seems like the problem may be (at least in part) that libssl.a is unable to find symbols in libcrypto.a (see e.g. http://stackoverflow.com/questions/27106580/undefined-reference-to-err-load-crypto-strings for a linux user having a similar problem.) This could be as simple as the order of the libraries being wrong in the Makefile.

I've run into similar errors on OS X with parts of the build. It's not unlikely that the build may be legitimately broken on Windows. I will see what I can find but I do not have a machine with mingw to try this out on.

I would try editing src/Makefile and swapping the order of the references to $(CRYPTO_LIBS) and $(SSL_LIBS) on lines 1653-4. So you should end up with:

$(SSL_LIBS) \
$(CRYPTO_LIBS)

That should fix at least part of the problem, but for all I know it may cause other problems. I don't know why it's in reverse order as compared to the list for alpha_cli just a few lines above, but it's suggestive that it may have been swapped to fix some other link-dependency problem.

@apoelstra
Copy link
Member

I had a similar problem with my home-built SSL. My hacky way of fixing it without editing any build files was to have -lcrypto in CRYPTO_LIBS as well as -lssl -lcrypto in SSL_LIBS.

This accomplishes the same goal as @gwillen's suggestion, having -lcrypto after -lssl, and does not seem to cause any other issues.

@mclycan
Copy link
Author

mclycan commented Jun 16, 2015

@gwillen @apoelstra Thanks for help me! but I have tried this method before, It not work.
And I found an other issue which I missed before: PKG_PROG_PKG_CONFIG: command not found.
So I will let you knew if I have some progress. Thanks again!

@gwillen
Copy link
Contributor

gwillen commented Jun 16, 2015

@mclycan: Can you also post the errors you get when you try @apoelstra's method? (It should be at least as good as mine.) That might give us more clues.

The PKG_PROG_PKG_CONFIG error suggests that you don't have pkg-config installed. I don't know if there's a "building for Windows" guide, but you can look through https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md and see if you've got all the dependencies listed in there?

If you do have pkg-config, it could be an insufficiently new version, or it could be some other issue (paths, or a Makefile problem on our part.)

(It would also be helpful to see that error in context as well. If there's too much output to put in a comment here, put it into a pastebin, set it to never expire, and paste it here.)

@mclycan
Copy link
Author

mclycan commented Jun 16, 2015

@gwillen the errors I get are exactly the same as I post before.
And I am try to install "pkg-config" for the msys.
BUT, I can build alpha successfully in OSX, without "pkg-config", which is very strange.

@jspri3
Copy link

jspri3 commented Jul 20, 2015

@mclycan Any luck with the windows build? I would like to try the build if someone has been successful here?

@btcdrak
Copy link
Contributor

btcdrak commented Jul 20, 2015

@jspri3 FWIW the best way to build for Windows is using the gitian build process [here]https://github.com/ElementsProject/elements/blob/alpha/doc/gitian-building.md).

martindale pushed a commit to martindale/elements that referenced this issue Feb 20, 2017
daf1285 Merge pull request ElementsProject#2 from jgarzik/master
d9e62d3 Merge pull request ElementsProject#24 from MarcoFalke/Mf1608-cleanup
faf260f Rem unused vars and prefer prefix operator for non-primitive type
09a2693 Merge pull request ElementsProject#22 from laanwj/2016_04_unicode
c74a04c Merge pull request ElementsProject#23 from paveljanik/20160527_Wshadow
fceb4f8 Do not shadow variables

git-subtree-dir: src/univalue
git-subtree-split: daf1285af60c2c73801c0f41469c9802c849343d
@jtimon jtimon added the alpha label Apr 27, 2017
jamesdorfman pushed a commit to jamesdorfman/elements that referenced this issue May 14, 2023
a44caf65fe Merge bitcoin-core/univalue-subtree#28: Import fixes for sanitizer reported issues
135254331e Import fixes for sanitizer reported issues
d5fb86940e refactor: use c++11 range based for loop in checkObject
ff9c379304 refactor: Use nullptr (c++11) instead of NULL
08a99754d5 build: use ax_cxx_compile_stdcxx.m4 to check for C++11 support
66d3713ce7 Merge bitcoin-core/univalue-subtree#29: ci: travis -> cirrus
808d487292 ci: travis -> cirrus
c390ac375f Merge bitcoin-core/univalue-subtree#19: Split sources for easier buildsystem integration
4a5b0a1c65 build: Move source entries out to sources.mk
6c7d94b33c build: cleanup wonky gen usage
a222637c6d Merge ElementsProject#23: Merge changes from jgarzik/univalue@1ae6a23
f77d0f718d Merge commit '1ae6a231a0169938eb3972c1d48dd17cba5947e1' into HEAD
1ae6a231a0 Merge pull request ElementsProject#57 from MarcoFalke/test_fix
92bdd11f0b univalue_write: remove unneeded sstream.h include
ffb621c130 Merge pull request ElementsProject#56 from drodil/remove_sstream_header
f33acf9fe8 Merge commit '7890db9~' into HEAD
66e0adec4d Remove unnecessary sstream header from univalue.h
88967f6586 Version 1.0.4
1dc113dbef Merge pull request ElementsProject#50 from luke-jr/pushKV_bool
72392fb227 [tests] test pushKV for boolean values
c23132bcf4 Pushing boolean value to univalue correctly
81faab26a1 Merge pull request ElementsProject#48 from fwolfst/47-UPDATE_MIT_LINK_TO_HTTPS
b17634ef24 Update URLs to MIT license.
88ab64f6b5 Merge pull request ElementsProject#46 from jasonbcox/master
35ed96da31 Merge pull request ElementsProject#44 from MarcoFalke/Mf1709-univalue-cherrypick-explicit
420c226290 Merge pull request ElementsProject#45 from MarcoFalke/Mf1710-univalue-revert-test

git-subtree-dir: src/univalue
git-subtree-split: a44caf65fe55b9dd8ddb08f04c0f70409efd53b3
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

7 participants