mvo5 / libsmbclient-go

Go bindings for libsmbclient
MIT License
18 stars 11 forks source link

lib: unconditionally set `-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64` #11

Closed mvo5 closed 2 years ago

mvo5 commented 2 years ago

The latest debian version of libsmbclient-dev no longer sets the large file support cflags in libsmbclient.h [1]. This leads to build failures on 32bit systems.

It seems to me that ideally pkg-config --cflags smbclient would DTRT and return -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 along with -I/usr/include/samba-4.0. However this is not the case.

The cgo system also does not allow running arbitrary scripts so just calling getconf LFS_CFLAGS is not an option.

This commit adds a new libsmbclient_lfs.go file that is only build on 386/arm and defined the needed LFS cflags.

[1] https://github.com/mvo5/libsmbclient-go/issues/10

panlinux commented 2 years ago

It seems to me that ideally pkg-config --cflags smbclient would DTRT and return -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 along with -I/usr/include/samba-4.0

That is an excellent point. pkg-config is not even a dependency of libsmbclient-dev, though, so I wonder how many projects use it. Does the golang build system (or libsmbclient-go) use pkg-config?

mvo5 commented 2 years ago

It seems to me that ideally pkg-config --cflags smbclient would DTRT and return -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 along with -I/usr/include/samba-4.0

That is an excellent point. pkg-config is not even a dependency of libsmbclient-dev, though, so I wonder how many projects use it. Does the golang build system (or libsmbclient-go) use pkg-config?

Indeed, it's not right now - there is no good reason for this though, I should fix it. golang supports pkg-config [1] so that would be a nice way out (if samba upstream adds the needed bits at least).

[1] https://pkg.go.dev/github.com/rjeczalik/pkgconfig/cmd/pkg-config

panlinux commented 2 years ago

Are the tests below stalled? It's been running for 5h now