-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Compilation of subproject failed due to -L-L
#13853
Comments
I downloaded your attachment and tried it out. I noticed this cmake warning:
On L22 I changed 'PUBLIC' to 'INTERFACE' and the library compiled successfully. The cmake warning I mentioned above still persists though, so I'm not too sure the change I made is doing what needs to be done. I'm not very experienced with cmake. |
Actually, scratch that. There's no problem when I build it bypassing meson, using only cmake. But here's the log from builddir/meson-logs: |
From https://cmake.org/cmake/help/v3.0/command/target_link_libraries.html: It seems that when using INTERFACE, the compilation of libhelloworld.so does not link against libworld.so, so no error is reported. |
Describe the bug
I have a subproject built using CMake that links a library in a directory. Failed to compile it with meson, and
LINK_ARGS
inbuild.ninja
contains-L-L
.ninja -v [1/1] c++ -o subprojects/helloworld/libhelloworld.so subprojects/helloworld/libhelloworld.so.p/src_main.cpp.o -L-L/home/lys/code/meson/subprojects/helloworld/world/lib -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libhelloworld.so -lworld /home/lys/code/meson/subprojects/helloworld/world/lib/libworld.so -Wl,--end-group FAILED: subprojects/helloworld/libhelloworld.so c++ -o subprojects/helloworld/libhelloworld.so subprojects/helloworld/libhelloworld.so.p/src_main.cpp.o -L-L/home/lys/code/meson/subprojects/helloworld/world/lib -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libhelloworld.so -lworld /home/lys/code/meson/subprojects/helloworld/world/lib/libworld.so -Wl,--end-group /usr/bin/ld: cannot find -lworld: No such file or directory collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
Changing
-L-L
to-L
, the compilation can pass.To Reproduce
See the attachment
messon_subproject_failed.tar.gz
Expected behavior
The compillation should pass.
system parameters
The text was updated successfully, but these errors were encountered: