Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to compile with icpc #44

Open
sanchit-misra opened this issue Jun 8, 2020 · 4 comments
Open

Not able to compile with icpc #44

sanchit-misra opened this issue Jun 8, 2020 · 4 comments
Milestone

Comments

@sanchit-misra
Copy link

$ make
icpc -z noexecstack -z relo -z now -c -o obj/abort_handler_s.o safeclib/abort_handler_s.c -Iinclude -fstack-protector-strong -fPIE -fPIC -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security
safeclib/abort_handler_s.c(72): error: identifier "abort" is undefined
slabort();
^

compilation aborted for safeclib/abort_handler_s.c (code 2)
make: *** [obj/abort_handler_s.o] Error 2

@dmwheel1
Copy link

dmwheel1 commented Jun 8, 2020

I'm not familiar with icpc. What compiler is that? Where can I get a version to try?

@sanchit-misra
Copy link
Author

It is Intel C++ compiler. I am not able to compile with g++ either.
$ make
g++ -z noexecstack -z relo -z now -c -o obj/abort_handler_s.o safeclib/abort_handler_s.c -Iinclude -fstack-protector-strong -fPIE -fPIC -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security
In file included from safeclib/abort_handler_s.c:32:0:
safeclib/abort_handler_s.c: In function ‘void abort_handler_s(const char*, void*, errno_t)’:
safeclib/safeclib_private.h:80:23: error: ‘abort’ was not declared in this scope
#define slabort() abort()
^
safeclib/abort_handler_s.c:72:2: note: in expansion of macro ‘slabort’
slabort();
^~~~~~~
safeclib/safeclib_private.h:80:23: note: suggested alternative: ‘slabort’
#define slabort() abort()
^
safeclib/abort_handler_s.c:72:2: note: in expansion of macro ‘slabort’
slabort();
^~~~~~~
make: *** [obj/abort_handler_s.o] Error 1

@dmwheel1
Copy link

dmwheel1 commented Jun 8, 2020

Hmmm. This could be a C++ name mangling thing. Or more likely an environment thing.

The abort_handler_s.c is supposed to call the stdlib function abort(). This is defined in the safeclib_private.h file where slabort() is #defined to abort()
It seems that the include library settings are not correct for the environment you are using. Normally we find the function abort() under stdlib.h which is set up in the safeclib_private.h

Please verify that you are building with the appropriate setting for your environment, which would be to use HAVE_STDLIB_H for C++. See line 62 & 63 in the safeclib_private.h file.

@sanchit-misra
Copy link
Author

"Please verify that you are building with the appropriate setting for your environment, which would be to use HAVE_STDLIB_H for C++. See line 62 & 63 in the safeclib_private.h file."
That fixed it but then I ran into a bunch of type casting errors.
I wanted to compile with icpc/g++ so as to be able to use this library in my C++ code. I was not able to use the library compiled by a C compiler due to C++ name mangling. But now I am just using extern "C". So, I don't need to compile with C++ compiler anymore.

@tomasbw tomasbw added this to the 1.3.0 milestone Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants