Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> MySQL

การจัดการปัญหา Compile MySQL (Dealing with Problems Compiling MySQL)

ปัญหา compile บางอย่างมาจากการ configure ไม่ถูกต้อง แก้โดย reconfigure

หากรัน CMake ติดต่อกัน อาจใช้ข้อมูลจาก previous run (ใน CMakeCache.txt) ซึ่งอาจผิดเมื่อ reconfigure

ทุกครั้งที่รัน CMake ต้องรัน 'make' ใหม่เพื่อ recompile ควรลบ old object files ก่อน (compiled ด้วย config options ต่างกัน)

คำสั่งก่อน re-run CMake:

On Unix:

shell> make clean
shell> rm CMakeCache.txt

On Windows:

shell> devenv MySQL.sln /clean
shell> del CMakeCache.txt

หาก build นอก source tree: ลบ build directory และสร้างใหม่ก่อน rerun CMake

บางระบบ warnings จากความแตกต่างใน system include files

กำหนด C/C++ Compilers:

shell> CC=gcc
shell> CXX=g++
shell> export CC CXX

Custom Compiler Flags:

ใช้ CMAKE_C_FLAGS และ CMAKE_CXX_FLAGS CMake options

ดู flags ที่ต้องระบุ: ใช้ mysql_config กับ --cflags และ --cxxflags options

Debug Compile Commands:

รัน 'make VERBOSE=1' แทน 'make' หลัง CMake configure

หาก compilation fails: ตรวจสอบ MYSQL_MAINTAINER_MODE option enabled หรือไม่ (mode นี้ทำให้ compiler warnings กลายเป็น errors ปิดอาจช่วย compile ได้)