TelegramMessenger / MTProxy

5.02k stars 830 forks source link

Compilation Error: Multiple Definition of 'PID' and 'total_vv_tree_nodes' in MTProxy #617

Open alihaghighat opened 1 week ago

alihaghighat commented 1 week ago

In the description of the issue, provide detailed information about:

The specific errors you encountered during compilation (e.g., "multiple definition of 'PID'"). The system environment (e.g., Linux distribution, version). The version of GCC or other compiler you're using. Any changes you made to the Makefile or other files.

Solution:

In the Makefile, update the CFLAGS and LDFLAGS to the following values:

CFLAGS = -fcommon -O3 -std=gnu11 -Wall -mpclmul -march=native
LDFLAGS = -fcommon -ggdb -rdynamic -lm -lrt -lcrypto -lz -lpthread

This modification ensures that global variables are handled correctly and resolves the compilation errors.

Steps Taken:

  1. Identified the Makefile as the source of the issue.
  2. Added the -fcommon flag to both CFLAGS and LDFLAGS to address the multiple definition errors.
  3. Recompiled the project after cleaning previous build artifacts using make clean.

After making this change, the project compiled successfully without any errors.