Closed Bug 1165531 Opened 9 years ago Closed 9 years ago

read-only segment has dynamic relocations failure linking rust code

Categories

(Firefox Build System :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

(firefox41 affected)

RESOLVED FIXED
Tracking Status
firefox41 --- affected

People

(Reporter: rillian, Unassigned)

References

Details

Pushing our rust linkage gtest to try fails in linux32:

15:42:23 INFO - /builds/slave/try-lx-d-000000000000000000000/build/src/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.3/../../../../x86_64-unknown-linux-gnu/bin/ld: read-only segment has dynamic relocations.
15:42:23 INFO - collect2: error: ld returned 1 exit status
15:42:23 INFO - make[3]: *** [libxul.so] Error 1
15:42:23 INFO - make[3]: Target `target' not remade because of errors.
15:42:23 INFO - make[3]: Target `target' not remade because of errors.
15:42:23 INFO - make[3]: Leaving directory `/builds/slave/try-lx-d-000000000000000000000/build/src/obj-firefox/toolkit/library/gtest'
15:42:23 INFO - make[2]: *** [gtestxul] Error 2
15:42:23 INFO - make[2]: Leaving directory `/builds/slave/try-lx-d-000000000000000000000/build/src/obj-firefox/toolkit/library'
15:42:23 INFO - make[1]: *** [check] Error 2
15:42:23 INFO - make[1]: Leaving directory `/builds/slave/try-lx-d-000000000000000000000/build/src/obj-firefox/testing/gtest'
15:42:23 INFO - make: *** [check] Error 2
In my experience this happens when including a header for Rust functions that doesn't contain extern "C".
I suggest adding this to any header, if this is indeed the problem.
   #ifdef __cplusplus
   extern "C" {
   #endif
   [...]
   #ifdef __cplusplus
   }
   #endif
While I don't believe I've personally encountered this linker error before, for Rust code specifically you can recompile with a different relocation model via:

    rustc -C relocation-model={static,dynamic,...}
I haven't seen this in a while. I expect valentin's suggestion from comment #1 was the issue.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.