mapbox / mapbox/cmake-node-module

LINK FLAGS "-z now" throws an error when cross-compiling

Offen
#2 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
CMake
Sterne
20
Forks
3
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I was using cmake-js in conjunction with cmake-node-module to cross-compile node modules for windows from linux. However at line number 178 of module.cmake the LINK_FLAGS "-z now" turns out to be invalid option for the linker x86_64-w64-mingw32-ld. I get the following output,

# Running the following command from a CMakeLists file dir to build the node modules 
cmake-js compile --CDCMAKE_TOOLCHAIN_FILE=<path-to-cmake-toolchain-file>

# The configuring and generating are successful, and build files are written successfully.
# However, in the subsequent linking step I get the following output.
Scanning dependencies of target hello-world-native.abi-93
[  3%] Building CXX object CMakeFiles/hello-world-native.abi-93.dir/src/hello_world.cpp.obj
[  6%] Linking CXX shared library hello-world-native.abi-93.node
/usr/bin/x86_64-w64-mingw32-ld: unrecognized option '-z'
/usr/bin/x86_64-w64-mingw32-ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/hello-world-native.abi-93.dir/build.make:106: hello-world-native.abi-93.node] Error 1
make[1]: *** [CMakeFiles/Makefile2:131: CMakeFiles/hello-world-native.abi-93.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
ERR! OMG Process terminated: 2

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Untersuche module.cmake in Zeile 178 und reproduziere den Cross-Compilation-Befehl mithilfe der bereitgestellten CMake-Toolchain-Datei. Prüfe, wie die Einstellung LINK_FLAGS den x86_64-w64-mingw32-Linker erreicht, und verifiziere anschließend, dass das Ziel hello-world-native.abi-93 erfolgreich gelinkt wird, ohne die nicht unterstützte Option.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cmake, node.js
Bereich
build-system
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.