Skip to content

Commit 896eaa2

Browse files
committed
Run a full external link for CGO against musl when building in Docker
Signed-off-by: Josh Kneubuhl <[email protected]>
1 parent 2944542 commit 896eaa2

File tree

6 files changed

+129
-11
lines changed

6 files changed

+129
-11
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
GO_VER: 1.18.7
1313
ALPINE_VER: 3.16
1414
FABRIC_VER: ${{ github.ref_name }}
15-
DOCKER_REGISTRY: docker.io # or ghcr.io
15+
DOCKER_REGISTRY: docker.io
1616

1717
permissions:
1818
contents: read

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ tools: $(TOOLS_EXES)
224224
.PHONY: $(RELEASE_EXES)
225225
$(RELEASE_EXES): %: $(BUILD_DIR)/bin/%
226226

227-
$(BUILD_DIR)/bin/%: GO_LDFLAGS = $(METADATA_VAR:%=-X $(PKGNAME)/common/metadata.%)
227+
$(BUILD_DIR)/bin/%: GO_LDFLAGS += $(METADATA_VAR:%=-X $(PKGNAME)/common/metadata.%)
228228
$(BUILD_DIR)/bin/%:
229229
@echo "Building $@"
230230
@mkdir -p $(@D)

images/orderer/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ ARG GO_TAGS
2828
ARG FABRIC_VER
2929
ENV FABRIC_VER ${FABRIC_VER}
3030

31-
# Disable cgo when building in the container. This will create a static binary, which can be
32-
# copied and run in the base alpine container without the libc/musl runtime.
33-
ENV CGO_ENABLED 0
31+
# When building in docker, the binary must be linked statically with CGO against libmusl
32+
# in order to avoid SIGSEGV errors when running on alpine.
33+
# This uses the system CC compiler, which has been installed above with apk as musl-dev.
34+
#ENV CC $(uname -m)-alpine-linux-musl-gcc
35+
ENV CGO_ENABLED 1
36+
ENV GO_LDFLAGS -linkmode external -extldflags '-static'
3437

3538
RUN make orderer GO_TAGS=${GO_TAGS}
3639

images/peer/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ ARG GO_TAGS
2727
ARG FABRIC_VER
2828
ENV FABRIC_VER ${FABRIC_VER}
2929

30-
# Disable cgo when building in the container. This will create a static binary, which can be
31-
# copied and run in the base alpine container without the libc/musl runtime.
32-
ENV CGO_ENABLED 0
30+
# When building in docker, the binary must be linked statically with CGO against libmusl
31+
# in order to avoid SIGSEGV errors when running on alpine.
32+
# This uses the system CC compiler, which has been installed above with apk as musl-dev.
33+
#ENV CC $(uname -m)-alpine-linux-musl-gcc
34+
ENV CGO_ENABLED 1
35+
ENV GO_LDFLAGS -linkmode external -extldflags '-static'
36+
3337

3438
RUN make peer GO_TAGS=${GO_TAGS}
3539
RUN make ccaasbuilder

images/tools/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ ARG GO_TAGS
2222
ARG FABRIC_VER
2323
ENV FABRIC_VER ${FABRIC_VER}
2424

25-
# Disable cgo when building in the container. This will create a static binary, which can be
26-
# copied and run in the base alpine container without the libc/musl runtime.
27-
ENV CGO_ENABLED 0
25+
# When building in docker, the binary must be linked statically with CGO against libmusl
26+
# in order to avoid SIGSEGV errors when running on alpine.
27+
# This uses the system CC compiler, which has been installed above with apk as musl-dev.
28+
# CC=$(uname -m)-alpine-linux-musl-gcc
29+
#ENV CC $(uname -m)-alpine-linux-musl-gcc
30+
ENV CGO_ENABLED 1
31+
ENV GO_LDFLAGS -linkmode external -extldflags '-static'
2832

2933
RUN make tools GO_TAGS=${GO_TAGS}
3034

release_notes/v2.5.0-alpha3.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
v2.5.0-alpha3 Release Notes - 16 Dec 2022
2+
=================================
3+
4+
5+
Improvements
6+
------------
7+
8+
- Prepares multi-arch Docker images for linux/arm64 and linux/amd64
9+
10+
Fixes
11+
-----
12+
13+
- Resolves SIGSEGV errors encountered with alpha1 release binaries
14+
- Resolves SIGSEGV errors running on alpine-based images on ARM64
15+
- Resolves [Issue #3867](https://github.com/hyperledger/fabric/issues/3867)
16+
17+
18+
Dependencies
19+
------------
20+
Fabric v2.5.0-alpha2 has been tested with the following dependencies:
21+
* Go 1.18.7
22+
* CouchDB v3.1.1
23+
24+
Fabric docker images on dockerhub utilize Alpine 3.16.
25+
26+
27+
Deprecations (existing)
28+
-----------------------
29+
30+
**Ordering service system channel is deprecated**
31+
32+
v2.3 introduced the ability to manage an ordering service without a system channel.
33+
Managing an ordering service without a system channel has privacy, scalability,
34+
and operational benefits. The use of a system channel is deprecated and may be removed in a future release.
35+
For information about removal of the system channel, see the [Create a channel without system channel documentation](https://hyperledger-fabric.readthedocs.io/en/release-2.3/create_channel/create_channel_participation.html).
36+
37+
**FAB-15754: The 'Solo' consensus type is deprecated.**
38+
39+
The 'Solo' consensus type has always been marked non-production and should be in
40+
use only in test environments; however, for compatibility it is still available,
41+
but may be removed entirely in a future release.
42+
43+
**FAB-16408: The 'Kafka' consensus type is deprecated.**
44+
45+
The 'Raft' consensus type was introduced in v1.4.1 and has become the preferred
46+
production consensus type. There is a documented and tested migration path from
47+
Kafka to Raft, and existing users should migrate to the newer Raft consensus type.
48+
For compatibility with existing deployments, Kafka is still supported,
49+
but may be removed entirely in a future release.
50+
Additionally, the fabric-kafka and fabric-zookeeper docker images are no longer updated, maintained, or published.
51+
52+
**Fabric CouchDB image is deprecated**
53+
54+
v2.2.0 added support for CouchDB 3.1.0 as the recommended and tested version of CouchDB.
55+
If prior versions are utilized, a Warning will appear in the peer log.
56+
Note that CouchDB 3.1.0 requires that an admin username and password be set,
57+
while this was optional in CouchDB v2.x. See the
58+
[Fabric CouchDB documentation](https://hyperledger-fabric.readthedocs.io/en/v2.2.0/couchdb_as_state_database.html#couchdb-configuration)
59+
for configuration details.
60+
Also note that CouchDB 3.1.0 default max_document_size is reduced to 8MB. Set a higher value if needed in your environment.
61+
Finally, the fabric-couchdb docker image will not be updated to v3.1.0 and will no longer be updated, maintained, or published.
62+
Users can utilize the official CouchDB docker image maintained by the Apache CouchDB project instead.
63+
64+
**FAB-7559: Support for specifying orderer endpoints at the global level in channel configuration is deprecated.**
65+
66+
Utilize the new 'OrdererEndpoints' stanza within the channel configuration of an organization instead.
67+
Configuring orderer endpoints at the organization level accommodates
68+
scenarios where orderers are run by different organizations. Using
69+
this configuration ensures that only the TLS CA certificates of that organization
70+
are used for orderer communications; in contrast to the global channel level endpoints which
71+
would cause an aggregation of all orderer TLS CA certificates across
72+
all orderer organizations to be used for orderer communications.
73+
74+
**FAB-17428: Support for configtxgen flag `--outputAnchorPeersUpdate` is deprecated.**
75+
76+
The `--outputAnchorPeersUpdate` mechanism for updating anchor peers has always had
77+
limitations (for instance, it only works the first time anchor peers are updated).
78+
Instead, anchor peer updates should be performed through channel configuration updates.
79+
80+
**FAB-15406: The fabric-tools docker image is deprecated**
81+
82+
The fabric-tools docker image will not be published in future Fabric releases.
83+
Instead of using the fabric-tools docker image, users should utilize the
84+
published Fabric binaries. The Fabric binaries can be used to make client calls
85+
to Fabric runtime components, regardless of where the Fabric components are running.
86+
87+
**FAB-15317: Block dissemination via gossip is deprecated**
88+
89+
Block dissemination via gossip is deprecated and may be removed in a future release.
90+
Fabric peers can be configured to receive blocks directly from an ordering service
91+
node, and not gossip blocks, by using the following configuration:
92+
```
93+
peer.gossip.orgLeader: true
94+
peer.gossip.useLeaderElection: false
95+
peer.gossip.state.enabled: false
96+
peer.deliveryclient.blockGossipEnabled: false
97+
```
98+
99+
**FAB-15061: Legacy chaincode lifecycle is deprecated**
100+
101+
The legacy chaincode lifecycle from v1.x is deprecated and will be removed
102+
in a future release. To prepare for the eventual removal, utilize the v2.x
103+
chaincode lifecycle instead, by enabling V2_0 application capability on all
104+
channels, and redeploying all chaincodes using the v2.x lifecycle. The new
105+
chaincode lifecycle provides a more flexible and robust governance model
106+
for chaincodes. For more details see the
107+
[documentation for enabling the new lifecycle](https://hyperledger-fabric.readthedocs.io/en/release-2.2/enable_cc_lifecycle.html).

0 commit comments

Comments
 (0)