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

trouble with building bitcracker openCL version #43

Open
mlpd opened this issue Jan 17, 2022 · 1 comment
Open

trouble with building bitcracker openCL version #43

mlpd opened this issue Jan 17, 2022 · 1 comment

Comments

@mlpd
Copy link

mlpd commented Jan 17, 2022

not sure what I'm doing wrong but I'm getting several errors and warnings.
The cuda, hash and rpgen seems to build without issue.

Thanks!

====== Build BitCracker OpenCL version ======
rm -rf *.o
rm -rf bitcracker_opencl
gcc -I/usr/include -L/usr/lib64 -L/usr/lib -I/usr/local/cuda/include -L/usr/local/cuda/lib64 -lOpenCL -Wextra -o bitcracker_opencl main.c opencl_attack.c utils.c w_blocks.c
In file included from /usr/include/CL/cl.h:32,
                 from bitcracker.h:37,
                 from main.c:22:
/usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
   34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
      |         ^~~~~~~
main.c: In function ‘checkDeviceStatistics’:
main.c:101:16: warning: comparison of integer expressions of different signedness: ‘int’ and ‘cl_uint’ {aka ‘unsigned int’} [-Wsign-compare]
  101 |  for (i = 0; i < platformCount; i++)
      |                ^
main.c:110:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘cl_uint’ {aka ‘unsigned int’} [-Wsign-compare]
  110 |   for (j = 0; j < deviceCount; j++)
      |                 ^
main.c:149:39: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘cl_ulong’ {aka ‘long unsigned int’} [-Wformat=]
  149 |    printf("Max Global Memory Size: %lld\n", maxAllocSize);
      |                                    ~~~^     ~~~~~~~~~~~~
      |                                       |     |
      |                                       |     cl_ulong {aka long unsigned int}
      |                                       long long int
      |                                    %ld
main.c:153:45: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘cl_ulong’ {aka ‘long unsigned int’} [-Wformat=]
  153 |    printf("Max Global Memory Alloc Size: %lld\n", maxAllocSize);
      |                                          ~~~^     ~~~~~~~~~~~~
      |                                             |     |
      |                                             |     cl_ulong {aka long unsigned int}
      |                                             long long int
      |                                          %ld
main.c:157:45: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘cl_ulong’ {aka ‘long unsigned int’} [-Wformat=]
  157 |    printf("Max Const Memory Buffer Size: %lld\n", maxConstBufSize);
      |                                          ~~~^     ~~~~~~~~~~~~~~~
      |                                             |     |
      |                                             |     cl_ulong {aka long unsigned int}
      |                                             long long int
      |                                          %ld
main.c: In function ‘createClCtx’:
main.c:261:2: warning: ‘clCreateCommandQueue’ is deprecated [-Wdeprecated-declarations]
  261 |  cqCommandQueue = clCreateCommandQueue(cxGPUContext, cdDevices[gpu_id], 0, &clErr);
      |  ^~~~~~~~~~~~~~
In file included from bitcracker.h:37,
                 from main.c:22:
/usr/include/CL/cl.h:1781:1: note: declared here
 1781 | clCreateCommandQueue(cl_context                     context,
      | ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/CL/cl.h:32,
                 from bitcracker.h:37,
                 from opencl_attack.c:22:
/usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
   34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
      |         ^~~~~~~
In file included from /usr/include/CL/cl.h:32,
                 from bitcracker.h:37,
                 from utils.c:22:
/usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
   34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
      |         ^~~~~~~
utils.c: In function ‘parse_data’:
utils.c:179:3: error: label ‘out’ used but not defined
  179 |   goto out;
      |   ^~~~
utils.c: At top level:
utils.c:189:2: error: expected identifier or ‘(’ before ‘if’
  189 |  if(mac_comparison == 1 && !memcmp((*mac), zero_string, MAC_SIZE))
      |  ^~
utils.c:195:2: error: expected identifier or ‘(’ before ‘for’
  195 |  for (j=0; i < vmk_size*2; i+=2, j++)
      |  ^~~
utils.c:195:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
  195 |  for (j=0; i < vmk_size*2; i+=2, j++)
      |              ^
utils.c:195:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘+=’ token
  195 |  for (j=0; i < vmk_size*2; i+=2, j++)
      |                             ^~
utils.c:201:2: warning: data definition has no type or storage class
  201 |  fclose(fphash);
      |  ^~~~~~
utils.c:201:2: warning: type defaults to ‘int’ in declaration of ‘fclose’ [-Wimplicit-int]
utils.c:201:2: warning: parameter names (without types) in function declaration
utils.c:203:2: error: expected identifier or ‘(’ before ‘return’
  203 |  return BIT_SUCCESS;
      |  ^~~~~~
utils.c:205:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
  205 |  out:
      |     ^
utils.c:207:8: error: expected declaration specifiers or ‘...’ before ‘*’ token
  207 |   free(*salt);
      |        ^
utils.c:208:8: error: expected declaration specifiers or ‘...’ before ‘*’ token
  208 |   free(*nonce);
      |        ^
utils.c:209:8: error: expected declaration specifiers or ‘...’ before ‘*’ token
  209 |   free(*vmk);
      |        ^
utils.c:210:8: error: expected declaration specifiers or ‘...’ before ‘*’ token
  210 |   free(*mac);
      |        ^
utils.c:212:3: error: expected identifier or ‘(’ before ‘return’
  212 |   return BIT_FAILURE;
      |   ^~~~~~
utils.c:213:1: error: expected identifier or ‘(’ before ‘}’ token
  213 | }
      | ^
In file included from /usr/include/CL/cl.h:32,
                 from bitcracker.h:37,
                 from w_blocks.c:22:
/usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
   34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
      |         ^~~~~~~
make: *** [Makefile:9: all] Error 1

====== Executables in build directory ======
@mlpd
Copy link
Author

mlpd commented Jan 17, 2022

I should add a couple other things

  1. the directory /usr/local/cuda so I made a symlink in this location that targeted /usr/lib/cuda (which is where I found the cuda directory)
  2. And this is what the makefile looks like
#!/bin/bash

FLAGS=-Wextra
NVIDIA_INCLUDE=-I/usr/local/cuda/include -L/usr/local/cuda/lib64
COMMON_INCLUDE=-I/usr/include -L/usr/lib64 -L/usr/lib
MAKE_INCLUDE=$(COMMON_INCLUDE) $(NVIDIA_INCLUDE) -O3

all:
	gcc $(MAKE_INCLUDE) $(FLAGS) -o bitcracker_opencl main.c opencl_attack.c utils.c w_blocks.c -lOpenCL
#	clang -framework OpenCL -o bitcracker_opencl main.c opencl_attack.c utils.c w_blocks.c


clean:
	rm -rf *.o
	rm -rf bitcracker_opencl

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

1 participant