You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a binary depends on two library targets that in turn depend on the same remote package the order of the link libraries gets wrong when linking the binary, causing undefined reference errors.
If an app depends on lib1 and lib2 and they in turn depend on say openssl, the resulting link line for the app will include -llib2 -lssl -lcrypto -llib1. But lib1 should come before -lssl and -lcrypto.
Expected behavior
Dependencies should occur after the dependent lib. No undefined references should occur when linking
Error output
$ xmake -v
configure
{
ld = /usr/bin/g++
ccache = true
buildir = build
mode = release
ndk_stdcxx = true
plat = linux
ar = /usr/bin/ar
cc = /usr/bin/gcc
kind = static
theme = default
arch = x86_64
host = linux
}
[100%]: linking.release app
/usr/bin/g++ -o build/linux/x86_64/release/app build/.objs/app/linux/x86_64/release/./main.c.o -Lbuild/linux/x86_64/release -L/usr/lib/x86_64-linux-gnu -Wl,-rpath=$ORIGIN -ltestlib2 -lssl -lcrypto -ltestlib1 -m64 -L/usr/local/lib -L/usr/lib
error: /usr/bin/ld: build/linux/x86_64/release/libtestlib1.a(testlib1.c.o): in function `init_testlib1':
testlib1.c:(.text+0xf): undefined reference to `OPENSSL_init_ssl'
collect2: error: ld returned 1 exit status
Related Environment
xmake v2.2.8+201909032242, linux
Additional context
A minimal example. Just clone and run xmake and it should trigger the error.
The text was updated successfully, but these errors were encountered:
Bug description
When a binary depends on two library targets that in turn depend on the same remote package the order of the link libraries gets wrong when linking the binary, causing undefined reference errors.
If an app depends on lib1 and lib2 and they in turn depend on say openssl, the resulting link line for the app will include
-llib2 -lssl -lcrypto -llib1
. But lib1 should come before -lssl and -lcrypto.Expected behavior
Dependencies should occur after the dependent lib. No undefined references should occur when linking
Error output
Related Environment
xmake v2.2.8+201909032242, linux
Additional context
A minimal example. Just clone and run xmake and it should trigger the error.
The text was updated successfully, but these errors were encountered: