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?
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.
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.
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.
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.
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.
You can build vs Linux and then engage with Mac Ports and Homebrew.
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.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With