CMake unrecognized -fpic and -fPIC flags
flavian
Posts: 2
I'm getting a strange error with CMake.
/Users/blabla/libsimpletools/libsimpletools.c:1:0: error: -fPIC and -fpic are not supportedmakeCOLOR=#800000]2[/COLOR: *** [lib/CMakeFiles/simpletools.dir/parallax/Utility/libsimpletools/libsimpletools.c.o] Error 1makeCOLOR=#800000]1[/COLOR: *** [lib/CMakeFiles/simpletools.dir/all] Error 2make: *** [all] Error 2
This should call the propeller-elf-gcc-4.6.1 available in the path feeding all source files and libraries.
The compiler flags:
SET (CMAKE_C_FLAGS "-std=c99 -ltiny -lsimpletools -mcmm -fno-exceptions -mcog -lpthread -Os -o ${project_PROPELLER_SRCS} -cmm project.elf") Where the files are fetched with a FILE(GLOB_RECURSE).
What are -fpic and -fPIC? Couldn't find info anywhere.
/Users/blabla/libsimpletools/libsimpletools.c:1:0: error: -fPIC and -fpic are not supportedmakeCOLOR=#800000]2[/COLOR: *** [lib/CMakeFiles/simpletools.dir/parallax/Utility/libsimpletools/libsimpletools.c.o] Error 1makeCOLOR=#800000]1[/COLOR: *** [lib/CMakeFiles/simpletools.dir/all] Error 2make: *** [all] Error 2
This should call the propeller-elf-gcc-4.6.1 available in the path feeding all source files and libraries.
The compiler flags:
SET (CMAKE_C_FLAGS "-std=c99 -ltiny -lsimpletools -mcmm -fno-exceptions -mcog -lpthread -Os -o ${project_PROPELLER_SRCS} -cmm project.elf") Where the files are fetched with a FILE(GLOB_RECURSE).
What are -fpic and -fPIC? Couldn't find info anywhere.
Comments
No one has tried to use make or cmake with Simple LIbraries before.
Typically the libraries are built with SimpleIDE.
I can see some utility in using make or cmake for creating the libraries.
Can you share your make file?
The idea was simple, have a few tasks e.g make clean make run make test.
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
PROJECT (test)
SET (test_VERSION_MAJOR 0)
SET (test_VERSION_MINOR 0)
SET (test_VERSION_PATCH 1)
SET (CMAKE_C_COMPILER propeller-elf-gcc-4.6.1)
SET (CMAKE_CROSSCOMPILING FALSE)
add_subdirectory (src)
add_subdirectory (lib)
file(GLOB test_SRCS src/*.c src/*.h)
file(GLOB test_PROPELLER_SRCS src/*.c src/*.elf src/*.spin src/*.side)
message("${test_PROPELLER_SRCS}")
SET (CMAKE_C_FLAGS "-std=c99 -ltiny -lsimpletools -mcmm -fno-exceptions -mcog -lpthread -Os -o test ${test_SRCS}") message("${CMAKE_C_FLAGS}")
add_executable(test ${test_SRCS})
target_link_libraries(test unity simpletools)
install (TARGETS test DESTINATION bin)
The problem is that CMake is passing some default flags to the propeller compiler, specifically -fpic -fPIC
You aren't doing it the right way to say enough. Now, unfortunately, I modified my working code recently so it is broken. I think I have a backup however that may have a working build system still.
Please PM me later to remind me. Thanks,
Perhaps you could override -fPIC and -fpic with -no-fpic ?
You can't use -mcmm and -mcog at the same time. Just use -mcmm.
I seriously recommend not using Tiny especially if you are using simpletools.
First you need a top level file, then some directory linkers, then the bottom level files that have code builders in them and some spec files. Finally you need a tool chain file.
You may need to patch some of the names of things and patches in the code below... but, in general the code works. It should take you about a day to get it working or less. Refer to the CMake Wiki for help.
File System Layout
Top Build File
Tool Chain File
Project Builder
Directory Linker
Library Source File - YOU EDIT THIS
Library Builder File - READ ONLY
I hope this helps... (I'll see if I can find that backup)
Good luck!