Skip to content

Stat_t on MIPS uses 32-bit fields for Dev and Rdev, so we need to cast these to uint64.#37490

Closed
poizan42 wants to merge 1 commit intomoby:masterfrom
poizan42:fix-mips-devNumber
Closed

Stat_t on MIPS uses 32-bit fields for Dev and Rdev, so we need to cast these to uint64.#37490
poizan42 wants to merge 1 commit intomoby:masterfrom
poizan42:fix-mips-devNumber

Conversation

@poizan42
Copy link
Contributor

@poizan42 poizan42 commented Jul 18, 2018

Signed-off-by: Kasper Fabæch Brandt poizan@poizan.dk

- What I did
Fixed build errors about like "cannot use s.Rdev (type uint32) as type uint64" when targeting mips due to the Dev and Rdev in Stat_t being 32-bit on 32-bit mips.

- How I did it
Inserted casts to uint64 where needed.

(fixes #28058 it would seem)

- How to verify it
Try building docker targeting mips (still won't build successfully)

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@poizan42
Copy link
Contributor Author

Why does the build fail? Is it due to the warnings?

16:13:37 daemon/graphdriver/copy/copy.go:157:28:warning: unnecessary conversion (unconvert)
16:13:37 daemon/graphdriver/devmapper/deviceset.go:1741:91:warning: unnecessary conversion (unconvert)
16:13:37 daemon/graphdriver/devmapper/deviceset.go:1741:68:warning: unnecessary conversion (unconvert)
16:13:37 daemon/graphdriver/devmapper/deviceset.go:1532:26:warning: unnecessary conversion (unconvert)
16:13:37 daemon/graphdriver/devmapper/deviceset.go:1531:26:warning: unnecessary conversion (unconvert)
16:13:37 pkg/loopback/loopback.go:57:33:warning: unnecessary conversion (unconvert)
16:13:37 pkg/system/stat_linux.go:11:15:warning: unnecessary conversion (unconvert)

@poizan42 poizan42 changed the title Stat_t on 32-bit MIPS uses 32-bit fields for Dev and Rdev, so we need to cast these to uint64. Stat_t on MIPS uses 32-bit fields for Dev and Rdev, so we need to cast these to uint64. Jul 18, 2018
… to cast these to uint64.

Signed-off-by: Kasper Fabæch Brandt <poizan@poizan.dk>
@thaJeztah
Copy link
Member

ping @kolyshkin @dnephin PTAL

@olljanat
Copy link
Contributor

Why does the build fail? Is it due to the warnings?

@poizan42 yes, you have to correct your code based on warnings.

@poizan42
Copy link
Contributor Author

poizan42 commented Dec 25, 2018

@olljanat Yeah, so that is a problem. The fields are 32-bits on MIPS so it won't compile without the casts. But with the casts it causes redundant cast warnings on all other platforms.

So any suggestions? Can we disable the warnings, or should I make wrappers in platform specific files?

@olljanat
Copy link
Contributor

Disabling warnings is not option for sure but I'm not also sure what is.

@dnephin
Copy link
Member

dnephin commented Dec 25, 2018

This is not the first time we have encountered this problem. I remember dealing with it in another package. If you git grep 'nolint: unconvert' you will see them.

I think the correct solution is to add nolint , and a comment about why.

// The type is 32bit on mips.
// nolint: unconvert

@thaJeztah
Copy link
Member

@poizan42 wondering if you're still working on this? I also recalled we had something similar recently; #39212 (wondering if we need to use the same approach here)

@kolyshkin ptal ^^

@neheb
Copy link

neheb commented Jul 27, 2019

Any progress on this? It's failing on OpenWrt with libnetwork: https://downloads.openwrt.org/snapshots/faillogs/mips64_octeonplus/packages/libnetwork/compile.txt

@ydcool
Copy link
Contributor

ydcool commented Aug 1, 2019

Recently I build docker on mips64le and got the same errors, and the solution was the same, so I wonder if this PR still on progress ? If not, could I submit another PR to fix those errors? @poizan42
@thaJeztah @neheb

@neheb
Copy link

neheb commented Aug 1, 2019

I have no problem with it.

@poizan42
Copy link
Contributor Author

poizan42 commented Aug 9, 2019

So seems this was fixed in #39646 which is merged, so I'm closing this.

@poizan42 poizan42 closed this Aug 9, 2019
siretart added a commit to siretart/storage that referenced this pull request May 26, 2020
Stat_t on MIPS uses 32-bit fields for Dev and Rdev, so we need to cast these to uint64

Inpiration from moby/moby#37490
Example build failure log: https://buildd.debian.org/status/fetch.php?pkg=golang-github-containers-storage&arch=mips64el&ver=1.15.8%2Bdfsg1-1&stamp=1580872314&raw=0
siretart added a commit to siretart/storage that referenced this pull request May 26, 2020
Stat_t on MIPS uses 32-bit fields for Dev and Rdev, so we need to cast these to uint64

Inpiration from moby/moby#37490
Example build failure log: https://buildd.debian.org/status/fetch.php?pkg=golang-github-containers-storage&arch=mips64el&ver=1.15.8%2Bdfsg1-1&stamp=1580872314&raw=0

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
siretart added a commit to siretart/storage that referenced this pull request Jul 19, 2020
Stat_t on MIPS uses 32-bit fields for Dev and Rdev, so we need to cast these to uint64

Turns out the change in 0717190
is incomplete and an additional line needs a cast.

Inpiration from moby/moby#37490
Example build failure log: https://buildd.debian.org/status/fetch.php?pkg=golang-github-containers-storage&arch=mips64el&ver=1.20.2-1&stamp=1594477648&raw=0Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use s.Rdev (type uint32) as type uint64--mips64el

8 participants