Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Library not found for -lfl

Tags:

I was using flex and bison to build a simple calculator project I cloned from Github.

But after I typed make in terminal, I got the following message:

gcc -o calc calc.tab.c lex.yy.c -lfl calc.y:48:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] main() { ^~~~ 1 warning generated. ld: library not found for -lfl clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [calc] Error 1 

How could I resolve this problem?

like image 607
Tian Jin Avatar asked Jan 23 '14 02:01

Tian Jin


People also ask

How to Fix library not found in Xcode?

You're experiencing this issue because Xcode can't find the location of the library, simply tell Xcode where they are by adding the right directory to the Library Search Paths in Xcode for linking.

Where is build settings in Xcode?

Choose the project in the Project Navigator on the left. Select the Configurations target from the Targets section and click the Build Settings tab at the top. The Build Settings tab shows the build settings for the Configurations target. It's possible to expand this list with build settings that you define.

Is missing one or more architectures required by this target x86_64?

framework' is missing one or more architectures required by this target: x86_64. This can happen when switching between simulator versions on a Cocoapods project. Cleaning the project should fix the issue. This error occurs when a arm64 iPhoneSimulator slice cannot be found for one of your binary dependencies.


1 Answers

let me guess, trying to use flex on OS/X?

Try -ll instead of -lfl

Using Flex on OS/X

So yea, the flex library name on OS/X is just arbitrarily different for some reason. OS/X is not exactly Linux, but it's pretty close. You have some options here.

  1. You can just simply have a separate build system and source files for OS/X. Certainly Apple might like that with their pushing XCode, objective-C and not much interoperability.

  2. You can build vs Linux and then engage with Mac Ports and Homebrew.

  3. You can create your project using autotools. That's not an awesome link, learning this system is rough going, but it's a standard thing for Linux for sure. This will actually work, I find if you have the patience for it, OS/X is close enough that autotools based builds will work on it.

  4. Lately, I've been turned on to Cocoapods, which I believe to be an attempt to join the open source community and XCode. It's kind of half 1 and 3 sorta with an emphasis on modularizing the external source and getting it compiled into a .app (via Xcode).

like image 195
waTeim Avatar answered Sep 28 '22 08:09

waTeim