Skip to content

Commit

Permalink
Remove duplicate libraries linked on MacOS (#1944)
Browse files Browse the repository at this point in the history
Explanation: -ldl is dynamic linking library and -lm is math library. Both are not needed for Mac OS because the OS use different linking mechanism and math is part of C stdlib anyway.
  • Loading branch information
kirugan authored Jul 15, 2024
1 parent e180de2 commit 7f924d3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ endif

ifeq ($(shell uname -s),Darwin)
export CGO_LDFLAGS=-framework Foundation -framework SystemConfiguration
else
export CGO_LDFLAGS=-ldl -lm
endif

rustdeps: vm core-rust compiler
Expand Down
4 changes: 2 additions & 2 deletions core/class_hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package core
//#include <stddef.h>
//
// extern void Cairo0ClassHash(char* class_json_str, char* hash);
// #cgo vm_debug LDFLAGS: -L./rust/target/debug -ljuno_starknet_core_rs -ldl -lm
// #cgo !vm_debug LDFLAGS: -L./rust/target/release -ljuno_starknet_core_rs -ldl -lm
// #cgo vm_debug LDFLAGS: -L./rust/target/debug -ljuno_starknet_core_rs
// #cgo !vm_debug LDFLAGS: -L./rust/target/release -ljuno_starknet_core_rs
import "C"

import (
Expand Down
4 changes: 2 additions & 2 deletions starknet/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package starknet
// extern char* compileSierraToCasm(char* sierra_json);
// extern void freeCstr(char* ptr);
//
// #cgo vm_debug LDFLAGS: -L./rust/target/debug -ljuno_starknet_compiler_rs -ldl -lm
// #cgo !vm_debug LDFLAGS: -L./rust/target/release -ljuno_starknet_compiler_rs -ldl -lm
// #cgo vm_debug LDFLAGS: -L./rust/target/debug -ljuno_starknet_compiler_rs
// #cgo !vm_debug LDFLAGS: -L./rust/target/release -ljuno_starknet_compiler_rs
import "C"

import (
Expand Down
4 changes: 2 additions & 2 deletions vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ extern void cairoVMExecute(char* txns_json, char* classes_json, char* paid_fees_
extern char* setVersionedConstants(char* json);
extern void freeString(char* str);
#cgo vm_debug LDFLAGS: -L./rust/target/debug -ljuno_starknet_rs -ldl -lm
#cgo !vm_debug LDFLAGS: -L./rust/target/release -ljuno_starknet_rs -ldl -lm
#cgo vm_debug LDFLAGS: -L./rust/target/debug -ljuno_starknet_rs
#cgo !vm_debug LDFLAGS: -L./rust/target/release -ljuno_starknet_rs
*/
import "C"

Expand Down

0 comments on commit 7f924d3

Please sign in to comment.