How to get the REAL gcc (not the one that is hashed to clang) in MacOS?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I am trying to compile a program that uses the OpenSSL library. I had a problem where it couldn't find the header files. I fixed this problem by adding the option -I /usr/local/opt/openssl/include to gcc. After this, I had another problem, which is that the linker does not understand some symbol. This is the error I got:



Undefined symbols for architecture x86_64:
"_MD5", referenced from:
_main in md5-b35556.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


I googled the error, and got a whole lot of results that either only applied to C++, or only applied to programs with multiple modules, etc. Finally, I found what might be a solution to my problem, which is that gcc is hashed to clang on MacOS (I am using El Capitain).



So basically, now I need to find the real gcc executable, then redirect the gcc command to that file with an alias command in my .bashrc file. Where can I find this executable in my filesystem, or do I need to install it from the Internet?



Note: I had this same problem when trying to use the ncurses library.










share|improve this question























  • apple.stackexchange.com/questions/38222/…

    – Ipor Sircer
    Nov 21 '16 at 15:26






  • 2





    This is a sledgehammer to crack a walnut, and (ironically) it won't help anyway. The right course of action is simply -lcrypto and an -L for the relevant lib directory. Sadly, you'll end up switching to GCC and having the exact same problem because the compiler was never the problem to begin with. Neither GCC nor clang magically include the OpenSSL header file paths or link libraries from places like /usr/local/opt. You have to add the command line options that specify them.

    – JdeBP
    Nov 21 '16 at 18:49


















1















I am trying to compile a program that uses the OpenSSL library. I had a problem where it couldn't find the header files. I fixed this problem by adding the option -I /usr/local/opt/openssl/include to gcc. After this, I had another problem, which is that the linker does not understand some symbol. This is the error I got:



Undefined symbols for architecture x86_64:
"_MD5", referenced from:
_main in md5-b35556.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


I googled the error, and got a whole lot of results that either only applied to C++, or only applied to programs with multiple modules, etc. Finally, I found what might be a solution to my problem, which is that gcc is hashed to clang on MacOS (I am using El Capitain).



So basically, now I need to find the real gcc executable, then redirect the gcc command to that file with an alias command in my .bashrc file. Where can I find this executable in my filesystem, or do I need to install it from the Internet?



Note: I had this same problem when trying to use the ncurses library.










share|improve this question























  • apple.stackexchange.com/questions/38222/…

    – Ipor Sircer
    Nov 21 '16 at 15:26






  • 2





    This is a sledgehammer to crack a walnut, and (ironically) it won't help anyway. The right course of action is simply -lcrypto and an -L for the relevant lib directory. Sadly, you'll end up switching to GCC and having the exact same problem because the compiler was never the problem to begin with. Neither GCC nor clang magically include the OpenSSL header file paths or link libraries from places like /usr/local/opt. You have to add the command line options that specify them.

    – JdeBP
    Nov 21 '16 at 18:49














1












1








1








I am trying to compile a program that uses the OpenSSL library. I had a problem where it couldn't find the header files. I fixed this problem by adding the option -I /usr/local/opt/openssl/include to gcc. After this, I had another problem, which is that the linker does not understand some symbol. This is the error I got:



Undefined symbols for architecture x86_64:
"_MD5", referenced from:
_main in md5-b35556.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


I googled the error, and got a whole lot of results that either only applied to C++, or only applied to programs with multiple modules, etc. Finally, I found what might be a solution to my problem, which is that gcc is hashed to clang on MacOS (I am using El Capitain).



So basically, now I need to find the real gcc executable, then redirect the gcc command to that file with an alias command in my .bashrc file. Where can I find this executable in my filesystem, or do I need to install it from the Internet?



Note: I had this same problem when trying to use the ncurses library.










share|improve this question














I am trying to compile a program that uses the OpenSSL library. I had a problem where it couldn't find the header files. I fixed this problem by adding the option -I /usr/local/opt/openssl/include to gcc. After this, I had another problem, which is that the linker does not understand some symbol. This is the error I got:



Undefined symbols for architecture x86_64:
"_MD5", referenced from:
_main in md5-b35556.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


I googled the error, and got a whole lot of results that either only applied to C++, or only applied to programs with multiple modules, etc. Finally, I found what might be a solution to my problem, which is that gcc is hashed to clang on MacOS (I am using El Capitain).



So basically, now I need to find the real gcc executable, then redirect the gcc command to that file with an alias command in my .bashrc file. Where can I find this executable in my filesystem, or do I need to install it from the Internet?



Note: I had this same problem when trying to use the ncurses library.







osx gcc c linker






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 '16 at 15:25









user628544user628544

4302510




4302510













  • apple.stackexchange.com/questions/38222/…

    – Ipor Sircer
    Nov 21 '16 at 15:26






  • 2





    This is a sledgehammer to crack a walnut, and (ironically) it won't help anyway. The right course of action is simply -lcrypto and an -L for the relevant lib directory. Sadly, you'll end up switching to GCC and having the exact same problem because the compiler was never the problem to begin with. Neither GCC nor clang magically include the OpenSSL header file paths or link libraries from places like /usr/local/opt. You have to add the command line options that specify them.

    – JdeBP
    Nov 21 '16 at 18:49



















  • apple.stackexchange.com/questions/38222/…

    – Ipor Sircer
    Nov 21 '16 at 15:26






  • 2





    This is a sledgehammer to crack a walnut, and (ironically) it won't help anyway. The right course of action is simply -lcrypto and an -L for the relevant lib directory. Sadly, you'll end up switching to GCC and having the exact same problem because the compiler was never the problem to begin with. Neither GCC nor clang magically include the OpenSSL header file paths or link libraries from places like /usr/local/opt. You have to add the command line options that specify them.

    – JdeBP
    Nov 21 '16 at 18:49

















apple.stackexchange.com/questions/38222/…

– Ipor Sircer
Nov 21 '16 at 15:26





apple.stackexchange.com/questions/38222/…

– Ipor Sircer
Nov 21 '16 at 15:26




2




2





This is a sledgehammer to crack a walnut, and (ironically) it won't help anyway. The right course of action is simply -lcrypto and an -L for the relevant lib directory. Sadly, you'll end up switching to GCC and having the exact same problem because the compiler was never the problem to begin with. Neither GCC nor clang magically include the OpenSSL header file paths or link libraries from places like /usr/local/opt. You have to add the command line options that specify them.

– JdeBP
Nov 21 '16 at 18:49





This is a sledgehammer to crack a walnut, and (ironically) it won't help anyway. The right course of action is simply -lcrypto and an -L for the relevant lib directory. Sadly, you'll end up switching to GCC and having the exact same problem because the compiler was never the problem to begin with. Neither GCC nor clang magically include the OpenSSL header file paths or link libraries from places like /usr/local/opt. You have to add the command line options that specify them.

– JdeBP
Nov 21 '16 at 18:49










1 Answer
1






active

oldest

votes


















3














Apple Macos uses clang as it's gcc compiler mainly because of the gcc licensing. You can install GNU gcc using brew. No apple program installs GNU gcc but you can do it manualy and configure to use it by default.






share|improve this answer


























  • Side note: gcc is linked to clang to help developers and scripts that assume every system has gcc. This causes problems for broken scripts that use gcc for C++ code.

    – Fox
    Nov 21 '16 at 16:21












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f324938%2fhow-to-get-the-real-gcc-not-the-one-that-is-hashed-to-clang-in-macos%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














Apple Macos uses clang as it's gcc compiler mainly because of the gcc licensing. You can install GNU gcc using brew. No apple program installs GNU gcc but you can do it manualy and configure to use it by default.






share|improve this answer


























  • Side note: gcc is linked to clang to help developers and scripts that assume every system has gcc. This causes problems for broken scripts that use gcc for C++ code.

    – Fox
    Nov 21 '16 at 16:21
















3














Apple Macos uses clang as it's gcc compiler mainly because of the gcc licensing. You can install GNU gcc using brew. No apple program installs GNU gcc but you can do it manualy and configure to use it by default.






share|improve this answer


























  • Side note: gcc is linked to clang to help developers and scripts that assume every system has gcc. This causes problems for broken scripts that use gcc for C++ code.

    – Fox
    Nov 21 '16 at 16:21














3












3








3







Apple Macos uses clang as it's gcc compiler mainly because of the gcc licensing. You can install GNU gcc using brew. No apple program installs GNU gcc but you can do it manualy and configure to use it by default.






share|improve this answer















Apple Macos uses clang as it's gcc compiler mainly because of the gcc licensing. You can install GNU gcc using brew. No apple program installs GNU gcc but you can do it manualy and configure to use it by default.







share|improve this answer














share|improve this answer



share|improve this answer








edited 2 hours ago









Rui F Ribeiro

41.9k1483142




41.9k1483142










answered Nov 21 '16 at 15:56









Alex VeleaAlex Velea

412




412













  • Side note: gcc is linked to clang to help developers and scripts that assume every system has gcc. This causes problems for broken scripts that use gcc for C++ code.

    – Fox
    Nov 21 '16 at 16:21



















  • Side note: gcc is linked to clang to help developers and scripts that assume every system has gcc. This causes problems for broken scripts that use gcc for C++ code.

    – Fox
    Nov 21 '16 at 16:21

















Side note: gcc is linked to clang to help developers and scripts that assume every system has gcc. This causes problems for broken scripts that use gcc for C++ code.

– Fox
Nov 21 '16 at 16:21





Side note: gcc is linked to clang to help developers and scripts that assume every system has gcc. This causes problems for broken scripts that use gcc for C++ code.

– Fox
Nov 21 '16 at 16:21


















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f324938%2fhow-to-get-the-real-gcc-not-the-one-that-is-hashed-to-clang-in-macos%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

CARDNET

Boot-repair Failure: Unable to locate package grub-common:i386

濃尾地震