Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subdirectories in /src - linker errors #190

Closed
laurentS opened this issue May 3, 2015 · 6 comments
Closed

subdirectories in /src - linker errors #190

laurentS opened this issue May 3, 2015 · 6 comments
Assignees
Labels
Milestone

Comments

@laurentS
Copy link

laurentS commented May 3, 2015

My project (on arduino) is structured in modules like:

/src/main.ino
/src/file1.[h|cpp]
/src/shared/debug.[h|cpp]
...

in file1.h, I have #include "shared/debug.h" which worked until platformio auto-upgraded to 1.4.0 (not sure from which version it upgraded, I haven't run it in about a month), and I'm now getting a linker error when compiling:

/src/file1.cpp:95: undefined reference to `debug_func(char const*, ...)'
[...]
collect2: error: ld returned 1 exit status
scons: *** [.pioenvs/autogen_uno/firmware.elf] Error 1

(debug_func is in shared/debug.h)

I tried tweaking build_flags in platformio.ini but unless I use absolute paths in the -L and -I options, a "script" prefix is added, so either it doesn't work, or it's not portable.
What happened during the upgrade that broke my project? I don't want to flatten my file structure, is there a proper way to fix platformio.ini for this?

@ivankravets ivankravets added the bug label May 3, 2015
@ivankravets ivankravets added this to the 1.5.0 milestone May 3, 2015
@valeros valeros assigned ivankravets and valeros and unassigned valeros and ivankravets May 4, 2015
@ivankravets ivankravets assigned ivankravets and unassigned valeros May 5, 2015
@ivankravets
Copy link
Member

Could I ask you to provide PlatformIO-based project where I can reproduce this issue?

Thanks in advance!

@ivankravets ivankravets modified the milestones: 1.5.0, 2.0.1 May 7, 2015
@laurentS
Copy link
Author

laurentS commented May 8, 2015

Ok, after testing on simplified code, the problem seems to be that
/src/shared is in fact a symbolic link to ../other_directory (I'm on linux).
if I move other_directory to /src/other_directory, there is no issue, even with the symbolic link.
The reason for the link is that I was sharing some code between two platformio projects.
I can live with it, so feel free to close the issue, but I wonder what changed in platformio that broke it.

@ivankravets
Copy link
Member

I can live with it, so feel free to close the issue, but I wonder what changed in platformio that broke it.

Could you provide real example and pack it to archive? I will look on it. Thanks,

@laurentS
Copy link
Author

laurentS commented May 8, 2015

yes, I just tried to upload here, but github doesn't like it, so I emailed you a tarball instead.
Hope it helps!

@ivankravets ivankravets modified the milestones: 1.5.0, 2.0.1 May 8, 2015
@ivankravets
Copy link
Member

Thanks a lot! I've just fixed it. Please install the latest development version http://docs.platformio.org/en/latest/installation.html#development-version

I will release new 1.5.0 in the next week.

@laurentS
Copy link
Author

laurentS commented May 8, 2015

Thanks Ivan! Brilliant work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants