Ubuntu下使用eProsima FastRTPS编译makefile_x64Linux2.6gcc遇阻求助
makefile_x64Linux2.6gcc on Ubuntu Hey there! Let's work through this compilation issue you're hitting with eProsima FastRTPS on Ubuntu. That makefile_x64Linux2.6gcc is a platform-specific Makefile, and the problem is likely that make isn't picking it up by default—here's how to fix it:
1. Directly Specify the Makefile to make
By default, make looks for files named Makefile (uppercase) or makefile (lowercase). To use your custom-named Makefile, use the -f flag to point directly to it:
make -f makefile_x64Linux2.6gcc
Make sure you run this command from the same directory where the makefile_x64Linux2.6gcc file lives. If it's in a subfolder, include the full or relative path:
make -f ./subfolder/path/makefile_x64Linux2.6gcc
2. Verify Your Build Dependencies
First, double-check you have the basic Ubuntu build tools installed—missing these can cause silent or confusing failures:
sudo apt update && sudo apt install build-essential
This installs gcc, g++, make, and other core utilities needed for compiling C/C++ code.
3. Fix Compatibility Issues (if the Makefile is outdated)
The x64Linux2.6gcc in the filename suggests this Makefile was built for older Linux kernels (2.6 series) and possibly older GCC versions. If you hit errors about unsupported compiler flags, try:
- Explicitly specify your system's current GCC version (replace
11with your installed version—check withgcc --version):CC=gcc-11 CXX=g++-11 make -f makefile_x64Linux2.6gcc - Open the
makefile_x64Linux2.6gccfile in a text editor and remove any deprecated compiler flags (e.g., old-Wflags that aren't supported in modern GCC releases).
4. Use the Official CMake Build Method (Recommended)
eProsima FastRTPS now officially recommends using CMake for builds, which is more robust and compatible with modern Ubuntu systems. If the custom Makefile gives you persistent issues, switch to this approach:
- Navigate to your FastRTPS source directory
- Create and enter a dedicated build folder:
mkdir build && cd build - Configure the build with CMake:
cmake .. - Compile (use
-j$(nproc)to speed up using all your CPU cores):make -j$(nproc) - Install the library (optional but useful for system-wide access):
sudo make install
Give these steps a try—starting with the -f flag for the Makefile should resolve the immediate issue. If you hit specific error messages, feel free to share them for more targeted help!
内容的提问来源于stack exchange,提问作者Teddy 1993

