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

How to build behavioral-model on the MacOS(Apple M1 Pro(13.5)) #1231

Open
aabhinavg opened this issue Feb 11, 2024 · 2 comments
Open

How to build behavioral-model on the MacOS(Apple M1 Pro(13.5)) #1231

aabhinavg opened this issue Feb 11, 2024 · 2 comments

Comments

@aabhinavg
Copy link

I am trying to build the behavioural model on the MacOS I have tried the following things
git clone https://github.com/p4lang/behavioral-model.git

`#!/bin/bash
set -e

Set PKG_CONFIG_PATH to help pkg-config find libffi

export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"

Install necessary packages using Homebrew

brew install
automake
cmake
gmp
libpcap
boost
libevent
libtool
flex
bison
pkg-config
openssl
libffi
python@3
wget
git

Clone Thrift repository

git clone https://github.com/apache/thrift.git

Navigate into the Thrift directory

cd thrift

Configure Thrift

./bootstrap.sh
./configure.sh

Build and install Thrift

make
sudo make install

Navigate back to the original directory
cd ..

Create a temporary directory

tmpdir=$(mktemp -d -t tmp.XXXXXXXXXX)

Navigate to the temporary directory

cd "$tmpdir"

Navigate back to the original directory

cd ..

Remove the temporary directory

rm -rf "$tmpdir"

echo "Conversion completed."

echo "Initializing the autogen"

####Run the autogen

./autogen.sh

Run the configuration

./configure`

I am trying the above script to build the thrift and getting the following message as

Clone Thrift repository

git clone https://github.com/apache/thrift.git

Navigate into the Thrift directory

cd thrift

Configure Thrift

./bootstrap.sh
./configure.sh

getting error as
libtool: link: g++ -std=gnu++11 -std=c++11 -Wall -Wextra -pedantic -Werror -g -O2 -o thrift src/thrift/audit/thrift-t_audit.o src/thrift/thrift-common.o src/thrift/generate/thrift-t_generator.o src/thrift/thrift-main.o src/thrift/parse/thrift-parse.o src/thrift/parse/thrift-t_typedef.o src/thrift/generate/thrift-t_c_glib_generator.o src/thrift/generate/thrift-t_cl_generator.o src/thrift/generate/thrift-t_cpp_generator.o src/thrift/generate/thrift-t_d_generator.o src/thrift/generate/thrift-t_dart_generator.o src/thrift/generate/thrift-t_delphi_generator.o src/thrift/generate/thrift-t_erl_generator.o src/thrift/generate/thrift-t_go_generator.o src/thrift/generate/thrift-t_gv_generator.o src/thrift/generate/thrift-t_haxe_generator.o src/thrift/generate/thrift-t_html_generator.o src/thrift/generate/thrift-t_markdown_generator.o src/thrift/generate/thrift-t_java_generator.o src/thrift/generate/thrift-t_javame_generator.o src/thrift/generate/thrift-t_js_generator.o src/thrift/generate/thrift-t_json_generator.o src/thrift/generate/thrift-t_kotlin_generator.o src/thrift/generate/thrift-t_lua_generator.o src/thrift/generate/thrift-t_netstd_generator.o src/thrift/generate/thrift-t_ocaml_generator.o src/thrift/generate/thrift-t_perl_generator.o src/thrift/generate/thrift-t_php_generator.o src/thrift/generate/thrift-t_py_generator.o src/thrift/generate/thrift-t_rb_generator.o src/thrift/generate/thrift-t_rs_generator.o src/thrift/generate/thrift-t_st_generator.o src/thrift/generate/thrift-t_swift_generator.o src/thrift/generate/thrift-t_xml_generator.o src/thrift/generate/thrift-t_xsd_generator.o src/thrift/generate/thrift-validator_parser.o src/thrift/generate/thrift-go_validator_generator.o -Wl,-bind_at_load -ll src/thrift/libparse.a -lpthread
ld: warning: object file (/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/lib/libl.a(libmain.o)) was built for newer macOS version (13.3) than being linked (13.0)
ld: warning: object file (/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/lib/libl.a(libyywrap.o)) was built for newer macOS version (13.3) than being linked (13.0)
ld: warning: ignoring file src/thrift/libparse.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
Undefined symbols for architecture arm64:
"yyparse()", referenced from:
parse(t_program*, t_program*, std::__1::set<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>>>&) in thrift-main.o
"_yyin", referenced from:
parse(t_program*, t_program*, std::__1::set<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>>>&) in thrift-main.o
"_yylineno", referenced from:
yyerror(char const*, ...) in thrift-main.o
pdebug(char const*, ...) in thrift-main.o
pwarning(int, char const*, ...) in thrift-main.o
failure(char const*, ...) in thrift-main.o
parse(t_program*, t_program*, std::__1::set<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>>>&) in thrift-main.o
_main in thrift-main.o
"_yytext", referenced from:
yyerror(char const*, ...) in thrift-main.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [thrift] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

@jafingerhut
Copy link
Contributor

I have never built the open source P4 development tools on macOS before, so I will not be of much help to you there.

However, if you are interested in running an arm64 Ubuntu Linux VM on your macOS system, using the free UTM virtualization software, I have done that before and gotten it working, not just for behavioral-model code, but also for the P4 compiler, P4Runtime software, the tutorials repository, mininet, and a few other things.

You can find instructions for creating an Ubuntu Linux arm64 VM on an Apple Silicon Mac using UTM here: https://github.com/jafingerhut/jafingerhut.github.com/blob/master/notes/macos-utm-notes.md

If you succeed in that, inside that VM you can use my install-p4dev-v7.sh install script described here to download, compile, and install behavioral-model, p4c, and several other things: https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md#quick-instructions-for-successful-install-script-run

Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment, or this will be closed in 180 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants