[SOLVED] Complile (link) error with two targets

I have a strange problem when compiling to two targets.
If I change the order of adding the environment to platformio.ini, then the error occurs in the second target (alternating).
At the same time it manages to compile and link only one target.

macOS 10.12.5, Atom and Platformio Uptodate.

Platformio.ini file:

[platformio]
src_dir = dragon

[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino

[env:ESP32]
platform = espressif32_stage
board = esp32dev
framework = arduino

build_flags = -Wl, -DMQTT_MAX_PACKET_SIZE=512
lib_deps = PubSubClient

Error:

  [Thu Apr 13 07:39:35 2017] Processing esp12e (platform: espressif8266; board: esp12e; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Converting main.ino
Collected 29 compatible libraries
Looking for dependencies...
Library Dependency Graph

|-- <ESP8266WiFi> v1.0
|-- <RCSwitch> v2.52
|-- <PubSubClient> v2.6
Compiling .pioenvs/esp12e/src/main.ino.o
Calculating size .pioenvs/esp12e/firmware.elf
text       data     bss     dec     hex filename
231012     3404   30040  264456   40908 .pioenvs/esp12e/firmware.elf
========================= [SUCCESS] Took 1.37 seconds =========================
 
[Thu Apr 13 07:39:37 2017] Processing ESP32 (platform: espressif32_stage; lib_deps: PubSubClient; build_flags: -Wl, -DMQTT_MAX_PACKET_SI
ZE=512; board: esp32dev; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Converting main.ino
Collected 19 compatible libraries
Looking for dependencies...
Library Dependency Graph
|-- <PubSubClient> v2.6
|-- <RCSwitch> v2.52
|-- <WiFi> v1.0
Compiling .pioenvs/ESP32/src/main.ino.o
Linking .pioenvs/ESP32/firmware.elf
/Users/jkk/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot fin
d : No such file or directory
PIO Buildplatformio.ini00020:1
LFUTF-8INI

OKAY! I corrected … wrong flag for the environment.

build_flags = -Wl

Sorry for the confusion…

Please close topic…