$ cargo install cargo-generate
error: linking with `cc` failed: exit status: 1
[...]
PDK Troubleshooting
When using Flex Gateway Policy Development Kit (PDK), you might encounter issues with PDK itself. See the following sections to help you resolve these issues:
To debug issues with your custom policy, see:
Cargo-Generate Error on a Mac Device
When compiling Rust on a Mac Device for the first time, the following error might occur:
To troubleshoot this error:
-
Ensure Xcode is installed, then compile again.
To install Xcode, execute the following command:
xcode-select --install
-
If Xcode is installed and PDK still does not compile, create or edit the
~/.cargo/config.toml
file by adding the following:[target.x86_64-apple-darwin] rustflags = [ "-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup", ] [target.aarch64-apple-darwin] rustflags = [ "-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup", ]
Anypoint CLI Credentials Error
Anypoint CLI requires multi-factor authentication (MFA) with a Connected App. Using any PDK command without Connected App credentials results in an error similar to the following:
Error: Failed to launch the browser process! undefined
[...]:ERROR:ozone_platform_x11.cc(239)] Missing X server or $DISPLAY
[21921:21921:1103/113335.217708:ERROR:env.cc(255)] The platform failed to initialize. Exiting.
TROUBLESHOOTING: https://pptr.dev/troubleshooting
To configure Anypoint CLI with MFA authentication using a Connected App, refer to Authentication to the Anypoint Platform CLI.
Group ID Error When Creating the Policy Project
Anypoint CLI uses the ANYPOINT_ORG
environment variable. This variable can use either the organization name or the organization ID as the value. If the variable is set to the organization name, the policy creation command fails to infer the group ID of the organization.
Use the organization ID for the value of ANYPOINT_ORG
. However, if you cannot change the variable, use one of the following methods to provide the group ID:
-
If you run the create command and receive the following prompt:
Please provide a valid group-id (the id of the organization that will own the asset):
Enter your group ID, then press Enter.
-
Use the
--group-id
flag when creating the PDK project, for example:anypoint-cli-v4 pdk policy-project create -n <policy-name> --group-id <organization-id>
401 Authorization Error When Running Make Setup
When executing `make setup', the following error might occur:
$ make setup
Login token for `anypoint` saved
[...]
Caused by:
failed to get successful HTTP response from `https://anypoint.mulesoft.com/crates[...]/download` [...], got 401
body:
make: *** [install-cargo-anypoint] Error 101
This error occurs when your version of Rust is not v1.74.0 or later.
To solve this error, refer to Rust Requirements for Using PDK to ensure your Rust software meets the required version.