Thank you for your answer Henrik,
I tried removing the "-" from my options but it didn't work for me. But I manage to get an executable by doing the following:
I moved the -ldl and the -lpthread options to a <syslibs> option like this:
<linker>
<sysLibs>
<sysLib>
<name>dl</name>
</sysLib>
<sysLib>
<name>pthread</name>
</sysLib>
</sysLibs>
</linker>
I had to get rid of the "-l" part. No idea why they have to made it different from the normal way but anyway that is how it is.
I left my section for the options for the compiler like this:
<c>
<name>gcc</name>
<multiThreaded>true</multiThreaded>
<exceptions>false</exceptions>
<debug>true</debug>
<options>
<option>-g</option>
<option>-std=gnu99</option>
<option>-Wall</option>
</options>
<clearDefaultOptions/>
</c>
I like the <clearDefaultOptions/> options because otherwise the tool puts a lot of crap that I don't really know what is for and I don't really need. My <cpp> section is just a copy paste of this one. That is because that was the only way I could force the tool to use gcc instead of g++. I don't know why it tries to compile ".c" files with g++. I don't really like C++ :)
Finally just ran "mvn clean install" and the console displays a lot of errors like these ones
----------------------------------
[INFO]
Starting Core 1 with 3 source files...
[ERROR] /home/tomas/data/dev_tools/workspace_cpp/RpiCastServer_nar/src/main/c/dial_server.c: In function ‘handle_app_start’:
[WARNING] /home/tomas/data/dev_tools/workspace_cpp/RpiCastServer_nar/src/main/c/dial_server.c:154:35: warning: conversion to ‘int’ from ‘size_t’ may change the sign of the result [-Wsign-conversion]
[ERROR] body_size = strlen(body);
[ERROR] ^
[WARNING] /home/tomas/data/dev_tools/workspace_cpp/RpiCastServer_nar/src/main/c/dial_server.c:159:50: warning: conversion to ‘size_t’ from ‘int’ may change the sign of the result [-Wsign-conversion]
[ERROR] app->callback_data);
[ERROR] ^
[WARNING] /home/tomas/data/dev_tools/workspace_cpp/RpiCastServer_nar/src/main/c/dial_server.c:171:17: warning: conversion to ‘size_t’ from ‘int’ may change the sign of the result [-Wsign-conversion]
[ERROR] memcpy(app->payload, body, body_size);
[ERROR] ^
[ERROR] /home/tomas/data/dev_tools/workspace_cpp/RpiCastServer_nar/src/main/c/dial_server.c: In function ‘handle_app_status’:
[WARNING] /home/tomas/data/dev_tools/workspace_cpp/RpiCastServer_nar/src/main/c/dial_server.c:202:41: warning: conversion to ‘size_t’ from ‘int’ may change the sign of the result [-Wsign-conversion]
[ERROR] p = smartstrcat(p, " <", end - p);
---------------
But at the end shows me the good "[INFO] BUILD SUCCESS". Kind of awkward lol but if go inside my target folder and search for the executable, there is. I gave it a try and works perfect, so I cannot complain (I guess).
Some notes apart, I really like the tool. I've been a java developer for a long time and having a tool like this for C is just great. I love the concept of having a repository with the versions of your libs, create a recipe to tell people how to build your software painlessly. The main point here is to stop people from having to figure out which libraries the code is compatible with.
Just a few problems that I can see:
- The code still depends on system libraries :( Horrible thing!!! In my case the compiled code depends on lpthread and ldl taken from the libs installed in my machine (For the linking process). Ideally I should be able to indicate the tools which library I want the version in the maven way.
Hoping to learn much more about the tool.