On Ubuntu14.04, building nodejs-native fails with link error:
Build Configuration:
BB_VERSION = "1.38.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "ubuntu-14.04"
TARGET_SYS = "arm-openbmc-linux-gnueabi"
MACHINE = "romulus"
DISTRO = "openbmc-phosphor"
DISTRO_VERSION = "0.1.0"
TUNE_FEATURES = "arm armv6 thumb arm1176jzs"
TARGET_FPU = "soft"
meta
meta-poky
meta-oe
meta-networking
meta-perl
meta-python
meta-webserver
meta-virtualization
meta-phosphor
meta-aspeed
meta-openpower
meta-ibm
meta-romulus
workspace = "master:cab598657fa2a71342db62b297d7f3d5038a38e4"
...
| /home/leiyu/openbmc/build/tmp/work/x86_64-linux/nodejs-native/8.9.4-r0/node-v8.9.4/out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_
s*)':
| node_crypto.cc:(.text+0x21): undefined reference to `RAND_poll'
| node_crypto.cc:(.text+0x2a): undefined reference to `RAND_status'
| node_crypto.cc:(.text+0x42): undefined reference to `RAND_bytes'
...
| /home/leiyu/openbmc/build/tmp/work/x86_64-linux/nodejs-native/8.9.4-r0/node-v8.9.4/out/Release/obj.target/node/src/node_crypto_bio.o: In function `node::crypto::NodeBIO::New()':
| node_crypto_bio.cc:(.text+0x7b): undefined reference to `BIO_new'
| collect2: error: ld returned 1 exit status
| make[1]: *** [/home/leiyu/openbmc/build/tmp/work/x86_64-linux/nodejs-native/8.9.4-r0/node-v8.9.4/out/Release/cctest] Error 1
| rm 5bbf302c4e3ce1c7223f3a497a1c376889490055.intermediate
| make[1]: Leaving directory `/home/leiyu/openbmc/build/tmp/work/x86_64-linux/nodejs-native/8.9.4-r0/node-v8.9.4/out'
| make: *** [node] Error 2
| ERROR: oe_runmake failed
| WARNING: /home/leiyu/openbmc/build/tmp/work/x86_64-linux/nodejs-native/8.9.4-r0/temp/run.do_compile.17835:1 exit 1 from 'exit 1'
| ERROR: Function failed: do_compile (log file is located at /home/leiyu/openbmc/build/tmp/work/x86_64-linux/nodejs-native/8.9.4-r0/temp/log.do_compile.17835)
The issue is related to link order and ld version.
cctest is like below from cctest.target.mk 1 LIBS := \
2 -L/home/leiyu/openbmc/build/tmp/work/x86_64-linux/nodejs-native/8.9.4-r0/recipe-sysroot-native/usr/lib/pkgconfig/../../../usr/lib \
3 -lz \
4 -L/home/leiyu/openbmc/build/tmp/work/x86_64-linux/nodejs-native/8.9.4-r0/recipe-sysroot-native/usr/lib/pkgconfig/../../../usr//lib \
5 -lcrypto \
6 -lssl \
7 $(builddir)/obj.target/node/src/async-wrap.o \
8 $(builddir)/obj.target/node/src/env.o \
9 $(builddir)/obj.target/node/src/node.o \
10 $(builddir)/obj.target/node/src/node_buffer.o \
11 $(builddir)/obj.target/node/src/node_debug_options.o \
12 $(builddir)/obj.target/node/src/node_i18n.o \
13 $(builddir)/obj.target/node/src/node_perf.o \
14 $(builddir)/obj.target/node/src/node_platform.o \
15 $(builddir)/obj.target/node/src/node_url.o \
16 $(builddir)/obj.target/node/src/util.o \
17 $(builddir)/obj.target/node/src/string_bytes.o \
18 $(builddir)/obj.target/node/src/string_search.o \
19 $(builddir)/obj.target/node/src/stream_base.o \
20 $(builddir)/obj.target/node/src/node_constants.o \
21 $(builddir)/obj.target/node/src/tracing/agent.o \
22 $(builddir)/obj.target/node/src/tracing/node_trace_buffer.o \
23 $(builddir)/obj.target/node/src/tracing/node_trace_writer.o \
24 $(builddir)/obj.target/node/src/tracing/trace_event.o \
25 $(builddir)/obj.target/node/gen/node_javascript.o \
26 $(builddir)/obj.target/node/src/node_crypto.o \
27 $(builddir)/obj.target/node/src/node_crypto_bio.o \
28 $(builddir)/obj.target/node/src/node_crypto_clienthello.o \
29 $(builddir)/obj.target/node/src/tls_wrap.o \
30 $(builddir)/obj.target/node/src/backtrace_posix.o \
31 -lm \
32 -ldl \
33 -lrt
Note that -lcrypto and -lssl are in the middle and there are .o files after them.
ld v2.24, and it causes the link error.The issue can be fixed:
-lcrypto and -lssl at last of the link command;ld to v2.26.Adjusting link order means patches to nodejs, so it is easier to upgrade ld on Ubuntu 14.04:
sudo apt-get install binutils-2.26
sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld-2.26 60
This issue has been automatically marked as stale because no activity has occurred in the last 6 months. It will be closed if no activity occurs in the next 30 days. If this issue should not be closed please add a comment. Thank you for your understanding and contributions.
Most helpful comment
The issue is related to link order and ld version.
cctestis like below fromcctest.target.mkNote that
-lcryptoand-lsslare in the middle and there are.ofiles after them.ldv2.24, and it causes the link error.The issue can be fixed:
-lcryptoand-lsslat last of the link command;ldto v2.26.Adjusting link order means patches to nodejs, so it is easier to upgrade
ldon Ubuntu 14.04: