Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is clang's equivalent to --no-undefined gcc flag?

Tags:

macos

gcc

clang

I am trying to build a project on Mac OS X using clang and it fails on linking step with ld: unknown option: --no-undefined, which is meant to built with gcc. What's the clang equivalent for this option? (Please, don't advise to use gcc instead of clang.)

Also, a more generic question, is there any resource where one can find some kind of a "mapping" between gcc and clang (linker) options differences?

Thank you.

like image 581
iurii Avatar asked Nov 17 '14 11:11

iurii


1 Answers

OS X uses a different linker. As @rubenvb points out, it's probably the one from Apple's binutils. If you run man ld, and search for "undefined", you will find this option:

-undefined treatment Specifies how undefined symbols are to be treated. Options are: error, warning, suppress, or dynamic_lookup. The default is error.

So, replace -Wl,--no-undefined with -Wl,-undefined,error. Also, use the Force, Luke.

like image 61
Pradhan Avatar answered Oct 04 '22 03:10

Pradhan