[go-nuts] [undefined reference] while compiling on Apple Silicon #44

2023-06-28 Thread Richard Whatever
 

*Utilizing the c and c++ cross compiler, my first try on the go 
build command is as follows:*

*```*

CGO_LDFLAGS="-L/opt/homebrew/Cellar/rocksdb@7.7.3/7.7.3/lib 
-L/opt/homebrew/Cellar/zstd/1.5.5/lib -L/opt/homebrew/Cellar/lz4/1.9.4/lib 
-L/opt/homebrew/Cellar/snappy/1.1.10/lib 
-L/opt/homebrew/Cellar/zlib/1.2.13/lib 
-L/opt/homebrew/cellar/musl-cross/0.9.9_1/libexec/lib" 
CGO_CFLAGS="-I/opt/homebrew/cellar/rocksdb@7.7.3/7.7.3/include" 
CGO_ENABLED=1 GOOS=linux  GOARCH=amd64 CC=x86_64-linux-musl-gcc 
CXX=x86_64-linux-musl-g++ go build -o yet

```


*Ideally, this should work, but my terminal once again yells at me*


-link-2821846975/54.o: in function 
`gorocksdb_comparator_with_ts_create':

grocksdb.c:(.text+0x88): undefined reference to 
`rocksdb_comparator_with_ts_create'

/opt/homebrew/Cellar/musl-cross/0.9.9_1/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld:
 
/var/folders/85/7xzvr1n56wnbx8tj6h38drq8gn/T/go-link-2821846975/54.o: 
in function `gorocksdb_compactionfilter_create':

grocksdb.c:(.text+0xbe): undefined reference to 
`rocksdb_compactionfilter_create'

/opt/homebrew/Cellar/musl-cross/0.9.9_1/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld:
 
/var/folders/85/7xzvr1n56wnbx8tj6h38drq8gn/T/go-link-2821846975/54.o: 
in function `gorocksdb_mergeoperator_create':

grocksdb.c:(.text+0x104): undefined reference to 
`rocksdb_mergeoperator_create'

/opt/homebrew/Cellar/musl-cross/0.9.9_1/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld:
 
/var/folders/85/7xzvr1n56wnbx8tj6h38drq8gn/T/go-link-2821846975/54.o: 
in function `gorocksdb_slicetransform_create':

grocksdb.c:(.text+0x16d): undefined reference to 
`rocksdb_slicetransform_create'

collect2: error: ld returned 1 exit status


*Being spammed of those countless undefined reference errors, I think there 
must have been something wrong with my go build configurations, by looking 
and half-guessing at *
*https://stackoverflow.com/questions/62158905/undefined-references-to-symbols-in-standard-libraries-with-musl-cross-make*
 
* , I 
changed my go build command as follows:*


CGO_LDFLAGS="-L/opt/homebrew/Cellar/rocksdb@7.7.3/7.7.3/lib 
-L/opt/homebrew/Cellar/zstd/1.5.5/lib -L/opt/homebrew/Cellar/lz4/1.9.4/lib 
-L/opt/homebrew/Cellar/snappy/1.1.10/lib 
-L/opt/homebrew/Cellar/zlib/1.2.13/lib 
-L/opt/homebrew/cellar/musl-cross/0.9.9_1/libexec/lib" 
CGO_CFLAGS="-I/opt/homebrew/cellar/rocksdb@7.7.3/7.7.3/include" 
CGO_ENABLED=1 GOOS=linux  GOARCH=amd64 CC=x86_64-linux-musl-gcc 
CXX=x86_64-linux-musl-g++ go build -o yet


*Yet the same error occurs.*

*I think there must have been something extremely simple and outright on 
the surface, right below my nose, that somehow I've just managed to unsee, 
yet I can't figure out what and how. Partly because my familiarity with C 
is not competent enough. And that's why I'm now humbly asking for any 
assistance that can help me get this over with.*

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/61e2778a-e7eb-4f1b-8607-6d63d37f7aa7n%40googlegroups.com.


Re: [go-nuts] How to resolve error Cannot use 'struct{ width, height float64 }{2.0, 3.0}' (type struct {...}) as the type struct {...}

2022-08-30 Thread Richard Whatever
Thanks for the assistance. Issue resolved by naming "width" and "height"
with the capital starting letter, "Width" and "Height". Looks like I'm
still not familiar with the Go export syntax yet.

Harris, Andrew  于2022年8月31日周三 06:07写道:

> I believe anonymous definitions of structs here is the cause. While
> equivalent, each anonymous definition is a distinct type.
>
> Get Outlook for iOS <https://aka.ms/o0ukef>
> ------
> *From:* golang-nuts@googlegroups.com  on
> behalf of Richard Whatever 
> *Sent:* Tuesday, August 30, 2022 7:46:47 AM
> *To:* golang-nuts 
> *Subject:* [go-nuts] How to resolve error Cannot use 'struct{ width,
> height float64 }{2.0, 3.0}' (type struct {...}) as the type struct {...}
>
>
> I'm developing a mvc Golang server.
>
> The model file is as follows:
> type Object struct { ... TargetSize struct{ width, height float64 }
> `json:"targetSize"` ... }
>
> The controller file is as follows:
> func (c *GetObject) Get() []models.Object { return []models.Object{ {...
> struct{ width, height float64 }{2.0, 3.0}, ... },
>
> I keep on getting the error of "Cannot use 'struct{ width, height float64
> }{2.0, 3.0}' (type struct {...}) as the type struct {...}" and I don't know
> how to resolve this.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/a6b7d86c-8ed6-4be1-a265-3761f3b8be67n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/a6b7d86c-8ed6-4be1-a265-3761f3b8be67n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAKS_JOh5FWwmnV8q-ECsn%3DyL7BV5fO78ZwVkPMBoSCi8itr%2B7w%40mail.gmail.com.


[go-nuts] How to resolve error Cannot use 'struct{ width, height float64 }{2.0, 3.0}' (type struct {...}) as the type struct {...}

2022-08-30 Thread Richard Whatever


I'm developing a mvc Golang server.

The model file is as follows:
type Object struct { ... TargetSize struct{ width, height float64 } 
`json:"targetSize"` ... } 

The controller file is as follows:
func (c *GetObject) Get() []models.Object { return []models.Object{ {... 
struct{ width, height float64 }{2.0, 3.0}, ... }, 

I keep on getting the error of "Cannot use 'struct{ width, height float64 
}{2.0, 3.0}' (type struct {...}) as the type struct {...}" and I don't know 
how to resolve this.



-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a6b7d86c-8ed6-4be1-a265-3761f3b8be67n%40googlegroups.com.