{"action":"created","issue":{"url":"https://api.github.com/repos/synthetos/g2/issues/58","labels_url":"https://api.github.com/repos/synthetos/g2/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/synthetos/g2/issues/58/comments","events_url":"https://api.github.com/repos/synthetos/g2/issues/58/events","html_url":"https://github.com/synthetos/g2/issues/58","id":59704374,"number":58,"title":"Build issues under linux (order of object files on linker command line)","user":{"login":"dhylands","id":127500,"avatar_url":"https://avatars.githubusercontent.com/u/127500?v=3","gravatar_id":"","url":"https://api.github.com/users/dhylands","html_url":"https://github.com/dhylands","followers_url":"https://api.github.com/users/dhylands/followers","following_url":"https://api.github.com/users/dhylands/following{/other_user}","gists_url":"https://api.github.com/users/dhylands/gists{/gist_id}","starred_url":"https://api.github.com/users/dhylands/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhylands/subscriptions","organizations_url":"https://api.github.com/users/dhylands/orgs","repos_url":"https://api.github.com/users/dhylands/repos","events_url":"https://api.github.com/users/dhylands/events{/privacy}","received_events_url":"https://api.github.com/users/dhylands/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-03-03T20:58:31Z","updated_at":"2015-03-05T07:14:23Z","closed_at":null,"body":"I was helping @buserror investigate why his firmware wasn't working properly.\r\n\r\nRight now, I've reached the point in the investigation that it seems to be triggered by some differences between make 4.0 and make 3.81, specifically related to the order of the object files produced by $(wildcard).\r\n\r\nOn my local machine (ubuntu 14.04) if I build with make-3.81, I get the following linker line:\r\n\r\narm-none-eabi-g++  -T\"/home/dhylands/g2/g2/TinyG2/platform/atmel_sam/gcc_flash.ld\" -Wl,-Map,\"bin/gShield/gShield.map\" -o bin/gShield/gShield.elf -lgcc -lc  -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -nostartfiles -mcpu=cortex-m3 --specs=nano.specs  -u _printf_float  -mthumb   -lgcc -lc -Wl,--start-group build/gShield/motate/SamTimers.o build/gShield/motate/SamUSB.o build/gShield/motate/SamPins.o build/gShield/platform/atmel_sam/syscalls_sam3.o build/gShield/CMSIS/Device/ATMEL/sam3xa/source/system_sam3xa.o build/gShield/CMSIS/Device/ATMEL/sam3xa/source/gcc/startup_sam3xa.o build/gShield/platform/atmel_sam/cortex_handlers.o build/gShield/platform/atmel_sam/hooks.o build/gShield/motate/AvrUSB.o build/gShield/motate/SamSPI.o build/gShield/./canonical_machine.o build/gShield/./config_app.o build/gShield/./config.o build/gShield/./controller.o build/gShield/./cycle_homing.o build/gShield/./cycle_jogging.o build/gShield/./cycle_probing.o build/gShield/./encoder.o build/gShield/./gcode_parser.o build/gShield/./hardware.o build/gShield/./help.o build/gShield/./json_parser.o build/gShield/./kinematics.o build/gShield/./main.o build/gShield/./persistence.o build/gShield/./plan_arc.o build/gShield/./plan_exec.o build/gShield/./plan_line.o build/gShield/./planner.o build/gShield/./plan_zoid.o build/gShield/./pwm.o build/gShield/./report.o build/gShield/./spindle.o build/gShield/./stepper.o build/gShield/./switch.o build/gShield/./test.o build/gShield/./text_parser.o build/gShield/./util.o build/gShield/./xio.o build/gShield/platform/atmel_sam/Reset.o build/gShield/platform/atmel_sam/UniqueId.o -Wl,--end-group\r\n\r\nThis produces working firmware.\r\n\r\nUsing make 4.0, I get the following linker line:\r\n\r\narm-none-eabi-g++  -T\"/home/dhylands/g2/g2/TinyG2/platform/atmel_sam/gcc_flash.ld\" -Wl,-Map,\"bin/gShield/gShield.map\" -o bin/gShield/gShield.elf -lgcc -lc  -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -nostartfiles -mcpu=cortex-m3 --specs=nano.specs  -u _printf_float  -mthumb   -lgcc -lc -Wl,--start-group build/gShield/motate/SamTimers.o build/gShield/motate/SamUSB.o build/gShield/motate/SamPins.o build/gShield/platform/atmel_sam/syscalls_sam3.o build/gShield/CMSIS/Device/ATMEL/sam3xa/source/system_sam3xa.o build/gShield/CMSIS/Device/ATMEL/sam3xa/source/gcc/startup_sam3xa.o build/gShield/platform/atmel_sam/hooks.o build/gShield/platform/atmel_sam/cortex_handlers.o build/gShield/motate/AvrUSB.o build/gShield/motate/SamSPI.o build/gShield/./help.o build/gShield/./cycle_homing.o build/gShield/./text_parser.o build/gShield/./controller.o build/gShield/./switch.o build/gShield/./planner.o build/gShield/./plan_arc.o build/gShield/./hardware.o build/gShield/./kinematics.o build/gShield/./cycle_probing.o build/gShield/./pwm.o build/gShield/./plan_zoid.o build/gShield/./stepper.o build/gShield/./plan_line.o build/gShield/./json_parser.o build/gShield/./config_app.o build/gShield/./xio.o build/gShield/./cycle_jogging.o build/gShield/./report.o build/gShield/./config.o build/gShield/./canonical_machine.o build/gShield/./encoder.o build/gShield/./persistence.o build/gShield/./gcode_parser.o build/gShield/./main.o build/gShield/./plan_exec.o build/gShield/./test.o build/gShield/./spindle.o build/gShield/./util.o build/gShield/platform/atmel_sam/UniqueId.o build/gShield/platform/atmel_sam/Reset.o -Wl,--end-group\r\n\r\nand this produces non-working firmware.\r\n\r\nThe only difference between these 2 lines is the order of the .o files.\r\n\r\nI need to investigate further to determine if this is a problem with the code (depending on things being in a particular order) or a toolchain issue. \r\n\r\nSo I figured I'd open this issue to at least make others aware of the issue, in case they're also experiencing similar problems, and I'll add to this as I discover more."},"comment":{"url":"https://api.github.com/repos/synthetos/g2/issues/comments/77317676","html_url":"https://github.com/synthetos/g2/issues/58#issuecomment-77317676","issue_url":"https://api.github.com/repos/synthetos/g2/issues/58","id":77317676,"user":{"login":"dhylands","id":127500,"avatar_url":"https://avatars.githubusercontent.com/u/127500?v=3","gravatar_id":"","url":"https://api.github.com/users/dhylands","html_url":"https://github.com/dhylands","followers_url":"https://api.github.com/users/dhylands/followers","following_url":"https://api.github.com/users/dhylands/following{/other_user}","gists_url":"https://api.github.com/users/dhylands/gists{/gist_id}","starred_url":"https://api.github.com/users/dhylands/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhylands/subscriptions","organizations_url":"https://api.github.com/users/dhylands/orgs","repos_url":"https://api.github.com/users/dhylands/repos","events_url":"https://api.github.com/users/dhylands/events{/privacy}","received_events_url":"https://api.github.com/users/dhylands/received_events","type":"User","site_admin":false},"created_at":"2015-03-05T07:14:23Z","updated_at":"2015-03-05T07:14:23Z","body":"main.o need to be after the motate objects and somewhere before xio.o\r\n\r\nSo using FIRST_LINK_SOURCES isn't an option. We could just sort the source files (main is alphabetically before xio so that happens to work), or use a sorted list with main.o at the beginning of the list (this is what PR #59 does).\r\n\r\nIf you just want to do the sorting, I'm happy to change my PR.\r\n"}}