Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8773187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:13:50+00:00 2026-06-13T18:13:50+00:00

I have source code of 2 different libraries, FooMain and FooSecondary. FooSecondary is used

  • 0

I have source code of 2 different libraries, FooMain and FooSecondary. FooSecondary is used by FooMain, so, makefile must compile First FooSecondary, then compile FooMain, and then link FooSecondary to FooMain.

My Android.mk is:


LOCAL_PATH:= $(call my-dir)

# Foo Secondary lib:

# Clear vars
include $(CLEAR_VARS)
# Target Build
LOCAL_ARM_MODE := arm   
# Library Name          
LOCAL_MODULE := FooSecondary        
# Set All SRC_FILES Together            
SRC_FILES := $(wildcard $(LOCAL_PATH)/FooSecondary/src/*.c)
SRC_FILES := $(SRC_FILES:$(LOCAL_PATH)/%=%)     
LOCAL_SRC_FILES = $(SRC_FILES)
# Enable Log support
LOCAL_LDLIBS = -llog    
# C   Flags - Max optimization              
LOCAL_CFLAGS := -O3 -mno-thumb
# C++ Flags - Max optimization          
LOCAL_CPPFLAGS := -O3 -mno-thumb
# Compile as Shared Library     
include $(BUILD_SHARED_LIBRARY)     

# Foo Secondary lib:

# Clear vars
include $(CLEAR_VARS)
# Include OpenCV
include 3rdparty/OpenCV-2.4.3-rc-android-sdk/sdk/native/jni/OpenCV.mk
# Target Build
LOCAL_ARM_MODE := arm   
# Library Name          
LOCAL_MODULE := FooMain     
# Set All SRC_FILES Together            
SRC_FILES := $(wildcard $(LOCAL_PATH)/FooMain/src/*.cpp)
SRC_FILES := $(SRC_FILES:$(LOCAL_PATH)/%=%)     
LOCAL_SRC_FILES = $(SRC_FILES)
LOCAL_SHARED_LIBRARIES := libFooSecondary
LOCAL_LDLIBS := -L$(LOCAL_PATH)/../libs/armeabi 
LOCAL_LDLIBS += -lz -lm -ldl -lGLESv2 -lEGL -llog -lFooSecondary
LOCAL_CFLAGS := -O2 -mno-thumb -Wno-write-strings
LOCAL_CPPFLAGS := -O2 -mno-thumb -Wno-write-strings
# Compile as Shared Library     
include $(BUILD_SHARED_LIBRARY) 

And my Application.mk is:

APP_CPPFLAGS := -frtti -fexceptions
APP_STL := gnustl_static
APP_ABI := armeabi-v7a

But, when I compile Android.mk using ndk-build I get the next Error:

Compile arm    : libFooSecondary <= *.c
SharedLibrary  : libFooSecondary.so
Install        : libFooSecondary.so => libs/armeabi-v7a/libFooSecondary.so
SharedLibrary  : libFooMain.so

/home/user/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: cannot find -lFooSecondary

collect2: ld returned 1 exit status
make: *** [obj/local/armeabi-v7a/libFooMain.so] Error 1

Why libFooSecondary.so is not found if is correctly compiled and installed?

Additionaly, if LOCAL_MODULE name change, for example, first one is LOCAL_MODULE := zname and second one is LOCAL_MODULE := aname, compile first the second one, i don’t know why.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:13:52+00:00Added an answer on June 13, 2026 at 6:13 pm

    Your Android.mk looks weird. Does it assign LOCAL_PATH somewhere? There is no need to assign LOCAL_CPPFLAGS to duplicate LOCAL_CFLAGS, because ndk-build puts both sets of flags on C++ command line.

    To understand better how NDK interprets your Application.mk and Android.mk, you can run

    ndk-build V=1
    

    This will echo all executed commands, including compilation and link, with all their parameters that NDK build assigns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this source code from 2001 that I would like to compile. It
I have bits of piecework being done by different custom (source code unavailable) frameworks
I have a source code that is needed to be converted by creating classes,
I have some source code to get the file name of an url for
I have standard source code package under Linux which requires to run ./configure make
I have this source code: idx=0 b=plt.psd(dOD[:,idx],Fs=self.fs,NFFT=512) B=np.zeros((2*len(self.Chan),len(b[0]))) B[idx,:]=20*log10(b[0]) c=plt.psd(dOD_filt[:,idx],Fs=self.fs,NFFT=512) C=np.zeros((2*len(self.Chan),len(b[0]))) C[idx,:]=20*log10(c[0]) for idx
I have java source code in a text file. There has to be entered
I have a problem with 2D transformation program I have the source code import
I have an installer for which I don't have any source code. I need
Let's say I have created a program in C/C++ and have a source code.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.