Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make error in mac clang ld: unknown option: --gc-sections

I am trying to compile admesh found here

https://github.com/admesh/admesh

I am following thier install instructions which basically is configure and make. But when i run the make command in my mac, its giving the following error,

MacBook-Pro:admesh mk$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
CC       connect.lo
CC       normals.lo
CC       shared.lo
CC       stlinit.lo
CC       stl_io.lo
CC       util.lo
CCLD     libadmesh.la
ld: unknown option: --gc-sections
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libadmesh.la] Error 1
make: *** [all] Error 2

MacBook-Pro:admesh mk$ clang -v
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix

Can anyone help me to fix this error.

like image 360
rhytha mk Avatar asked Jul 14 '14 10:07

rhytha mk


People also ask

Does macOS use clang or GCC?

Apple ships the clang/LLVM compiler with macOS. Clang is a "front-end" that can parse C , C++ and Objective-C down to something that LLVM (referred to as a "back-end") can compile. Clang/LLVM is located in /Applications/Xcode. app/somewhere.

Does macOS use clang?

From Xcode 4.2, Clang is the default compiler for Mac OS X.

What does clang error mean?

First you get the error because the compiler can not find the definition of the power function that you are using. Even if you write int power(int m, int n); There is an error because you are not defining the function.


1 Answers

I got this fixed with help of hroncok of admesh.

You need to after configure command, in Makefile.in replace line number 351,352 from

-Wl,--gc-sections \
-Wl,--as-needed \

to

-Wl,-dead_strip \
-Wl,-dead_strip \

and fixed the error as per your hroncok suggestion. Look here for more details https://github.com/admesh/admesh/issues/7

like image 167
rhytha mk Avatar answered Nov 15 '22 09:11

rhytha mk