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

Add support of cross-compilation for linux-based targets. #206

Merged
merged 2 commits into from
Jun 30, 2015

Conversation

egavrin
Copy link
Contributor

@egavrin egavrin commented Jun 18, 2015

Usage:

  • Cross compile:
    make debug.linux TOOLCHAIN=./build/configs/toolchain_linux_armv7l-el.cmake
  • Build unittests
    make unittests TOOLCHAIN=./build/configs/toolchain_linux_armv7l-el.cmake
  • Run unittests on target board
    ./tools/runners/run-unittests-remote.sh
  • Run JavaScript test on target board
    ./tools/runners/run-tests-remote.sh debug.linux

JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin [email protected]

@egavrin egavrin added enhancement An improvement infrastructure Related to GH Actions or the tested targets development Feature implementation labels Jun 18, 2015
@egavrin egavrin added this to the Core ECMA features milestone Jun 18, 2015
mkdir -p ${LOGS_PATH_PARSE_ONLY}
mkdir -p ${LOGS_PATH_FULL}

RAND=`strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 5 | tr -d '\n'; echo`
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe, it is better to use mktemp utility for generation of a directory with random name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

const opcode_t opcode = getop_meta (OPCODE_META_TYPE_CALL_SITE_INFO,
flags,
(flags & OPCODE_CALL_FLAGS_HAVE_THIS_ARG) ? this_arg.data.uid : INVALID_VALUE);
const opcode_t opcode = getop_meta(OPCODE_META_TYPE_CALL_SITE_INFO,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is not related to the PR, but required for cross building. I'll push this change as a separate commit.

@egavrin egavrin force-pushed the origin/cross-dev branch 2 times, most recently from e456ab5 to d8a9c3e Compare June 22, 2015 12:35
@egavrin
Copy link
Contributor Author

egavrin commented Jun 22, 2015

@ruben-ayrapetyan gcc version 4.7.4 (Ubuntu/Linaro 4.7.4-2ubuntu1)

@egavrin
Copy link
Contributor Author

egavrin commented Jun 22, 2015

@ruben-ayrapetyan Fix build error using GCC 4.7.4?

@ruben-ayrapetyan
Copy link
Contributor

@egavrin, looks good.

@egavrin egavrin force-pushed the origin/cross-dev branch from d8a9c3e to 74c56b1 Compare June 22, 2015 13:15
@egavrin
Copy link
Contributor Author

egavrin commented Jun 22, 2015

Folks, I've updated the PR, please check.

//cc @galpeter @LaszloLango @ruben-ayrapetyan

@egavrin egavrin assigned galpeter and unassigned egavrin Jun 22, 2015
@egavrin egavrin changed the title Add support for cross compilation for linux-based targets. Add support of cross-compilation for linux-based targets. Jun 22, 2015
@egavrin egavrin force-pushed the origin/cross-dev branch from 74c56b1 to 9b7ece4 Compare June 22, 2015 18:14
# See the License for the specific language governing permissions and
# limitations under the License.

OUT_DIR=$1
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe, it is better to wrap variables into quotes, like "$1". In the case, space wouldn't divide variable's value and special characters in path would not be replaced.

http://www.tldp.org/LDP/abs/html/quotingvar.html
"When referencing a variable, it is generally advisable to enclose its name in double quotes. This prevents reinterpretation of all special characters within the quoted string -- except $, ` (backquote), and \ (escape)."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, it should be wrapped, but other our scripts doesn't follow this style. I may fix it within this PR, but we should fix this in other scripts too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@egavrin egavrin force-pushed the origin/cross-dev branch from 9b7ece4 to b9b1704 Compare June 23, 2015 07:08
@egavrin
Copy link
Contributor Author

egavrin commented Jun 23, 2015

I'll rise a separate pull request to fix other issues in scripts, likewise.

@egavrin
Copy link
Contributor Author

egavrin commented Jun 23, 2015

PR was updated.

@egavrin egavrin force-pushed the origin/cross-dev branch 2 times, most recently from 5ecc00a to 8dc8678 Compare June 23, 2015 10:05
@@ -17,7 +17,6 @@ set(CMAKE_SYSTEM_PROCESSOR x86_64)

find_program(CMAKE_C_COMPILER NAMES x86_64-linux-gnu-gcc x86_64-unknown-linux-gnu-gcc)
find_program(CMAKE_CXX_COMPILER NAMES x86_64-linux-gnu-g++ x86_64-unknown-linux-gnu-g++)
# FIXME: This could break cross compilation, when the strip is not for the target architecture
find_program(CMAKE_STRIP NAMES x86_64-linux-gnu-strip x86_64-unknown-linux-gnu-strip strip)
find_program(CMAKE_STRIP NAMES x86_64-linux-gnu-strip x86_64-unknown-linux-gnu-strip)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did the strip at the end made the x86_64 cross compilation to cause any problems?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@galpeter no, not really. I may add it back.
I think we can add native toolchain configuration with a separate PR, like Add toolchain_native.cmake.

@egavrin egavrin force-pushed the origin/cross-dev branch from 8dc8678 to 6a1b90e Compare June 29, 2015 17:27
@egavrin
Copy link
Contributor Author

egavrin commented Jun 29, 2015

@galpeter PR was updated, I restored strip.

@egavrin egavrin force-pushed the origin/cross-dev branch 3 times, most recently from f855b19 to 00e00df Compare June 29, 2015 17:48
[ $RESULT_OK -eq 1 ] || exit 1

echo -e "Full testing completed successfully\n\n================\n\n"
./tools/precommit-full-testing.sh ${OUT_DIR} ${TARGETS} || exit 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this pass the ${TARGETS} as the 2nd, 3rd and etc args? For example if the TARGETS are: debug.linux release.linux. the command will look like this:
./tools/precommit-full-testing.sh ${OUT_DIR} debug.linux release.linux

Maybe we need to enclose the arguments into quotes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@egavrin egavrin force-pushed the origin/cross-dev branch from 00e00df to 6267696 Compare June 30, 2015 11:45
@galpeter
Copy link
Contributor

seems good to me.

@galpeter galpeter removed their assignment Jun 30, 2015
@egavrin
Copy link
Contributor Author

egavrin commented Jun 30, 2015

Great! Thank you!

egavrin added 2 commits June 30, 2015 15:03
JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin [email protected]
Usage:
- Cross compile:
make debug.linux TOOLCHAIN=./build/configs/toolchain_linux_armv7l-el.cmake
- Build unittests
make unittests TOOLCHAIN=./build/configs/toolchain_linux_armv7l-el.cmake
- Run unittests on target board
./tools/runners/run-unittests-remote.sh <ip> <login> <pass>
- Run JavaScript test on target board
./tools/runners/run-tests-remote.sh debug.linux <ip> <login> <pass>

JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Feature implementation enhancement An improvement infrastructure Related to GH Actions or the tested targets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants