soong: cc_prebuilt_library_static

945 views
Skip to first unread message

Michael Lekman

unread,
Sep 18, 2017, 4:45:45 PM9/18/17
to Android Building
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

Colin Cross

unread,
Sep 18, 2017, 5:01:59 PM9/18/17
to android-...@googlegroups.com
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.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-building@googlegroups.com
To unsubscribe from this group, send email to
android-building+unsubscribe@googlegroups.com
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 android-building+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Lekman

unread,
Sep 18, 2017, 5:54:03 PM9/18/17
to Android Building
I get "error: undefined reference to" during linkage. The symbol are located in libteststatic.a
To post to this group, send email to android-...@googlegroups.com

To unsubscribe from this group, send email to

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 android-buildi...@googlegroups.com.

Michael Lekman

unread,
Sep 19, 2017, 12:18:17 PM9/19/17
to Android Building
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)

Janson Hu

unread,
Dec 20, 2017, 11:41:46 AM12/20/17
to Android Building
Did you resolve this problem? we have the same requirement as you.


在 2017年9月19日星期二 UTC+8上午4:45:45,Michael Lekman写道:

Haili Tian

unread,
Jun 20, 2019, 10:00:11 AM6/20/19
to Android Building
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写道:
Reply all
Reply to author
Forward
0 new messages