wendy512 / iec61850

GoLang IEC61850 library
GNU General Public License v3.0
161 stars 38 forks source link

ld problem #1

Closed faustfu closed 6 months ago

faustfu commented 6 months ago

os: Debian 12(docker) cpu: arm64

My code is below

package main

import (
    "fmt"
    "github.com/wendy512/iec61850"
    "log"
)

func main() {
    client, err := createClient()
    if err != nil {
        log.Println(err)
    }

    fmt.Printf("hello client = %+v\n", *client)
}

func createClient() (*iec61850.Client, error) {
    client, err := iec61850.NewClient(iec61850.NewSettings())
    if err != nil {
        return nil, err
    }

    return client, nil
}

I tried to run the code, but ld prompted error

/usr/local/go/pkg/tool/linux_arm64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lhal: No such file or directory
collect2: error: ld returned 1 exit status

I am not familiar about cgo, what should I do to fix the issue?

buhuang28 commented 6 months ago

// #cgo CFLAGS: -I./libiec61850/inc/hal/inc -I./libiec61850/inc/common/inc -I./libiec61850/inc/goose -I./libiec61850/inc/iec61850/inc -I./libiec61850/inc/iec61850/inc_private -I./libiec61850/inc/logging -I./libiec61850/inc/mms/inc -I./libiec61850/inc/mms/inc_private -I./libiec61850/inc/mms/iso_mms/asn1c // #cgo LDFLAGS: -static-libgcc -static-libstdc++ -L./libiec61850/lib/linux_armv8 -liec61850

buhuang28 commented 6 months ago

delete -lhal

wendy512 commented 6 months ago

hal has been replaced by pthread, please use go get -u github.com/wendy512/iec61850@v1.0.0 to get the latest version