Skip to content

Beginner question: How to build a program? #90

@s4m13337

Description

@s4m13337

I am exploring MLX-C for fun. I have already built the library and used make install to install the headers and libraries. They got installed at the path /usr/local/include/ and /usr/local/lib/. As a test program, I wrote the following:

#include<stdio.h>
#include "mlx/c/mlx.h"

int main(){
  printf("GPU information\n");
  printf("---------------");
  mlx_metal_device_info_t info = mlx_metal_device_info();
  printf("Architecture:\t%s\n", info.architecture);
  printf("Maximum buffer length:\t%ld\n", info.max_buffer_length);
  printf(
	 "Max recommended working set size:\t%ld\n",
	 info.max_recommended_working_set_size);
  printf("Memory size:\t%ld\n", info.memory_size);
  return 0;
}

With the build command below, I get errors:

clang -I/usr/local/include -L/usr/local/lib test.c -o test 
Undefined symbols for architecture arm64:
  "_mlx_metal_device_info", referenced from:
      _main in test-7c0886.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What is the correct way to build?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions