Skip to content

tests: fix linker failure on OS X due to name clash#6326

Merged
miri64 merged 1 commit intoRIOT-OS:masterfrom
smlng:pr/osx/tests_name_clash
Jan 19, 2017
Merged

tests: fix linker failure on OS X due to name clash#6326
miri64 merged 1 commit intoRIOT-OS:masterfrom
smlng:pr/osx/tests_name_clash

Conversation

@smlng
Copy link
Copy Markdown
Member

@smlng smlng commented Jan 11, 2017

This PR fixes the following failure when build tests/libfixmath or tests/lwip:

ld: entry point (_main) undefined. for architecture i386

The problem is that the test application has the same name as the required module and/or package, i.e. libfixmath. Renaming the test application with prefix test_ solves this.

Note: this issue exists only on macOS with LLVM/clang but not on Linux with gcc.

@smlng smlng force-pushed the pr/osx/tests_name_clash branch from e62157d to 1261d25 Compare January 11, 2017 19:34
@OlegHahm OlegHahm added OS: Mac OS X Host OS: This PR/issue concerns usage of RIOT with Mac OS X as a host system Area: pkg Area: External package ports Area: tests Area: tests and testing framework labels Jan 11, 2017
@OlegHahm OlegHahm added this to the Release 2017.01 milestone Jan 11, 2017
@smlng smlng force-pushed the pr/osx/tests_name_clash branch 4 times, most recently from 4509d6e to 0880fc0 Compare January 12, 2017 15:54
@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 12, 2017

based on #6258 and #6333

@smlng smlng force-pushed the pr/osx/tests_name_clash branch 2 times, most recently from 5355645 to 5e427a6 Compare January 12, 2017 19:55
@smlng smlng force-pushed the pr/osx/tests_name_clash branch from 5e427a6 to 0d59a93 Compare January 13, 2017 08:35
@smlng smlng added the State: waiting for other PR State: The PR requires another PR to be merged first label Jan 13, 2017
@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 13, 2017

this PR is (re)based on #6333

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 13, 2017

to clarify what its doing: running certain tests on macOS revealed a name clash in the make system when a test has an APPLICATION variable in its Makefile that is the same as a package required with USEPKG; i.e. this happened with tests/libfixmath, tests/lwip, and tests/pkg_tiny-asn1.

I resolved it by prefixing the APPLCIATION variable with test_, for the sake of consistency I applied this scheme to all other tests as well ...

@smlng smlng force-pushed the pr/osx/tests_name_clash branch from 0d59a93 to 862b419 Compare January 13, 2017 08:57
@kYc0o
Copy link
Copy Markdown
Contributor

kYc0o commented Jan 13, 2017

There's a way to build all the tests at once?

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 13, 2017

@kYc0o yes: murdock or jenkins 😁 btw. Jenkins is fine with the changes.

you could also run:

cd tests;
for i in $(ls); do echo $i; make -C $i; done

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 13, 2017

@kYc0o also note that this PR depends on #6333

[edit]: so do not merge before that one

@kYc0o
Copy link
Copy Markdown
Contributor

kYc0o commented Jan 13, 2017

Well this PR changes every test's name but strangely some tests build without this change, for instance bloom_bytes... Did you had the errors for all the tests you've modified?

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 13, 2017

nope, as said above:

for the sake of consistency I applied this scheme to all other tests as well ...

Copy link
Copy Markdown
Contributor

@kYc0o kYc0o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK then.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Jan 14, 2017

Back to the past then?

@miri64
Copy link
Copy Markdown
Member

miri64 commented Jan 14, 2017

Maybe wait for @Kijewski with this one what he thinks about reverting #1502 ;-)

@OlegHahm
Copy link
Copy Markdown
Member

Well, this PR only reverts the renaming of the application, not the renaming of the folder which is okay, I think. I am more confused that we still have this name clash between RIOT and application code - I thought we solved this long ago.

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 14, 2017

mhm, wasn't aware of #1502 ... it seems that name clashes are only an issue on macOS, not Linux.

However I don't think its bad to have the APPLICATION variable of tests to be prefixed by test_, and would further suggest to add example_ to all examples.

But, for now I only want to fix macOS to get it into Jenkins with green build status 😄

@OlegHahm
Copy link
Copy Markdown
Member

Out of curiosity: do you understand why it is failing on OSX?

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 15, 2017

not exactly, but I don't think its clang - its the version of make on macOS. I didn't dig any deeper into the build system of RIOT, I think others are more familiar with that, @kaspar030 maybe?

As said before, it must be some clash with the APPLICATIONS and USEPKG variables in a Makefile. For instance tests/libfixmath failed where APPLICATION = libfixmath and USEPKG = libfixmath are present, while tests/libfixmath_unittests does not fail, prefixing the former to have APPLICATION = test_libfixmath solved the problem. Same thing for tests/lwip and tests/tiny-asn1, both had APPLICATION and USEPKG with the same name in their Makefiles.

edit:

the result is that the main of the application is not build (due to the same name with package) and hence not found by the linker. Further, this problem only pops up with packages not with modules (USEMODULE) of the same name as APPLICATION - atleast I haven't observer that.

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 18, 2017

@OlegHahm any objections? Otherwise this should go into the release. Btw. CI is happy, too

@smlng smlng force-pushed the pr/osx/tests_name_clash branch from 862b419 to d33ae0f Compare January 18, 2017 19:35
@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 18, 2017

rebased without depending on other PR now

@smlng smlng added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed State: waiting for other PR State: The PR requires another PR to be merged first labels Jan 18, 2017
@miri64
Copy link
Copy Markdown
Member

miri64 commented Jan 18, 2017

Murdock succeeded and Jenkins failed, though from the Webview it isn't clear why.

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 19, 2017

maybe some changes in the CI server infrastructure and the job got stuck, Jenkins is in parts WIP. Anyway, rescheduled on Jenkins - if Murdock is fine, Jenkins should/will be, too.

🍵 and wait ...

@smlng smlng force-pushed the pr/osx/tests_name_clash branch from d33ae0f to c098f28 Compare January 19, 2017 08:25
@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 19, 2017

rebased

@miri64
Copy link
Copy Markdown
Member

miri64 commented Jan 19, 2017

Needs rebase again.

@OlegHahm
Copy link
Copy Markdown
Member

For the record: I don't object this PR.

@Kijewski
Copy link
Copy Markdown
Contributor

Since #1502 we made some changes to the make system which disallows two modules sharing the same name. So this PR seems to be indeed needed. But maybe it would be enough to edit tests/Makefile.tests_common, not every tests/*/Makefile?

@smlng smlng force-pushed the pr/osx/tests_name_clash branch from c098f28 to 613fd63 Compare January 19, 2017 12:09
@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 19, 2017

rebased, lets wait for CI ...

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since #1502 we made some changes to the make system which disallows two modules sharing the same name. So this PR seems to be indeed needed. But maybe it would be enough to edit tests/Makefile.tests_common, not every tests/*/Makefile?

+1 for @Kijewski's proposal to adapt the name in the Makefile.tests_common (maybe even set it automatically by the directory name)

    - fixes name clash on macOS
    - correct naming of test coap to pkg_libcoap
@smlng smlng force-pushed the pr/osx/tests_name_clash branch from 613fd63 to 6a037ad Compare January 19, 2017 14:20
@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 19, 2017

done! Lets see if CI is happy

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

Copy link
Copy Markdown
Contributor

@Kijewski Kijewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@miri64 miri64 merged commit 76f951b into RIOT-OS:master Jan 19, 2017
@smlng smlng deleted the pr/osx/tests_name_clash branch January 19, 2017 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: pkg Area: External package ports Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR OS: Mac OS X Host OS: This PR/issue concerns usage of RIOT with Mac OS X as a host system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants