React-native-vector-icons: Can't link library in Xcode with new build configuration

Created on 3 Jun 2016  路  10Comments  路  Source: oblador/react-native-vector-icons

First, thanks for the great work on this project.

On a brand new RN project, the instructions for react-native-vector-icons work great and it installs without issues.

However, when I add a new Build Configuration in Xcode and then try to build using that configuration, I get

ld: library not found for -lRNVectorIcons
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I must be missing something obvious, but I can't figure out what it is.

Steps to reproduce:

  1. react-native init Foo
  2. cd Foo
  3. npm install react-native-vector-icons --save
  4. rnpm link
  5. In Xcode, duplicate the Debug configuration.
    screen shot 2016-06-02 at 4 40 03 pm
  6. Edit the Scheme and set the Build Configuration to Debug copy
    screen shot 2016-06-02 at 4 42 56 pm
  7. Build the project.

Any help would be greatly appreciated. If the issue isn't related to react-native-vector-icons, feel free to close. Thanks!

Most helpful comment

If you want to add new Staging configuration you can add line:
"$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)",
in LIBRARY_SEARCH_PATHS for your new configuration in project.pbxproj file

Just to remember - sometimes need to close and open XCode to see this changes.

And build will be successful!

That happens because build command put libraries into /Build/Products/Release-iphonesimulator/ folder
And for your new configuration it searches libs into /Build/Products/Staging-iphonesimulator/ folder
So can't find them and we need to declare library search path manually to point to release folder.

All 10 comments

It's not really an RNVI issue like you say, but try to switch the order of steps 4 and 5.

Yes, I tried switching the order of steps 4 and 5, and it did not help.

After further research, the problem seems to be described here:

I still haven't found a good solution, but I guess I will just live with the standard "Release" and "Debug" configurations for now.

I personally use 5 different build configs without any problems, but then I'm using CocoaPods so my setup differs slightly.

Could you please provide example link for build configuration.

If you want to add new Staging configuration you can add line:
"$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)",
in LIBRARY_SEARCH_PATHS for your new configuration in project.pbxproj file

Just to remember - sometimes need to close and open XCode to see this changes.

And build will be successful!

That happens because build command put libraries into /Build/Products/Release-iphonesimulator/ folder
And for your new configuration it searches libs into /Build/Products/Staging-iphonesimulator/ folder
So can't find them and we need to declare library search path manually to point to release folder.

Thanks @philipshurpik. This worked for me, with the same problem in a different project. I wrote up the steps (with screenshots) in this StackOverflow post:

http://stackoverflow.com/questions/39626055/created-new-xcode-configuration-and-scheme-linker-is-suddenly-failing/40661027#40661027

xcode 8.3.2 needs a bit different changes.

to make it work, you need to change the Pre-configuration Build Products Path for your custom build config. for example, i have an Internal build config. in that field, instead of $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) i put $(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME), and now it works :)

And don't forget to make "react-native link" after @pvinis action. I use react-native-lock and it has pods. If you don't link libraries again Xcode won't be able to find their pathes:)

Unfortunately it still doesn't work for Archive :-/

Was this page helpful?
0 / 5 - 0 ratings