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

Error when compiling on OSX #42

Open
postwave opened this issue Jul 11, 2019 · 12 comments
Open

Error when compiling on OSX #42

postwave opened this issue Jul 11, 2019 · 12 comments

Comments

@postwave
Copy link

Sorry to trouble, could you help fix this?

macOS 10.14.5
Apple Clang 10.0.1

Following error messages:

$ dcc test.c
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/bin/dcc/main.py", line 48, in
File "/usr/local/bin/dcc/main.py", line 45, in main
File "/usr/local/bin/dcc/compile.py", line 102, in compile
UnboundLocalError: local variable 'clang_version_float' referenced before assignment

Thank you.

@andrew-taylor
Copy link
Collaborator

Hopefully fixed in https://github.com/COMP1511UNSW/dcc/releases/tag/2.3

@postwave
Copy link
Author

postwave commented Jul 12, 2019

EDITED

It seems something is incompatible with stdin..

<stdin>:515:44: error: unknown type name 'off64_t'; did you mean 'off_t'?
static int __dcc_synchronize_seek(void *v, off64_t *offset, int whence) {
^~~~~~~
off_t
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_off_t.h:31:33: note: 'off_t' declared here
typedef __darwin_off_t off_t;
^
dcc explanation: You seem to be using off64_t'; did you mean 'off_t on line 515 of <stdin> as though it's a type, even though it's not been defined as one.
Did you perhaps misspell off64_t'; did you mean 'off_t or forget to typedef it?
<stdin>:583:1: error: unknown type name 'clock_t'
clock_t clock(void) {
^
dcc explanation: You seem to be using clock_t on line 583 of <stdin> as though it's a type, even though it's not been defined as one.
Did you perhaps misspell clock_t or forget to typedef it?
<stdin>:624:9: warning: implicit declaration of function 'fopencookie' is invalid in C99 [-Wimplicit-function-declaration]
return fopencookie(cookie, mode, (cookie_io_functions_t) {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_off_t.h:31:33: note: 'off_t' declared here
typedef __darwin_off_t off_t;
^
dcc explanation: you are calling a function named fopencookie line 624 of but dcc does not recognize fopencookie as a function.
There are several possible causes:
a) You might have misspelt the function name.
b) You might need to add a #include line at the top of .
c) You might need to add a prototype for fopencookie.

@postwave
Copy link
Author

I didn't use any flag and here is the test file

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
if (argc!=2) {
printf("Usage: %s number\n", argv[0]);
return 1;
} else {
int n;
int m;
if (sscanf(argv[1],"%d,%d",&n,&m)!=2) {
printf("op\n");
return 1;
} else {
printf("%d %d\n", n, m);
}
}
return 0;
}

@andrew-taylor
Copy link
Collaborator

Could you compile with -fsanitize=address e.g.

dcc -fsanitize=address main.c

and let me know how that goes?

@postwave
Copy link
Author

postwave commented Jul 15, 2019

Error messages(I missed some brackets in previous comment, error messages should be from <stdin>, edited):

<stdin>:1033:5: warning: implicitly declaring library function 'va_start' with type 'void (struct __va_list_tag *, ...)' [-Wimplicit-function-declaration]
va_start(arg, format);
^
dcc explanation: You are calling the function va_start on line 1033 of but dcc does not recognize va_start as a function
because you have forgotten to #include

<stdin>:1035:5: warning: implicitly declaring library function 'va_end' with type 'void (struct __va_list_tag *)' [-Wimplicit-function-declaration]
va_end(arg);
^
dcc explanation: You are calling the function va_end on line 1035 of but dcc does not recognize va_end as a function
because you have forgotten to #include

Undefined symbols for architecture x86_64:
"_va_end", referenced from:
_debug_printf in --963b48.o
_scanf in --963b48.o
_printf in --963b48.o
"_va_start", referenced from:
_debug_printf in --963b48.o
_scanf in --963b48.o
_printf in --963b48.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)'

@andrew-taylor
Copy link
Collaborator

Could report if https://github.com/COMP1511UNSW/dcc/releases/tag/2.4 works please

@postwave
Copy link
Author

postwave commented Jul 17, 2019

$ dcc -fsanitize=address input.c or $ dcc input.c or $ dcc --leak-check input.c

warning: unknown warning option '-Wunused-but-set-variable'; did you mean '-Wunused-const-variable'? [-Wunknown-warning-option]

warning: unknown warning option '-Wduplicated-cond'; did you mean '-Wduplicate-enum'? [-Wunknown-warning-option]

warning: unknown warning option '-Wduplicated-branches' [-Wunknown-warning-option]

warning: unknown warning option '-Wlogical-op'; did you mean '-Wlong-long'? [-Wunknown-warning-option]

4 warnings generated.

error: cannot parse the debug map for '/dev/null': The file was not recognized as a valid object file

clang: error: dsymutil command failed with exit code 1 (use -v to see invocation)


$ dcc -fsanitize=undefined input.c

only 1 or sanitizers supported

@andrew-taylor
Copy link
Collaborator

@postwave
Copy link
Author

Similar error to two weeks ago, except it's in different lines of stdin.
Thanks for your patience

<stdin>:301:39: error: unknown type name 'off64_t'; did you mean 'off_t'?
static int __dcc_cookie_seek(void *v, off64_t *offset, int whence);
^~~~~~~
off_t
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_off_t.h:31:33: note: 'off_t' declared here
typedef __darwin_off_t off_t;
^
dcc explanation: You seem to be using off64_t'; did you mean 'off_t on line 301 of <stdin> as though it's a type, even though it's not been defined as one.
Did you perhaps misspell off64_t'; did you mean 'off_t or forget to typedef it?
<stdin>:305:9: warning: implicit declaration of function 'fopencookie' is invalid in C99 [-Wimplicit-function-declaration]
return fopencookie(cookie, mode, (cookie_io_functions_t) {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_off_t.h:31:33: note: 'off_t' declared here
typedef __darwin_off_t off_t;
^
dcc explanation: you are calling a function named fopencookie line 305 of but dcc does not recognize fopencookie as a function.
There are several possible causes:
a) You might have misspelt the function name.
b) You might need to add a #include line at the top of .
c) You might need to add a prototype for fopencookie.

@andrew-taylor
Copy link
Collaborator

@postwave
Copy link
Author

Same except line index changed.

<stdin>:308:39: error: unknown type name 'off64_t'; did you mean 'off_t'?
static int __dcc_cookie_seek(void *v, off64_t *offset, int whence);
^~~~~~~
off_t
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_off_t.h:31:33: note: 'off_t' declared here
typedef __darwin_off_t off_t;
^
dcc explanation: You seem to be using off64_t'; did you mean 'off_t on line 308 of <stdin> as though it's a type, even though it's not been defined as one.
Did you perhaps misspell off64_t'; did you mean 'off_t or forget to typedef it?
<stdin>:312:9: warning: implicit declaration of function 'fopencookie' is invalid in C99 [-Wimplicit-function-declaration]
return fopencookie(cookie, mode, (cookie_io_functions_t) {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_off_t.h:31:33: note: 'off_t' declared here
typedef __darwin_off_t off_t;
^
dcc explanation: you are calling a function named fopencookie line 312 of but dcc does not recognize fopencookie as a function.
There are several possible causes:
a) You might have misspelt the function name.
b) You might need to add a #include line at the top of .
c) You might need to add a prototype for fopencookie.

@postwave
Copy link
Author

Something wrong with format. I didn't realise.
4 ^ are pointing off64_t, off_t, fopencookie, off_t respectively.

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

2 participants