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;
}
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
add a comment |
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
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
add a comment |
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
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
osx gcc c linker
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
Side note:gcc
is linked toclang
to help developers and scripts that assume every system hasgcc
. This causes problems for broken scripts that usegcc
for C++ code.
– Fox
Nov 21 '16 at 16:21
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Side note:gcc
is linked toclang
to help developers and scripts that assume every system hasgcc
. This causes problems for broken scripts that usegcc
for C++ code.
– Fox
Nov 21 '16 at 16:21
add a comment |
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.
Side note:gcc
is linked toclang
to help developers and scripts that assume every system hasgcc
. This causes problems for broken scripts that usegcc
for C++ code.
– Fox
Nov 21 '16 at 16:21
add a comment |
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.
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.
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 toclang
to help developers and scripts that assume every system hasgcc
. This causes problems for broken scripts that usegcc
for C++ code.
– Fox
Nov 21 '16 at 16:21
add a comment |
Side note:gcc
is linked toclang
to help developers and scripts that assume every system hasgcc
. This causes problems for broken scripts that usegcc
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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