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

Fix cross compile error #2758

Closed
wants to merge 2 commits into from
Closed

Fix cross compile error #2758

wants to merge 2 commits into from

Conversation

walkerlee
Copy link

Can't get pkg_libpath properly. It'll cause cross compile failed. (cannot find -lz -lssl -lcrypto, etc...)

@rvagg
Copy link
Member

rvagg commented Sep 9, 2015

/ @nodejs/build

@brendanashworth brendanashworth added the build Issues and PRs related to build files or the CI. label Sep 9, 2015
@jbergstroem
Copy link
Member

Thanks for the PR, I'll verify.

@walkerlee
Copy link
Author

Thank you!

@joaocgreis
Copy link
Member

I'm not really sure of what implications this might have, but couldn't resist to try it.

@walkerlee it's missing a closing ), can you add it?

I'm setting up a cross compiler for the RPis (still not complete), it works without this, but was screaming for a test run: https://ci.nodejs.org/job/joaocgreis-node-test-commit-----only-fanned/18/

@walkerlee
Copy link
Author

@joaocgreis Thansks for your remind. I am sorry for my mistake.

This is my script for cross compile nodejs. (use raspberry-pi toolchain)
https://gist.github.com/walkerlee/209d36fc84c7d29a4f74

If configure with --shared-openssl --shared-zlib options and do not apply patch, it's cause link error.

@rvagg
Copy link
Member

rvagg commented Sep 11, 2015

@joaocgreis btw I wouldn't mind trying your cross compile work on the armv8 machines I have here, they are right next to the Pi's and if they can do it quick enough it might be quicker than having to get the Pi's to download from an external location. Point me to a script when you have something that's close.

@Fishrock123
Copy link
Contributor

and if they can do it quick enough

Aren't those armv8 machines like, really powerful? Haha

@joaocgreis
Copy link
Member

I've taken a better look at this, LGTM.

I found 4 dependencies use this function: zlib, openssl, libuv and http_parser. This fixes zlib, that passes the library path in pkg_config. Openssl does not seem to have a .pc file, but works if the libs are in the same place as zlib (as happens with the script provided by @walkerlee, thanks for it, helped testing!). The .pc file of libuv seems ok for this, has the libraries in libdir. I could not find the .pc for http_parser. @jbergstroem do you think that openssl or http_parser could have a .pc somewhere that passes the library path in cflags?

@jbergstroem
Copy link
Member

Sorry, fell out of radar.

@joaocgreis openssl will likely have a .pc file on different linux/unix os:es. As for http-parser, not so much since upstream doesn't have one packaged.

@bnoordhuis and I have been working on this -- perhaps he has any additional input.

LGTM from me -- tested with and without libpath.

@@ -728,7 +728,7 @@ def configure_library(lib, output):
# libpath needs to be provided ahead libraries
if pkg_libpath:
output['libraries'] += (
filter(None, map(str.strip, pkg_cflags.split('-L'))))
map('-L{0}'.format, filter(None, map(str.strip, pkg_libpath.split('-L')))))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@walkerlee isn't this code just removing '-L' from each library and then adding it back at the end?

Would the appropriate course of action not be just to split pkg_libpath on whitespace?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace isn't safe -- /foo/my files/. Output from pkg_config should avoid being parsed if possible.

@jasnell
Copy link
Member

jasnell commented Mar 22, 2016

Closing due to lack of activity or responses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. stalled Issues and PRs that are stalled.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants