Did you make another target (executable/so) link to libtest2, and the 
linkage failure was reported for that target?
If so, make your target also link to libteststatic.

Meet same error, and solved as above.

在 2017年9月20日星期三 UTC+8上午12:18:17,Michael Lekman写道:
>
> when I replaced cc_prebuilt_library_static with cc_library_static and 
> added the sources and made a build it link ok. 
>
> Second test I copied the two static libs from previous build and made a 
> build with cc_prebuilt_library_static and it fails to link.
>
> clang.real: error: linker command failed with exit code 1 (use -v to see 
> invocation)
>
>
> On Monday, 18 September 2017 23:54:03 UTC+2, Michael Lekman wrote:
>>
>> I get "error: undefined reference to" during linkage. The symbol are 
>> located in libteststatic.a
>>
>> On Monday, 18 September 2017 23:01:59 UTC+2, Colin Cross wrote:
>>>
>>> What is the error?  Soong won't unnecessarily copy the prebuilt to 
>>> out/soong/.intermediates if it doesn't need to, it will use it in place if 
>>> it can.
>>>
>>> On Mon, Sep 18, 2017 at 1:19 PM, Michael Lekman <[email protected]> 
>>> wrote:
>>>
>>>> It fails to link when using cc_prebuilt_library_static.
>>>>
>>>> cc_prebuilt_library_static {
>>>>     name: "libteststatic",
>>>>     defaults: ["test-defaults"],
>>>>
>>>>     compile_multilib: "both",
>>>>     multilib: {
>>>>         lib32: {
>>>>             srcs: ["prebuilts/static-lib/lib/libteststatic.a"],
>>>>         },
>>>>         lib64: {
>>>>             srcs: ["prebuilts/static-lib/lib64/libteststatic.a"],
>>>>         },
>>>>     },
>>>>
>>>>     export_include_dirs: ["include"],
>>>> }
>>>>
>>>> cc_library_static {
>>>>     name: "libtest2",
>>>>     defaults: ["libtest2_defaults"],
>>>>     srcs: ["src/test.cpp"],
>>>>
>>>>     whole_static_libs: [
>>>>         "libc_logging",
>>>>         "libteststatic",
>>>>     ],
>>>>
>>>>     include_dirs: ["vendor/test/test/include"],
>>>>
>>>>     export_include_dirs: ["include"],
>>>> }
>>>>
>>>>
>>>> The prebuilt static libs are copied to 
>>>> %OUT/obj/STATIC_LIBRARIES/libteststatic_intermediates/libteststatic.a and 
>>>> %OUT/obj_arm/STATIC_LIBRARIES/libteststatic_intermediates/libteststatic.a 
>>>> but not to out/soong/.intermediates/
>>>>
>>>> BR
>>>> /Michael
>>>>
>>>> -- 
>>>> -- 
>>>> You received this message because you are subscribed to the "Android 
>>>> Building" mailing list.
>>>> To post to this group, send email to [email protected]
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/android-building?hl=en
>>>>
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Android Building" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-building/e9401924-d27e-4e74-87f9-e3337f7dd2b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to