Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building with Platformio - Multiple ways to build #2

Closed
PRO2XY opened this issue Dec 14, 2017 · 5 comments
Closed

Error building with Platformio - Multiple ways to build #2

PRO2XY opened this issue Dec 14, 2017 · 5 comments

Comments

@PRO2XY
Copy link

PRO2XY commented Dec 14, 2017

When building the example program on Platformio, the following error is thrown:

*** Multiple ways to build the same target were specified for: C:\Users\username\Documents\PlatformIO\ESP8266_MQTT_Broker.pioenvs\esp12e\lib\uMQTTB
roker-master\MQTT.o (from ['C:\Users\username\Documents\PlatformIO\ESP8266_MQTT_Broker\lib\uMQTTBroker-master\src\MQTT.cpp'] and from ['C:
\Users\username\Documents\PlatformIO\ESP8266_MQTT_Broker\lib\uMQTTBroker-master\src\MQTT.c'])
File "C:\Users\username.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 272, in BuildLibrary

This might be due to the same name (mqtt.c and MQTT.cpp) of the two files being referenced, due to the non-case-sensitive nature of files on Windows. Both mqtt.c and MQTT.cpp would make the same object file, MQTT.o.

Possible solution, change MQTT.cpp (and .h) to MQTT_Broker.cpp? Along with changing the class name and constructor and destructor? Or is that not a good way to deal with this issue?

@martin-ger
Copy link
Owner

No experience with PlatformIO, but if it is just the name, changing it is probably the best solution. However, the two Files MQTT.h and MQTT.cpp are NOT implementing the broker (this is uMQTTBroker.h and the file in the mqtt-dir). These are just the C++ interface to the client functions. Thus, if you only need the broker, dropping the two files might also be an option.

@PRO2XY
Copy link
Author

PRO2XY commented Dec 15, 2017

Ok! Thanks Martin.
I would just rename them to MQTT_Client instead. Do these provide the functions for the local client as well? In which case I would have use for them.
Are the 'MQTT_SetUserId' and 'MQTT_SetUserPwd', introduced in d54abcb, derived from these two files?

@martin-ger
Copy link
Owner

martin-ger commented Dec 15, 2017

All you need to interact with the local MQTT broker is in uMQTTBroker.h. The current MQTT.h/cpp are just required when you want to use the "original" functionality of tuanpmt's CLIENT lib (client to a remote broker), that is still included.

If you want to check username/password for any client connecting to your local broker, use the callback:

typedef bool (*MqttAuthCallback)(const char* username, const char *password, struct espconn *pesp_conn);

void MQTT_server_onAuth(MqttAuthCallback authCb);

and return true if you are willing to accept this u/p.

@PRO2XY
Copy link
Author

PRO2XY commented Dec 17, 2017

Thanks for the info Martin.
I was able to compile successfully without the MQTT.cpp/.h on PlatformIO. The local client works well. Thanks for providing this helpful library.

@PRO2XY PRO2XY closed this as completed Dec 17, 2017
@PRO2XY
Copy link
Author

PRO2XY commented Dec 17, 2017

May I also suggest putting this information on the Readme, for other users who may face the same error on Platformio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants